mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 15:44:04 +02:00
Enable number input for numeric, date and time opcode
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11208 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
a06638eac2
commit
e24adb18e3
@ -270,6 +270,12 @@ GetNumericInput (
|
|||||||
Minimum = Question->Minimum;
|
Minimum = Question->Minimum;
|
||||||
Maximum = Question->Maximum;
|
Maximum = Question->Maximum;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Only two case, user can enter to this function: Enter and +/- case.
|
||||||
|
// In Enter case, gDirection = 0; in +/- case, gDirection = SCAN_LEFT/SCAN_WRIGHT
|
||||||
|
//
|
||||||
|
ManualInput = (BOOLEAN)(gDirection == 0 ? TRUE : FALSE);
|
||||||
|
|
||||||
if ((Question->Operand == EFI_IFR_DATE_OP) || (Question->Operand == EFI_IFR_TIME_OP)) {
|
if ((Question->Operand == EFI_IFR_DATE_OP) || (Question->Operand == EFI_IFR_TIME_OP)) {
|
||||||
DateOrTime = TRUE;
|
DateOrTime = TRUE;
|
||||||
} else {
|
} else {
|
||||||
@ -344,12 +350,6 @@ GetNumericInput (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Step == 0) {
|
|
||||||
ManualInput = TRUE;
|
|
||||||
} else {
|
|
||||||
ManualInput = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((Question->Operand == EFI_IFR_NUMERIC_OP) &&
|
if ((Question->Operand == EFI_IFR_NUMERIC_OP) &&
|
||||||
((Question->Flags & EFI_IFR_DISPLAY) == EFI_IFR_DISPLAY_UINT_HEX)) {
|
((Question->Flags & EFI_IFR_DISPLAY) == EFI_IFR_DISPLAY_UINT_HEX)) {
|
||||||
HexInput = TRUE;
|
HexInput = TRUE;
|
||||||
@ -357,41 +357,96 @@ GetNumericInput (
|
|||||||
HexInput = FALSE;
|
HexInput = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enter from "Enter" input, clear the old word showing.
|
||||||
|
//
|
||||||
if (ManualInput) {
|
if (ManualInput) {
|
||||||
if (HexInput) {
|
if (Question->Operand == EFI_IFR_NUMERIC_OP) {
|
||||||
InputWidth = Question->StorageWidth * 2;
|
if (HexInput) {
|
||||||
} else {
|
InputWidth = Question->StorageWidth * 2;
|
||||||
switch (Question->StorageWidth) {
|
} else {
|
||||||
case 1:
|
switch (Question->StorageWidth) {
|
||||||
InputWidth = 3;
|
case 1:
|
||||||
break;
|
InputWidth = 3;
|
||||||
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
InputWidth = 5;
|
InputWidth = 5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
InputWidth = 10;
|
InputWidth = 10;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
InputWidth = 20;
|
InputWidth = 20;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
InputWidth = 0;
|
InputWidth = 0;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InputText[0] = LEFT_NUMERIC_DELIMITER;
|
||||||
|
SetUnicodeMem (InputText + 1, InputWidth, L' ');
|
||||||
|
ASSERT (InputWidth + 2 < MAX_NUMERIC_INPUT_WIDTH);
|
||||||
|
InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;
|
||||||
|
InputText[InputWidth + 2] = L'\0';
|
||||||
|
|
||||||
|
PrintAt (Column, Row, InputText);
|
||||||
|
Column++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Question->Operand == EFI_IFR_DATE_OP) {
|
||||||
|
if (MenuOption->Sequence == 2) {
|
||||||
|
InputWidth = 4;
|
||||||
|
} else {
|
||||||
|
InputWidth = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MenuOption->Sequence == 0) {
|
||||||
|
InputText[0] = LEFT_NUMERIC_DELIMITER;
|
||||||
|
SetUnicodeMem (InputText + 1, InputWidth, L' ');
|
||||||
|
} else {
|
||||||
|
SetUnicodeMem (InputText, InputWidth, L' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MenuOption->Sequence == 2) {
|
||||||
|
InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;
|
||||||
|
} else {
|
||||||
|
InputText[InputWidth + 1] = DATE_SEPARATOR;
|
||||||
|
}
|
||||||
|
InputText[InputWidth + 2] = L'\0';
|
||||||
|
|
||||||
|
PrintAt (Column, Row, InputText);
|
||||||
|
if (MenuOption->Sequence == 0) {
|
||||||
|
Column++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InputText[0] = LEFT_NUMERIC_DELIMITER;
|
if (Question->Operand == EFI_IFR_TIME_OP) {
|
||||||
SetUnicodeMem (InputText + 1, InputWidth, L' ');
|
InputWidth = 2;
|
||||||
ASSERT (InputWidth + 2 < MAX_NUMERIC_INPUT_WIDTH);
|
|
||||||
InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;
|
|
||||||
InputText[InputWidth + 2] = L'\0';
|
|
||||||
|
|
||||||
PrintAt (Column, Row, InputText);
|
if (MenuOption->Sequence == 0) {
|
||||||
Column++;
|
InputText[0] = LEFT_NUMERIC_DELIMITER;
|
||||||
|
SetUnicodeMem (InputText + 1, InputWidth, L' ');
|
||||||
|
} else {
|
||||||
|
SetUnicodeMem (InputText, InputWidth, L' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MenuOption->Sequence == 2) {
|
||||||
|
InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;
|
||||||
|
} else {
|
||||||
|
InputText[InputWidth + 1] = TIME_SEPARATOR;
|
||||||
|
}
|
||||||
|
InputText[InputWidth + 2] = L'\0';
|
||||||
|
|
||||||
|
PrintAt (Column, Row, InputText);
|
||||||
|
if (MenuOption->Sequence == 0) {
|
||||||
|
Column++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -425,7 +480,7 @@ TheKey2:
|
|||||||
switch (Key.ScanCode) {
|
switch (Key.ScanCode) {
|
||||||
case SCAN_LEFT:
|
case SCAN_LEFT:
|
||||||
case SCAN_RIGHT:
|
case SCAN_RIGHT:
|
||||||
if (DateOrTime) {
|
if (DateOrTime && !ManualInput) {
|
||||||
//
|
//
|
||||||
// By setting this value, we will return back to the caller.
|
// By setting this value, we will return back to the caller.
|
||||||
// We need to do this since an auto-refresh will destroy the adjustment
|
// We need to do this since an auto-refresh will destroy the adjustment
|
||||||
@ -435,7 +490,7 @@ TheKey2:
|
|||||||
gDirection = SCAN_DOWN;
|
gDirection = SCAN_DOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ManualInput) {
|
if ((Step != 0) && !ManualInput) {
|
||||||
if (Key.ScanCode == SCAN_LEFT) {
|
if (Key.ScanCode == SCAN_LEFT) {
|
||||||
if (EditValue > Step) {
|
if (EditValue > Step) {
|
||||||
EditValue = EditValue - Step;
|
EditValue = EditValue - Step;
|
||||||
|
@ -716,14 +716,14 @@ UpdateKeyHelp (
|
|||||||
ARROW_LEFT,
|
ARROW_LEFT,
|
||||||
gMoveHighlight
|
gMoveHighlight
|
||||||
);
|
);
|
||||||
PrintStringAt (SecCol, BottomRowOfHelp, gAdjustNumber);
|
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
|
||||||
|
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gAdjustNumber);
|
||||||
} else {
|
} else {
|
||||||
PrintAt (StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
|
PrintAt (StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
|
||||||
if (Statement->Operand == EFI_IFR_NUMERIC_OP && Statement->Step != 0) {
|
if (Statement->Operand == EFI_IFR_NUMERIC_OP && Statement->Step != 0) {
|
||||||
PrintStringAt (SecCol, BottomRowOfHelp, gAdjustNumber);
|
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gAdjustNumber);
|
||||||
} else {
|
|
||||||
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
|
|
||||||
}
|
}
|
||||||
|
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PrintStringAt (SecCol, BottomRowOfHelp, gEnterCommitString);
|
PrintStringAt (SecCol, BottomRowOfHelp, gEnterCommitString);
|
||||||
@ -731,7 +731,9 @@ UpdateKeyHelp (
|
|||||||
//
|
//
|
||||||
// If it is a selected numeric with manual input, display different message
|
// If it is a selected numeric with manual input, display different message
|
||||||
//
|
//
|
||||||
if ((Statement->Operand == EFI_IFR_NUMERIC_OP) && (Statement->Step == 0)) {
|
if ((Statement->Operand == EFI_IFR_NUMERIC_OP) ||
|
||||||
|
(Statement->Operand == EFI_IFR_DATE_OP) ||
|
||||||
|
(Statement->Operand == EFI_IFR_TIME_OP)) {
|
||||||
PrintStringAt (
|
PrintStringAt (
|
||||||
SecCol,
|
SecCol,
|
||||||
TopRowOfHelp,
|
TopRowOfHelp,
|
||||||
|
@ -2497,10 +2497,7 @@ UiDisplayMenu (
|
|||||||
|
|
||||||
ASSERT(MenuOption != NULL);
|
ASSERT(MenuOption != NULL);
|
||||||
Statement = MenuOption->ThisTag;
|
Statement = MenuOption->ThisTag;
|
||||||
if ((Statement->Operand == EFI_IFR_TEXT_OP) ||
|
if (Statement->Operand == EFI_IFR_TEXT_OP) {
|
||||||
(Statement->Operand == EFI_IFR_DATE_OP) ||
|
|
||||||
(Statement->Operand == EFI_IFR_TIME_OP) ||
|
|
||||||
(Statement->Operand == EFI_IFR_NUMERIC_OP && Statement->Step != 0)) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user