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