]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Patch include:
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 16 Nov 2011 07:16:03 +0000 (07:16 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 16 Nov 2011 07:16:03 +0000 (07:16 +0000)
1. Browser not support suppress attribute for date/time opcode, not enable this attribute.
2. Show year field in %04d format, old format is %4d.
3. Add sample to use the suppress attribute.

Signed-off-by: ydong10
Reviewed-by: lgao4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12722 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
MdeModulePkg/Universal/SetupBrowserDxe/Ui.c

index f5e3193c29df0ba6c58a743a0eb515754c01b31f..03ae667e7c1b85a942bf343347ee9d8c5bc0968f 100644 (file)
@@ -616,7 +616,7 @@ formset
             varid   = MyIfrNVData.Time, \r
             prompt  = STRING_TOKEN(STR_TIME_PROMPT), \r
             help    = STRING_TOKEN(STR_TIME_PROMPT), \r
-            flags   = STORAGE_NORMAL\r
+            flags   = STORAGE_NORMAL | SECOND_SUPPRESS,\r
             default = 15:33:33, \r
       endtime;\r
       \r
index f97d91a2d6f1b5f794a93bc075ec71e2fd12755a..1ce139cbb0d25a0beef2c9a95d943f4f8137e40f 100644 (file)
@@ -699,7 +699,7 @@ ProcessOptions (
 \r
       case 2:\r
         SetUnicodeMem (OptionString[0], 7, L' ');\r
-        UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"%4d", QuestionValue->Value.date.Year);\r
+        UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"%04d", QuestionValue->Value.date.Year);\r
         *(OptionString[0] + 11) = RIGHT_NUMERIC_DELIMITER;\r
         break;\r
       }\r
index 93399c40286e0e4ccf1809e786c33129f320fbdb..0be50263dd150481d761b7b78954564719de6508 100644 (file)
@@ -324,6 +324,102 @@ UiFreeRefreshList (
 }\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
@@ -336,7 +432,6 @@ RefreshQuestion (
   )\r
 {\r
   CHAR16                          *OptionString;\r
-  UINTN                           Index;\r
   EFI_STATUS                      Status;\r
   UI_MENU_SELECTION               *Selection;\r
   FORM_BROWSER_STATEMENT          *Question;\r
@@ -353,12 +448,6 @@ RefreshQuestion (
   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
@@ -375,7 +464,8 @@ RefreshQuestion (
     }\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
@@ -1993,7 +2083,6 @@ UiDisplayMenu (
   UINTN                           BottomRow;\r
   UINTN                           OriginalRow;\r
   UINTN                           Index;\r
-  UINT32                          Count;\r
   UINT16                          Width;\r
   CHAR16                          *StringPtr;\r
   CHAR16                          *OptionString;\r
@@ -2235,19 +2324,7 @@ UiDisplayMenu (
 \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
@@ -2554,18 +2631,7 @@ UiDisplayMenu (
             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
@@ -2664,18 +2730,7 @@ UiDisplayMenu (
         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