XTLDR Rewrite #7

Merged
belliash merged 184 commits from xtldr_rewrite into master 2024-01-09 18:51:04 +01:00
Showing only changes of commit c2d40e3011 - Show all commits

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,6 +362,14 @@ 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;
/* Check if there is a caption for this dialog */
if(Caption != NULL)
{
/* Get caption length */
CaptionLength = RtlWideStringLength(Caption, 0);
/* Start caption area with vertical line */
BoxLine[1] = EFI_TEXT_BOX_VERTICAL_LEFT; BoxLine[1] = EFI_TEXT_BOX_VERTICAL_LEFT;
/* Fill caption area with spaces */ /* Fill caption area with spaces */
@ -375,6 +380,12 @@ BlpDrawDialogBox(IN OUT PXTBL_DIALOG_HANDLE Handle,
/* End caption area with vertical line */ /* End caption area with vertical line */
BoxLine[CaptionLength + 4] = EFI_TEXT_BOX_VERTICAL_RIGHT; 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);
}
/* Make sure there is a message to print */
if(Message != NULL)
{
/* Write a message on the dialog box */ /* Write a message on the dialog box */
BlpDrawDialogMessage(Handle, Message); BlpDrawDialogMessage(Handle, Message);
}
} }
/** /**