summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
diff options
context:
space:
mode:
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2010-12-30 07:26:56 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2010-12-30 07:26:56 +0000
commite24adb18e330ff25dd35a278f0f8593378e14668 (patch)
tree20ee884730b592d91d9310c81fb364619f4e7a1e /MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
parenta06638eac2b71661d9d0d15d295cbba6da710b07 (diff)
downloadedk2-platforms-e24adb18e330ff25dd35a278f0f8593378e14668.tar.xz
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
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c123
1 files changed, 89 insertions, 34 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c b/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
index 2905006856..0d42beae50 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
@@ -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;
+
+ 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);
- Column++;
+ 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;