]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Keep highlight on the current highlight menu if form auto exit, not exit by user...
authorEric Dong <eric.dong@intel.com>
Wed, 12 Feb 2014 06:31:10 +0000 (06:31 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 12 Feb 2014 06:31:10 +0000 (06:31 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15234 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h

index 203b6b5138344ddeda6e0f704bd9709c3c5eb528..fe3d875cd994041776dd40ae970b059b017f6a91 100644 (file)
@@ -1478,6 +1478,7 @@ FindTopMenu (
   UI_MENU_OPTION                  *SavedMenuOption;\r
   UINTN                           TmpValue;\r
 \r
   UI_MENU_OPTION                  *SavedMenuOption;\r
   UINTN                           TmpValue;\r
 \r
+  TmpValue  = 0;\r
   TopRow    = gStatementDimensions.TopRow    + SCROLL_ARROW_HEIGHT;\r
   BottomRow = gStatementDimensions.BottomRow - SCROLL_ARROW_HEIGHT;\r
 \r
   TopRow    = gStatementDimensions.TopRow    + SCROLL_ARROW_HEIGHT;\r
   BottomRow = gStatementDimensions.BottomRow - SCROLL_ARROW_HEIGHT;\r
 \r
@@ -1521,19 +1522,37 @@ FindTopMenu (
   UpdateOptionSkipLines (SavedMenuOption);\r
 \r
   //\r
   UpdateOptionSkipLines (SavedMenuOption);\r
 \r
   //\r
-  // If highlight opcode is date/time, keep the highlight row info not change.\r
+  // FormRefreshEvent != NULL means this form will auto exit at an interval, display engine \r
+  // will try to keep highlight on the current position after this form exit and re-enter.\r
   //\r
   //\r
-  if ((SavedMenuOption->ThisTag->OpCode->OpCode == EFI_IFR_DATE_OP || SavedMenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TIME_OP) &&\r
-      (gHighligthMenuInfo.QuestionId != 0) && \r
-      (gHighligthMenuInfo.QuestionId == GetQuestionIdInfo(SavedMenuOption->ThisTag->OpCode))) {\r
-    //\r
-    // Still show the highlight menu before exit from display engine.\r
-    //\r
-    BottomRow = gHighligthMenuInfo.DisplayRow + SavedMenuOption->Skip;\r
+  // HiiHandle + QuestionId can find the only one question in the system.\r
+  //\r
+  // If this question has question id, save the question id info to find the question.\r
+  // else save the opcode buffer to find it.\r
+  //\r
+  if (gFormData->FormRefreshEvent != NULL && gFormData->HiiHandle == gHighligthMenuInfo.HiiHandle) {\r
+    if (gHighligthMenuInfo.QuestionId != 0) { \r
+      if (gHighligthMenuInfo.QuestionId == GetQuestionIdInfo(SavedMenuOption->ThisTag->OpCode)) {\r
+        BottomRow = gHighligthMenuInfo.DisplayRow + SavedMenuOption->Skip;\r
+        //\r
+        // SkipValue only used for menu at the top of the form.\r
+        // If Highlight menu is not at the top, this value will be update later.\r
+        //\r
+        TmpValue = gHighligthMenuInfo.SkipValue;\r
+      }\r
+    } else if (gHighligthMenuInfo.OpCode != NULL){\r
+      if (!CompareMem (gHighligthMenuInfo.OpCode, SavedMenuOption->ThisTag->OpCode, gHighligthMenuInfo.OpCode->Length)) {\r
+        BottomRow = gHighligthMenuInfo.DisplayRow + SavedMenuOption->Skip;\r
+        //\r
+        // SkipValue only used for menu at the top of the form.\r
+        // If Highlight menu is not at the top, this value will be update later.\r
+        //\r
+        TmpValue = gHighligthMenuInfo.SkipValue;\r
+      }\r
+    }\r
   }\r
 \r
   if (SavedMenuOption->Skip >= BottomRow - TopRow) {\r
   }\r
 \r
   if (SavedMenuOption->Skip >= BottomRow - TopRow) {\r
-    TmpValue = 0;\r
     *TopOfScreen = NewPos;\r
   } else {\r
     *TopOfScreen = FindTopOfScreenMenu(NewPos, BottomRow - TopRow - SavedMenuOption->Skip, &TmpValue);\r
     *TopOfScreen = NewPos;\r
   } else {\r
     *TopOfScreen = FindTopOfScreenMenu(NewPos, BottomRow - TopRow - SavedMenuOption->Skip, &TmpValue);\r
@@ -1547,11 +1566,14 @@ FindTopMenu (
   Update highlight menu info.\r
 \r
   @param  MenuOption               The menu opton which is highlight.\r
   Update highlight menu info.\r
 \r
   @param  MenuOption               The menu opton which is highlight.\r
+  @param  SkipValue                The skipvalue info for this menu.\r
+                                   SkipValue only used for the menu at the top of the form.\r
 \r
 **/\r
 VOID\r
 UpdateHighlightMenuInfo (\r
 \r
 **/\r
 VOID\r
 UpdateHighlightMenuInfo (\r
-  IN UI_MENU_OPTION            *MenuOption\r
+  IN UI_MENU_OPTION            *MenuOption,\r
+  IN UINTN                     SkipValue\r
   )\r
 {\r
   FORM_DISPLAY_ENGINE_STATEMENT   *Statement;\r
   )\r
 {\r
   FORM_DISPLAY_ENGINE_STATEMENT   *Statement;\r
@@ -1568,14 +1590,39 @@ UpdateHighlightMenuInfo (
   gSequence = (UINT16) MenuOption->Sequence;\r
 \r
   //\r
   gSequence = (UINT16) MenuOption->Sequence;\r
 \r
   //\r
-  // Record highlight row info for date/time opcode.\r
+  // FormRefreshEvent != NULL means this form will auto exit at an interval, display engine \r
+  // will try to keep highlight on the current position after this form exit and re-enter.\r
   //\r
   //\r
-  if (Statement->OpCode->OpCode == EFI_IFR_DATE_OP || Statement->OpCode->OpCode == EFI_IFR_TIME_OP) {\r
+  // HiiHandle + QuestionId can find the only one question in the system.\r
+  //\r
+  // If this question has question id, base on the question id info to find the question.\r
+  // else base on the opcode buffer to find it.\r
+  //\r
+  if (gFormData->FormRefreshEvent != NULL) {\r
+    gHighligthMenuInfo.HiiHandle  = gFormData->HiiHandle;\r
     gHighligthMenuInfo.QuestionId = GetQuestionIdInfo(Statement->OpCode);\r
     gHighligthMenuInfo.QuestionId = GetQuestionIdInfo(Statement->OpCode);\r
+\r
+    //\r
+    // if question id == 0, save the opcode buffer for later use.\r
+    //\r
+    if (gHighligthMenuInfo.QuestionId == 0) {\r
+      if (gHighligthMenuInfo.OpCode != NULL) {\r
+        FreePool (gHighligthMenuInfo.OpCode);\r
+      }\r
+      gHighligthMenuInfo.OpCode = AllocateCopyPool (Statement->OpCode->Length, Statement->OpCode);\r
+      ASSERT (gHighligthMenuInfo.OpCode != NULL);\r
+    }\r
     gHighligthMenuInfo.DisplayRow = (UINT16) MenuOption->Row;\r
     gHighligthMenuInfo.DisplayRow = (UINT16) MenuOption->Row;\r
+    gHighligthMenuInfo.SkipValue  = (UINT16) SkipValue;\r
   } else {\r
   } else {\r
+    gHighligthMenuInfo.HiiHandle  = NULL;\r
     gHighligthMenuInfo.QuestionId = 0;\r
     gHighligthMenuInfo.QuestionId = 0;\r
+    if (gHighligthMenuInfo.OpCode != NULL) {\r
+      FreePool (gHighligthMenuInfo.OpCode);\r
+      gHighligthMenuInfo.OpCode = NULL;\r
+    }\r
     gHighligthMenuInfo.DisplayRow = 0;\r
     gHighligthMenuInfo.DisplayRow = 0;\r
+    gHighligthMenuInfo.SkipValue  = 0;\r
   }\r
 \r
   RefreshKeyHelp(gFormData, Statement, FALSE);\r
   }\r
 \r
   RefreshKeyHelp(gFormData, Statement, FALSE);\r
@@ -2252,7 +2299,7 @@ UiDisplayMenu (
       if (SkipHighLight) {\r
         MenuOption    = SavedMenuOption;\r
         SkipHighLight = FALSE;\r
       if (SkipHighLight) {\r
         MenuOption    = SavedMenuOption;\r
         SkipHighLight = FALSE;\r
-        UpdateHighlightMenuInfo (MenuOption);\r
+        UpdateHighlightMenuInfo (MenuOption, TopOfScreen == &MenuOption->Link ? SkipValue : 0);\r
         break;\r
       }\r
 \r
         break;\r
       }\r
 \r
@@ -2296,7 +2343,7 @@ UiDisplayMenu (
         MenuOption = MENU_OPTION_FROM_LINK (NewPos);\r
         Statement = MenuOption->ThisTag;\r
 \r
         MenuOption = MENU_OPTION_FROM_LINK (NewPos);\r
         Statement = MenuOption->ThisTag;\r
 \r
-        UpdateHighlightMenuInfo (MenuOption);\r
+        UpdateHighlightMenuInfo (MenuOption, Temp2);\r
 \r
         if (!IsSelectable (MenuOption)) {\r
           break;\r
 \r
         if (!IsSelectable (MenuOption)) {\r
           break;\r
@@ -3393,5 +3440,9 @@ UnloadDisplayEngine (
 \r
   FreeDisplayStrings ();\r
 \r
 \r
   FreeDisplayStrings ();\r
 \r
+  if (gHighligthMenuInfo.OpCode != NULL) {\r
+    FreePool (gHighligthMenuInfo.OpCode);\r
+  }\r
+\r
   return EFI_SUCCESS;\r
 }\r
   return EFI_SUCCESS;\r
 }\r
index 45bcadc7e654dc6f268c7bce86e0d50db0180456..a0638caf5ac060d16ddad3809531e78217ecf065 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   FormDiplay protocol to show Form\r
 \r
 /** @file\r
   FormDiplay protocol to show Form\r
 \r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
@@ -194,8 +194,11 @@ typedef struct {
 } SCREEN_OPERATION_T0_CONTROL_FLAG;\r
 \r
 typedef struct {\r
 } SCREEN_OPERATION_T0_CONTROL_FLAG;\r
 \r
 typedef struct {\r
+  EFI_HII_HANDLE     HiiHandle;\r
   EFI_QUESTION_ID    QuestionId;\r
   EFI_QUESTION_ID    QuestionId;\r
+  EFI_IFR_OP_HEADER  *OpCode;\r
   UINT16             DisplayRow;\r
   UINT16             DisplayRow;\r
+  UINT16             SkipValue;\r
 } DISPLAY_HIGHLIGHT_MENU_INFO;\r
 \r
 #define UI_MENU_OPTION_SIGNATURE  SIGNATURE_32 ('u', 'i', 'm', 'm')\r
 } DISPLAY_HIGHLIGHT_MENU_INFO;\r
 \r
 #define UI_MENU_OPTION_SIGNATURE  SIGNATURE_32 ('u', 'i', 'm', 'm')\r