]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
Adjust date/time opcode before use it.
[mirror_edk2.git] / MdeModulePkg / Universal / DisplayEngineDxe / FormDisplay.c
index e2c6b292255aebadad5918feda84fe7d57863839..203b6b5138344ddeda6e0f704bd9709c3c5eb528 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Entry and initialization module for the browser.\r
 \r
-Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -699,6 +699,13 @@ ConvertStatementToMenu (
       NestStatement = FORM_DISPLAY_ENGINE_STATEMENT_FROM_LINK (NestLink);\r
       NestLink = GetNextNode (&Statement->NestStatementList, NestLink);\r
 \r
+      //\r
+      // Skip the opcode not recognized by Display core.\r
+      //\r
+      if (NestStatement->OpCode->OpCode == EFI_IFR_GUID_OP) {\r
+        continue;\r
+      }\r
+\r
       UiAddMenuOption (NestStatement, &MenuItemCount, TRUE);\r
     }\r
   }\r
@@ -1531,6 +1538,7 @@ FindTopMenu (
   } else {\r
     *TopOfScreen = FindTopOfScreenMenu(NewPos, BottomRow - TopRow - SavedMenuOption->Skip, &TmpValue);\r
   }\r
+  AdjustDateAndTimePosition(TRUE, TopOfScreen);\r
 \r
   *SkipValue   = TmpValue;\r
 }\r
@@ -1713,6 +1721,7 @@ HasOptionString (
   @param  SkipLine                 The skip line for this menu. \r
   @param  BottomRow                The bottom row for this form.\r
   @param  Highlight                Whether this menu will be highlight.\r
+  @param  UpdateCol                Whether need to update the column info for Date/Time.\r
 \r
   @retval EFI_SUCESSS              Process the user selection success.\r
 \r
@@ -1724,7 +1733,8 @@ DisplayOneMenu (
   IN UINTN                           BeginCol,\r
   IN UINTN                           SkipLine,\r
   IN UINTN                           BottomRow,\r
-  IN BOOLEAN                         Highlight\r
+  IN BOOLEAN                         Highlight,\r
+  IN BOOLEAN                         UpdateCol\r
   )\r
 {\r
   FORM_DISPLAY_ENGINE_STATEMENT   *Statement;\r
@@ -1773,7 +1783,7 @@ DisplayOneMenu (
       //\r
       // Adjust option string for date/time opcode.\r
       //\r
-      ProcessStringForDateTime(MenuOption, OptionString, TRUE);\r
+      ProcessStringForDateTime(MenuOption, OptionString, UpdateCol);\r
     }\r
   \r
     Width       = (UINT16) gOptionBlockWidth - 1;\r
@@ -1798,8 +1808,9 @@ DisplayOneMenu (
           } else {\r
             //\r
             // For date/ time, print the first and second past (year for date and second for time)\r
-            //                \r
-            DisplayMenuString (MenuOption, MenuOption->OptCol, Row, OutputString, StrLen (OutputString), Highlight);\r
+            // The OutputString has a NARROW_CHAR or WIDE_CHAR at the begin of the string, \r
+            // so need to - 1 to remove it, otherwise, it will clean 1 extr char follow it.\r
+            DisplayMenuString (MenuOption, MenuOption->OptCol, Row, OutputString, StrLen (OutputString) - 1, Highlight);\r
           }\r
         } else {\r
           DisplayMenuString (MenuOption, MenuOption->OptCol, Row, OutputString, Width + 1, Highlight);\r
@@ -2160,7 +2171,8 @@ UiDisplayMenu (
                             gStatementDimensions.LeftColumn + gModalSkipColumn, \r
                             Link == TopOfScreen ? SkipValue : 0, \r
                             BottomRow,\r
-                            (BOOLEAN) ((Link == NewPos) && IsSelectable(MenuOption))\r
+                            (BOOLEAN) ((Link == NewPos) && IsSelectable(MenuOption)),\r
+                            TRUE\r
                             );\r
           } else {\r
             Status = DisplayOneMenu (MenuOption, \r
@@ -2168,8 +2180,9 @@ UiDisplayMenu (
                             gStatementDimensions.LeftColumn, \r
                             Link == TopOfScreen ? SkipValue : 0, \r
                             BottomRow,\r
-                            (BOOLEAN) ((Link == NewPos) && IsSelectable(MenuOption))\r
-                            );         \r
+                            (BOOLEAN) ((Link == NewPos) && IsSelectable(MenuOption)),\r
+                            TRUE\r
+                            );\r
           }\r
 \r
           if (EFI_ERROR (Status)) {\r
@@ -2272,6 +2285,7 @@ UiDisplayMenu (
                           gStatementDimensions.LeftColumn, \r
                           Temp, \r
                           BottomRow,\r
+                          FALSE,\r
                           FALSE\r
                           );\r
         }\r
@@ -2293,7 +2307,8 @@ UiDisplayMenu (
                         gStatementDimensions.LeftColumn, \r
                         Temp2, \r
                         BottomRow,\r
-                        TRUE\r
+                        TRUE,\r
+                        FALSE\r
                         );\r
       }\r
       break;\r
@@ -2548,12 +2563,12 @@ UiDisplayMenu (
         // If the screen has no menu items, and the user didn't select UiReset\r
         // ignore the selection and go back to reading keys.\r
         //\r
+        ASSERT(MenuOption != NULL);\r
         if(IsListEmpty (&gMenuOption) || MenuOption->GrayOut || MenuOption->ReadOnly) {\r
           ControlFlag = CfReadKey;\r
           break;\r
         }\r
 \r
-        ASSERT(MenuOption != NULL);\r
         Statement = MenuOption->ThisTag;\r
         if ((Statement->OpCode->OpCode == EFI_IFR_DATE_OP)\r
           || (Statement->OpCode->OpCode == EFI_IFR_TIME_OP)\r
@@ -2736,7 +2751,8 @@ UiDisplayMenu (
 \r
     case CfUiHotKey:\r
       ControlFlag = CfRepaint;\r
-      \r
+\r
+      ASSERT (HotKey != NULL);\r
       gUserInput->Action = HotKey->Action;\r
       ControlFlag = CfExit;\r
       break;\r
@@ -2774,16 +2790,16 @@ UiDisplayMenu (
       NewLine     = TRUE;\r
 \r
       SavedListEntry = NewPos;\r
-\r
       ASSERT(NewPos != NULL);\r
+\r
+      MenuOption = MENU_OPTION_FROM_LINK (NewPos);\r
+      ASSERT (MenuOption != NULL);\r
+\r
       //\r
       // Adjust Date/Time position before we advance forward.\r
       //\r
       AdjustDateAndTimePosition (TRUE, &NewPos);\r
 \r
-      MenuOption = MENU_OPTION_FROM_LINK (NewPos);\r
-      ASSERT (MenuOption != NULL);\r
-\r
       NewPos     = NewPos->BackLink;\r
       //\r
       // Find next selectable menu or the first menu beyond current form.\r
@@ -2855,7 +2871,7 @@ UiDisplayMenu (
       //\r
       // First minus the menu of the top screen, it's value is SkipValue.\r
       //\r
-      if (SkipValue >= (INTN) (BottomRow - TopRow + 1)) {\r
+      if (SkipValue >= BottomRow - TopRow + 1) {\r
         //\r
         // SkipValue > (BottomRow - TopRow + 1) means current menu has more than one\r
         // form of options to be show, so just update the SkipValue to show the next\r