Implement more wrappers and refactoring
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 27s
Builds / ExectOS (i686) (push) Successful in 25s

This commit is contained in:
2023-12-16 12:44:18 +01:00
parent 83e555043a
commit 74cac842a5
6 changed files with 160 additions and 69 deletions

View File

@@ -122,7 +122,7 @@ BlpDetermineDialogBoxSize(IN OUT PXTBL_DIALOG_HANDLE Handle,
Width += 4;
/* Get console resolution */
BlConsoleQueryMode(&Handle->ResX, &Handle->ResY);
BlQueryConsoleMode(&Handle->ResX, &Handle->ResY);
/* Make sure dialog window fits in the buffer */
if(Width > TUI_MAX_DIALOG_WIDTH)
@@ -328,7 +328,7 @@ BlpDrawDialogButton(IN PXTBL_DIALOG_HANDLE Handle)
}
/* Disable cursor and draw dialog button */
BlConsoleDisableCursor();
BlDisableConsoleCursor();
BlSetConsoleAttributes(ButtonColor | TextColor);
BlSetCursorPosition(Handle->ResX / 2 - 4, Handle->PosY + Handle->Height - 2);
BlConsolePrint(L"[ OK ]");
@@ -393,7 +393,7 @@ BlpDrawDialogInputField(IN PXTBL_DIALOG_HANDLE Handle,
}
/* Disable cursor and write input field to console */
BlConsoleDisableCursor();
BlDisableConsoleCursor();
BlConsoleWrite(InputField);
/* Write input field text */
@@ -404,7 +404,7 @@ BlpDrawDialogInputField(IN PXTBL_DIALOG_HANDLE Handle,
if(Handle->Attributes & TUI_DIALOG_ACTIVE_INPUT_FIELD)
{
/* Enable cursor for active input field */
BlConsoleEnableCursor();
BlEnableConsoleCursor();
}
}
@@ -459,14 +459,26 @@ BlpDrawDialogProgressBar(IN PXTBL_DIALOG_HANDLE Handle,
ProgressBar[Index] = 0;
/* Disable cursor and write progress bar to console */
BlConsoleDisableCursor();
BlDisableConsoleCursor();
BlConsoleWrite(ProgressBar);
}
/**
* Displays a red error dialog box with the specified caption and message.
*
* @param Caption
* Supplies a caption string put on the dialog box.
*
* @param Message
* Supplies a message string put on the dialog box.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
BlDisplayErrorDialog(IN PWCHAR Caption,
@@ -483,7 +495,7 @@ BlDisplayErrorDialog(IN PWCHAR Caption,
BlpDetermineDialogBoxSize(&Handle, Message);
/* Disable cursor and draw dialog box */
BlConsoleDisableCursor();
BlDisableConsoleCursor();
BlpDrawDialogBox(&Handle, Caption, Message);
/* Draw active button */
@@ -497,14 +509,14 @@ BlDisplayErrorDialog(IN PWCHAR Caption,
while(Key.ScanCode != 0x17 && Key.UnicodeChar != 0x0D)
{
/* Wait for key press and read key stroke */
EfiSystemTable->BootServices->WaitForEvent(1, &EfiSystemTable->ConIn->WaitForKey, &Index);
EfiSystemTable->ConIn->ReadKeyStroke(EfiSystemTable->ConIn, &Key);
EfiSystemTable->ConIn->Reset(EfiSystemTable->ConIn, FALSE);
BlWaitForEfiEvent(1, &EfiSystemTable->ConIn->WaitForKey, &Index);
BlReadKeyStroke(&Key);
BlResetConsoleInputBuffer();
}
/* Clear screen to remove dialog box */
BlSetConsoleAttributes(EFI_TEXT_BGCOLOR_BLACK | EFI_TEXT_FGCOLOR_LIGHTGRAY);
BlConsoleClearScreen();
BlClearConsoleScreen();
}
XTCDECL
@@ -523,7 +535,7 @@ BlDisplayInfoDialog(IN PWCHAR Caption,
BlpDetermineDialogBoxSize(&Handle, Message);
/* Disable cursor and draw dialog box */
BlConsoleDisableCursor();
BlDisableConsoleCursor();
BlpDrawDialogBox(&Handle, Caption, Message);
/* Draw active button */
@@ -537,14 +549,14 @@ BlDisplayInfoDialog(IN PWCHAR Caption,
while(Key.ScanCode != 0x17 && Key.UnicodeChar != 0x0D)
{
/* Wait for key press and read key stroke */
EfiSystemTable->BootServices->WaitForEvent(1, &EfiSystemTable->ConIn->WaitForKey, &Index);
EfiSystemTable->ConIn->ReadKeyStroke(EfiSystemTable->ConIn, &Key);
EfiSystemTable->ConIn->Reset(EfiSystemTable->ConIn, FALSE);
BlWaitForEfiEvent(1, &EfiSystemTable->ConIn->WaitForKey, &Index);
BlReadKeyStroke(&Key);
BlResetConsoleInputBuffer();
}
/* Clear screen to remove dialog box */
BlSetConsoleAttributes(EFI_TEXT_BGCOLOR_BLACK | EFI_TEXT_FGCOLOR_LIGHTGRAY);
BlConsoleClearScreen();
BlClearConsoleScreen();
}
XTCDECL
@@ -565,7 +577,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
BlpDetermineDialogBoxSize(&Handle, Message);
/* Disable cursor and draw dialog box */
BlConsoleDisableCursor();
BlDisableConsoleCursor();
BlpDrawDialogBox(&Handle, Caption, Message);
/* Draw inactive button */
@@ -593,9 +605,9 @@ BlDisplayInputDialog(IN PWCHAR Caption,
while(TRUE)
{
/* Wait for key press and read key stroke */
EfiSystemTable->BootServices->WaitForEvent(1, &EfiSystemTable->ConIn->WaitForKey, &Index);
EfiSystemTable->ConIn->ReadKeyStroke(EfiSystemTable->ConIn, &Key);
EfiSystemTable->ConIn->Reset(EfiSystemTable->ConIn, FALSE);
BlWaitForEfiEvent(1, &EfiSystemTable->ConIn->WaitForKey, &Index);
BlReadKeyStroke(&Key);
BlResetConsoleInputBuffer();
/* Check key press scan code */
if(Key.ScanCode == 0x17)
@@ -711,7 +723,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
/* Clear screen to remove dialog box */
BlSetConsoleAttributes(EFI_TEXT_BGCOLOR_BLACK | EFI_TEXT_FGCOLOR_LIGHTGRAY);
BlConsoleClearScreen();
BlClearConsoleScreen();
}
XTCDECL
@@ -729,7 +741,7 @@ BlDisplayProgressDialog(IN PWCHAR Caption,
BlpDetermineDialogBoxSize(&Handle, Message);
/* Disable cursor and draw dialog box */
BlConsoleDisableCursor();
BlDisableConsoleCursor();
BlpDrawDialogBox(&Handle, Caption, Message);
/* Draw active button */