Do not print caption, nor message on the dialog box if not needed
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 32s
Builds / ExectOS (i686) (push) Successful in 29s

This commit is contained in:
Rafal Kupiec 2023-12-17 23:45:01 +01:00
parent ceee294df7
commit c2d40e3011
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4

View File

@ -341,16 +341,13 @@ BlpDrawDialogBox(IN OUT PXTBL_DIALOG_HANDLE Handle,
Handle->DialogColor = EFI_TEXT_BGCOLOR_RED; Handle->DialogColor = EFI_TEXT_BGCOLOR_RED;
Handle->TextColor = EFI_TEXT_FGCOLOR_WHITE; Handle->TextColor = EFI_TEXT_FGCOLOR_WHITE;
} }
else else if(Handle->Attributes & XTBL_TUI_DIALOG_GENERIC_BOX)
{ {
/* Generic dialog with blue background and cyan button */ /* Generic dialog with blue background and cyan button */
Handle->DialogColor = EFI_TEXT_BGCOLOR_BLUE; Handle->DialogColor = EFI_TEXT_BGCOLOR_BLUE;
Handle->TextColor = EFI_TEXT_FGCOLOR_WHITE; Handle->TextColor = EFI_TEXT_FGCOLOR_WHITE;
} }
/* Get caption length */
CaptionLength = RtlWideStringLength(Caption, 0);
/* Set dialog box colors */ /* Set dialog box colors */
BlSetConsoleAttributes(Handle->DialogColor | 0x0F); BlSetConsoleAttributes(Handle->DialogColor | 0x0F);
@ -365,16 +362,30 @@ BlpDrawDialogBox(IN OUT PXTBL_DIALOG_HANDLE Handle,
{ {
/* Draw top line of the dialog box, starting from the left corner */ /* Draw top line of the dialog box, starting from the left corner */
BoxLine[0] = EFI_TEXT_BOX_DOWN_RIGHT; BoxLine[0] = EFI_TEXT_BOX_DOWN_RIGHT;
BoxLine[1] = EFI_TEXT_BOX_VERTICAL_LEFT;
/* Fill caption area with spaces */ /* Check if there is a caption for this dialog */
for(PosX = 2; PosX < CaptionLength + 4; PosX++) if(Caption != NULL)
{ {
BoxLine[PosX] = ' '; /* Get caption length */
} CaptionLength = RtlWideStringLength(Caption, 0);
/* End caption area with vertical line */ /* Start caption area with vertical line */
BoxLine[CaptionLength + 4] = EFI_TEXT_BOX_VERTICAL_RIGHT; BoxLine[1] = EFI_TEXT_BOX_VERTICAL_LEFT;
/* Fill caption area with spaces */
for(PosX = 2; PosX < CaptionLength + 4; PosX++)
{
BoxLine[PosX] = ' ';
}
/* End caption area with vertical line */
BoxLine[CaptionLength + 4] = EFI_TEXT_BOX_VERTICAL_RIGHT;
}
else
{
/* No caption, -4 because of left and right vertical lines and corresponding spaces */
CaptionLength = -4;
}
/* Draw bottom line */ /* Draw bottom line */
for(PosX = CaptionLength + 5; PosX < Handle->Width - 1; PosX++) for(PosX = CaptionLength + 5; PosX < Handle->Width - 1; PosX++)
@ -421,12 +432,20 @@ BlpDrawDialogBox(IN OUT PXTBL_DIALOG_HANDLE Handle,
BlConsoleWrite(BoxLine); BlConsoleWrite(BoxLine);
} }
/* Make sure there is a caption to print */
if(Caption != NULL)
{
/* Write dialog box caption */ /* Write dialog box caption */
BlSetCursorPosition(Handle->PosX + 3, Handle->PosY); BlSetCursorPosition(Handle->PosX + 3, Handle->PosY);
BlConsolePrint(L"%S", Caption); BlConsolePrint(L"%S", Caption);
}
/* Write a message on the dialog box */ /* Make sure there is a message to print */
BlpDrawDialogMessage(Handle, Message); if(Message != NULL)
{
/* Write a message on the dialog box */
BlpDrawDialogMessage(Handle, Message);
}
} }
/** /**