}\r
\r
\r
+/**\r
+ Process option string for date/time opcode.\r
+\r
+ @param MenuOption Menu option point to date/time.\r
+ @param OptionString Option string input for process.\r
+ @param AddOptCol Whether need to update MenuOption->OptCol. \r
+\r
+**/\r
+VOID \r
+ProcessStringForDateTime (\r
+ UI_MENU_OPTION *MenuOption,\r
+ CHAR16 *OptionString,\r
+ BOOLEAN AddOptCol\r
+ )\r
+{\r
+ UINTN Index;\r
+ UINTN Count;\r
+ FORM_BROWSER_STATEMENT *Statement;\r
+\r
+ ASSERT (MenuOption != NULL && OptionString != NULL);\r
+ \r
+ Statement = MenuOption->ThisTag;\r
+ \r
+ //\r
+ // If leading spaces on OptionString - remove the spaces\r
+ //\r
+ for (Index = 0; OptionString[Index] == L' '; Index++) {\r
+ //\r
+ // Base on the blockspace to get the option column info.\r
+ //\r
+ if (AddOptCol) {\r
+ MenuOption->OptCol++;\r
+ }\r
+ }\r
+ \r
+ for (Count = 0; OptionString[Index] != CHAR_NULL; Index++) {\r
+ OptionString[Count] = OptionString[Index];\r
+ Count++;\r
+ }\r
+ OptionString[Count] = CHAR_NULL;\r
+ \r
+ //\r
+ // Enable to suppress field in the opcode base on the flag.\r
+ //\r
+ if (Statement->Operand == EFI_IFR_DATE_OP) {\r
+ //\r
+ // OptionString format is: <**: **: ****>\r
+ // |month|day|year|\r
+ // 4 3 5\r
+ //\r
+ if ((Statement->Flags & EFI_QF_DATE_MONTH_SUPPRESS) && (MenuOption->Sequence == 0)) {\r
+ //\r
+ // At this point, only "<**:" in the optionstring. \r
+ // Clean the day's ** field, after clean, the format is "< :"\r
+ //\r
+ SetUnicodeMem (&OptionString[1], 2, L' ');\r
+ } else if ((Statement->Flags & EFI_QF_DATE_DAY_SUPPRESS) && (MenuOption->Sequence == 1)) {\r
+ //\r
+ // At this point, only "**:" in the optionstring. \r
+ // Clean the month's "**" field, after clean, the format is " :"\r
+ // \r
+ SetUnicodeMem (&OptionString[0], 2, L' ');\r
+ } else if ((Statement->Flags & EFI_QF_DATE_YEAR_SUPPRESS) && (MenuOption->Sequence == 2)) {\r
+ //\r
+ // At this point, only "****>" in the optionstring. \r
+ // Clean the year's "****" field, after clean, the format is " >"\r
+ // \r
+ SetUnicodeMem (&OptionString[0], 4, L' ');\r
+ }\r
+ } else if (Statement->Operand == EFI_IFR_TIME_OP) {\r
+ //\r
+ // OptionString format is: <**: **: **>\r
+ // |hour|minute|second|\r
+ // 4 3 3\r
+ //\r
+ if ((Statement->Flags & QF_TIME_HOUR_SUPPRESS) && (MenuOption->Sequence == 0)) {\r
+ //\r
+ // At this point, only "<**:" in the optionstring. \r
+ // Clean the hour's ** field, after clean, the format is "< :"\r
+ //\r
+ SetUnicodeMem (&OptionString[1], 2, L' ');\r
+ } else if ((Statement->Flags & QF_TIME_MINUTE_SUPPRESS) && (MenuOption->Sequence == 1)) {\r
+ //\r
+ // At this point, only "**:" in the optionstring. \r
+ // Clean the minute's "**" field, after clean, the format is " :"\r
+ // \r
+ SetUnicodeMem (&OptionString[0], 2, L' ');\r
+ } else if ((Statement->Flags & QF_TIME_SECOND_SUPPRESS) && (MenuOption->Sequence == 2)) {\r
+ //\r
+ // At this point, only "**>" in the optionstring. \r
+ // Clean the second's "**" field, after clean, the format is " >"\r
+ // \r
+ SetUnicodeMem (&OptionString[0], 2, L' ');\r
+ }\r
+ }\r
+}\r
\r
/**\r
Refresh question.\r
)\r
{\r
CHAR16 *OptionString;\r
- UINTN Index;\r
EFI_STATUS Status;\r
UI_MENU_SELECTION *Selection;\r
FORM_BROWSER_STATEMENT *Question;\r
ProcessOptions (Selection, MenuRefreshEntry->MenuOption, FALSE, &OptionString);\r
\r
if (OptionString != NULL) {\r
- //\r
- // If leading spaces on OptionString - remove the spaces\r
- //\r
- for (Index = 0; OptionString[Index] == L' '; Index++)\r
- ;\r
-\r
//\r
// If old Text is longer than new string, need to clean the old string before paint the newer.\r
// This option is no need for time/date opcode, because time/data opcode has fixed string length.\r
}\r
\r
gST->ConOut->SetAttribute (gST->ConOut, MenuRefreshEntry->CurrentAttribute);\r
- PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, &OptionString[Index]);\r
+ ProcessStringForDateTime(MenuRefreshEntry->MenuOption, OptionString, FALSE);\r
+ PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, OptionString);\r
FreePool (OptionString);\r
}\r
\r
UINTN BottomRow;\r
UINTN OriginalRow;\r
UINTN Index;\r
- UINT32 Count;\r
UINT16 Width;\r
CHAR16 *StringPtr;\r
CHAR16 *OptionString;\r
\r
if (OptionString != NULL) {\r
if (Statement->Operand == EFI_IFR_DATE_OP || Statement->Operand == EFI_IFR_TIME_OP) {\r
- //\r
- // If leading spaces on OptionString - remove the spaces\r
- //\r
- for (Index = 0; OptionString[Index] == L' '; Index++) {\r
- MenuOption->OptCol++;\r
- }\r
-\r
- for (Count = 0; OptionString[Index] != CHAR_NULL; Index++) {\r
- OptionString[Count] = OptionString[Index];\r
- Count++;\r
- }\r
-\r
- OptionString[Count] = CHAR_NULL;\r
+ ProcessStringForDateTime(MenuOption, OptionString, TRUE);\r
}\r
\r
Width = (UINT16) gOptionBlockWidth;\r
if ((MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) ||\r
(MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)\r
) {\r
- //\r
- // If leading spaces on OptionString - remove the spaces\r
- //\r
- for (Index = 0; OptionString[Index] == L' '; Index++)\r
- ;\r
-\r
- for (Count = 0; OptionString[Index] != CHAR_NULL; Index++) {\r
- OptionString[Count] = OptionString[Index];\r
- Count++;\r
- }\r
-\r
- OptionString[Count] = CHAR_NULL;\r
+ ProcessStringForDateTime(MenuOption, OptionString, FALSE);\r
}\r
\r
Width = (UINT16) gOptionBlockWidth;\r
ProcessOptions (Selection, MenuOption, FALSE, &OptionString);\r
if (OptionString != NULL) {\r
if (Statement->Operand == EFI_IFR_DATE_OP || Statement->Operand == EFI_IFR_TIME_OP) {\r
- //\r
- // If leading spaces on OptionString - remove the spaces\r
- //\r
- for (Index = 0; OptionString[Index] == L' '; Index++)\r
- ;\r
-\r
- for (Count = 0; OptionString[Index] != CHAR_NULL; Index++) {\r
- OptionString[Count] = OptionString[Index];\r
- Count++;\r
- }\r
-\r
- OptionString[Count] = CHAR_NULL;\r
+ ProcessStringForDateTime(MenuOption, OptionString, FALSE);\r
}\r
Width = (UINT16) gOptionBlockWidth;\r
\r