XTLDR Rewrite #7
@ -35,8 +35,8 @@
|
||||
#define XTBL_TUI_DIALOG_ERROR_BOX 2
|
||||
#define XTBL_TUI_DIALOG_ACTIVE_BUTTON 4
|
||||
#define XTBL_TUI_DIALOG_INACTIVE_BUTTON 8
|
||||
#define XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD 16
|
||||
#define XTBL_TUI_DIALOG_INACTIVE_INPUT_FIELD 32
|
||||
#define XTBL_TUI_DIALOG_ACTIVE_INPUT 16
|
||||
#define XTBL_TUI_DIALOG_INACTIVE_INPUT 32
|
||||
#define XTBL_TUI_DIALOG_PROGRESS_BAR 64
|
||||
|
||||
/* TUI dialog box maximum width */
|
||||
|
@ -231,8 +231,8 @@ BlpDetermineDialogBoxSize(IN OUT PXTBL_DIALOG_HANDLE Handle,
|
||||
case XTBL_TUI_DIALOG_INACTIVE_BUTTON:
|
||||
Height += 1;
|
||||
break;
|
||||
case XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD:
|
||||
case XTBL_TUI_DIALOG_INACTIVE_INPUT_FIELD:
|
||||
case XTBL_TUI_DIALOG_ACTIVE_INPUT:
|
||||
case XTBL_TUI_DIALOG_INACTIVE_INPUT:
|
||||
case XTBL_TUI_DIALOG_PROGRESS_BAR:
|
||||
Height += 2;
|
||||
break;
|
||||
@ -244,7 +244,7 @@ BlpDetermineDialogBoxSize(IN OUT PXTBL_DIALOG_HANDLE Handle,
|
||||
}
|
||||
|
||||
/* Check if input field is active */
|
||||
if(Handle->Attributes & (XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD | XTBL_TUI_DIALOG_INACTIVE_INPUT_FIELD))
|
||||
if(Handle->Attributes & (XTBL_TUI_DIALOG_ACTIVE_INPUT | XTBL_TUI_DIALOG_INACTIVE_INPUT))
|
||||
{
|
||||
/* Set maximum dialog window width to fit input field */
|
||||
Width = XTBL_TUI_MAX_DIALOG_WIDTH;
|
||||
@ -499,7 +499,7 @@ BlpDrawDialogInputField(IN PXTBL_DIALOG_HANDLE Handle,
|
||||
UINT_PTR Index, Position;
|
||||
|
||||
/* Set dialog button colors */
|
||||
if(Handle->Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD)
|
||||
if(Handle->Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT)
|
||||
{
|
||||
/* This is an active input field */
|
||||
if(Handle->Attributes & XTBL_TUI_DIALOG_ERROR_BOX)
|
||||
@ -543,7 +543,7 @@ BlpDrawDialogInputField(IN PXTBL_DIALOG_HANDLE Handle,
|
||||
BlConsoleWrite(InputFieldText);
|
||||
|
||||
/* Check if this is an active input field */
|
||||
if(Handle->Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD)
|
||||
if(Handle->Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT)
|
||||
{
|
||||
/* Enable cursor for active input field */
|
||||
BlEnableConsoleCursor();
|
||||
@ -676,7 +676,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
||||
UINT_PTR Index;
|
||||
|
||||
/* Set dialog window attributes */
|
||||
Handle.Attributes = XTBL_TUI_DIALOG_GENERIC_BOX | XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD | XTBL_TUI_DIALOG_INACTIVE_BUTTON;
|
||||
Handle.Attributes = XTBL_TUI_DIALOG_GENERIC_BOX | XTBL_TUI_DIALOG_ACTIVE_INPUT | XTBL_TUI_DIALOG_INACTIVE_BUTTON;
|
||||
|
||||
/* Determine dialog window size and position */
|
||||
BlpDetermineDialogBoxSize(&Handle, Message);
|
||||
@ -723,13 +723,13 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
||||
else if(Key.UnicodeChar == 0x09)
|
||||
{
|
||||
/* TAB key pressed, toggle input field and button */
|
||||
Handle.Attributes ^= (XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD | XTBL_TUI_DIALOG_INACTIVE_INPUT_FIELD);
|
||||
Handle.Attributes ^= (XTBL_TUI_DIALOG_ACTIVE_INPUT | XTBL_TUI_DIALOG_INACTIVE_INPUT);
|
||||
Handle.Attributes ^= (XTBL_TUI_DIALOG_ACTIVE_BUTTON | XTBL_TUI_DIALOG_INACTIVE_BUTTON);
|
||||
}
|
||||
else if(Key.ScanCode == 0x03)
|
||||
{
|
||||
/* RIGHT key pressed, move cursor forward */
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD && TextPosition < InputFieldLength)
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT && TextPosition < InputFieldLength)
|
||||
{
|
||||
TextPosition++;
|
||||
}
|
||||
@ -737,7 +737,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
||||
else if(Key.ScanCode == 0x04)
|
||||
{
|
||||
/* LEFT key pressed, move cursor back */
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD && TextPosition > 0)
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT && TextPosition > 0)
|
||||
{
|
||||
TextPosition--;
|
||||
}
|
||||
@ -745,7 +745,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
||||
else if(Key.ScanCode == 0x05)
|
||||
{
|
||||
/* HOME key pressed, move cursor to the beginning */
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD)
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT)
|
||||
{
|
||||
TextPosition = 0;
|
||||
}
|
||||
@ -753,7 +753,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
||||
else if(Key.ScanCode == 0x06)
|
||||
{
|
||||
/* END key pressed, move cursor to the end */
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD)
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT)
|
||||
{
|
||||
TextPosition = InputFieldLength;
|
||||
}
|
||||
@ -761,7 +761,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
||||
else if(Key.ScanCode == 0x08)
|
||||
{
|
||||
/* DELETE key pressed, delete character */
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD)
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT)
|
||||
{
|
||||
if(InputFieldLength > 0 && TextPosition < InputFieldLength)
|
||||
{
|
||||
@ -774,7 +774,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
||||
else if(Key.UnicodeChar == 0x08)
|
||||
{
|
||||
/* BACKSPACE key pressed, delete character */
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD)
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT)
|
||||
{
|
||||
if(InputFieldLength > 0 && TextPosition > 0 && TextPosition <= InputFieldLength)
|
||||
{
|
||||
@ -792,7 +792,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
||||
else
|
||||
{
|
||||
/* Other key pressed, add character to the buffer */
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD && Key.UnicodeChar != 0)
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT && Key.UnicodeChar != 0)
|
||||
{
|
||||
if(InputFieldLength < Handle.Width - 8 - 1 && TextPosition < Handle.Width - 8 - 1)
|
||||
{
|
||||
@ -820,7 +820,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
||||
BlpDrawDialogButton(&Handle);
|
||||
BlpDrawDialogInputField(&Handle, &InputFieldBuffer[TextIndex]);
|
||||
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT_FIELD)
|
||||
if(Handle.Attributes & XTBL_TUI_DIALOG_ACTIVE_INPUT)
|
||||
{
|
||||
BlSetCursorPosition(Handle.PosX + 4 + TextCursorPosition, Handle.PosY + Handle.Height - 4);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user