mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +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;
|
||||
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)) {
|
||||
DateOrTime = TRUE;
|
||||
} else {
|
||||
@ -344,12 +350,6 @@ GetNumericInput (
|
||||
}
|
||||
}
|
||||
|
||||
if (Step == 0) {
|
||||
ManualInput = TRUE;
|
||||
} else {
|
||||
ManualInput = FALSE;
|
||||
}
|
||||
|
||||
if ((Question->Operand == EFI_IFR_NUMERIC_OP) &&
|
||||
((Question->Flags & EFI_IFR_DISPLAY) == EFI_IFR_DISPLAY_UINT_HEX)) {
|
||||
HexInput = TRUE;
|
||||
@ -357,41 +357,96 @@ GetNumericInput (
|
||||
HexInput = FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// Enter from "Enter" input, clear the old word showing.
|
||||
//
|
||||
if (ManualInput) {
|
||||
if (HexInput) {
|
||||
InputWidth = Question->StorageWidth * 2;
|
||||
} else {
|
||||
switch (Question->StorageWidth) {
|
||||
case 1:
|
||||
InputWidth = 3;
|
||||
break;
|
||||
if (Question->Operand == EFI_IFR_NUMERIC_OP) {
|
||||
if (HexInput) {
|
||||
InputWidth = Question->StorageWidth * 2;
|
||||
} else {
|
||||
switch (Question->StorageWidth) {
|
||||
case 1:
|
||||
InputWidth = 3;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
InputWidth = 5;
|
||||
break;
|
||||
case 2:
|
||||
InputWidth = 5;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
InputWidth = 10;
|
||||
break;
|
||||
case 4:
|
||||
InputWidth = 10;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
InputWidth = 20;
|
||||
break;
|
||||
case 8:
|
||||
InputWidth = 20;
|
||||
break;
|
||||
|
||||
default:
|
||||
InputWidth = 0;
|
||||
break;
|
||||
default:
|
||||
InputWidth = 0;
|
||||
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;
|
||||
SetUnicodeMem (InputText + 1, InputWidth, L' ');
|
||||
ASSERT (InputWidth + 2 < MAX_NUMERIC_INPUT_WIDTH);
|
||||
InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;
|
||||
InputText[InputWidth + 2] = L'\0';
|
||||
if (Question->Operand == EFI_IFR_TIME_OP) {
|
||||
InputWidth = 2;
|
||||
|
||||
PrintAt (Column, Row, InputText);
|
||||
Column++;
|
||||
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] = TIME_SEPARATOR;
|
||||
}
|
||||
InputText[InputWidth + 2] = L'\0';
|
||||
|
||||
PrintAt (Column, Row, InputText);
|
||||
if (MenuOption->Sequence == 0) {
|
||||
Column++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@ -425,7 +480,7 @@ TheKey2:
|
||||
switch (Key.ScanCode) {
|
||||
case SCAN_LEFT:
|
||||
case SCAN_RIGHT:
|
||||
if (DateOrTime) {
|
||||
if (DateOrTime && !ManualInput) {
|
||||
//
|
||||
// By setting this value, we will return back to the caller.
|
||||
// We need to do this since an auto-refresh will destroy the adjustment
|
||||
@ -435,7 +490,7 @@ TheKey2:
|
||||
gDirection = SCAN_DOWN;
|
||||
}
|
||||
|
||||
if (!ManualInput) {
|
||||
if ((Step != 0) && !ManualInput) {
|
||||
if (Key.ScanCode == SCAN_LEFT) {
|
||||
if (EditValue > Step) {
|
||||
EditValue = EditValue - Step;
|
||||
|
@ -716,14 +716,14 @@ UpdateKeyHelp (
|
||||
ARROW_LEFT,
|
||||
gMoveHighlight
|
||||
);
|
||||
PrintStringAt (SecCol, BottomRowOfHelp, gAdjustNumber);
|
||||
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
|
||||
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gAdjustNumber);
|
||||
} else {
|
||||
PrintAt (StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
|
||||
if (Statement->Operand == EFI_IFR_NUMERIC_OP && Statement->Step != 0) {
|
||||
PrintStringAt (SecCol, BottomRowOfHelp, gAdjustNumber);
|
||||
} else {
|
||||
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
|
||||
}
|
||||
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gAdjustNumber);
|
||||
}
|
||||
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
|
||||
}
|
||||
} else {
|
||||
PrintStringAt (SecCol, BottomRowOfHelp, gEnterCommitString);
|
||||
@ -731,7 +731,9 @@ UpdateKeyHelp (
|
||||
//
|
||||
// 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 (
|
||||
SecCol,
|
||||
TopRowOfHelp,
|
||||
|
@ -2497,10 +2497,7 @@ UiDisplayMenu (
|
||||
|
||||
ASSERT(MenuOption != NULL);
|
||||
Statement = MenuOption->ThisTag;
|
||||
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)) {
|
||||
if (Statement->Operand == EFI_IFR_TEXT_OP) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user