]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Refine the select highlight menu logic.
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 5 Dec 2011 13:20:03 +0000 (13:20 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 5 Dec 2011 13:20:03 +0000 (13:20 +0000)
Signed-off-by: ydong10
Reviewed-by: lgao4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12818 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/SetupBrowserDxe/Ui.c

index ca2ec3b169f7ff97db9e6c9f31218bc9da49a27f..01909e46491897bb5318b3b9cd3bacae72092ea7 100644 (file)
@@ -2575,7 +2575,18 @@ UiDisplayMenu (
             SavedMenuOption = MENU_OPTION_FROM_LINK (Link);\r
           }\r
 \r
-          if (Link != NewPos || Index > BottomRow || (Link == NewPos && SavedMenuOption->Row + SavedMenuOption->Skip - 1 > BottomRow)) {\r
+          //\r
+          // Not find the selected menu in current show page.\r
+          // Have two case to enter this if:\r
+          // 1. Not find the menu at current page.\r
+          // 2. Find the menu in current page, but the menu shows at the bottom and not all info shows.\r
+          //    For case 2, has an exception: The menu can show more than one pages and now only this menu shows.\r
+          //\r
+          // Base on the selected menu will show at the bottom of the page,\r
+          // select the menu which will show at the top of the page.\r
+          //\r
+          if (Link != NewPos || Index > BottomRow || \r
+              (Link == NewPos && (SavedMenuOption->Row + SavedMenuOption->Skip - 1 > BottomRow) && (Link != TopOfScreen))) {\r
             //\r
             // Find the MenuOption which has the skip value for Date/Time opcode. \r
             //\r
@@ -2590,7 +2601,11 @@ UiDisplayMenu (
             if (SavedMenuOption->Row == 0) {\r
               UpdateOptionSkipLines (Selection, SavedMenuOption);\r
             }\r
-            \r
+\r
+            //\r
+            // Base on the selected menu will show at the bottome of next page, \r
+            // select the menu show at the top of the next page. \r
+            //\r
             Link    = NewPos;\r
             for (Index = TopRow + SavedMenuOption->Skip; Index <= BottomRow + 1; ) {            \r
               Link = Link->BackLink;\r
@@ -2598,16 +2613,31 @@ UiDisplayMenu (
               if (SavedMenuOption->Row == 0) {\r
                 UpdateOptionSkipLines (Selection, SavedMenuOption);\r
               }\r
-              Index     += SavedMenuOption->Skip;\r
+              Index += SavedMenuOption->Skip;\r
             }\r
-            \r
-            SkipValue = Index - BottomRow - 1;\r
-            if (SkipValue > 0 && SkipValue < (INTN) SavedMenuOption->Skip) {\r
-              TopOfScreen     = Link;\r
-              OldSkipValue    = SkipValue;\r
+\r
+            //\r
+            // Found the menu which will show at the top of the page.\r
+            //\r
+            if (Link == NewPos) {\r
+              //\r
+              // The menu can show more than one pages, just show the menu at the top of the page.\r
+              //\r
+              SkipValue    = 0;\r
+              TopOfScreen  = Link;\r
+              OldSkipValue = SkipValue;\r
             } else {\r
-              SkipValue       = 0;\r
-              TopOfScreen     = Link->ForwardLink;\r
+              //\r
+              // Check whether need to skip some line for menu shows at the top of the page.\r
+              //\r
+              SkipValue = Index - BottomRow - 1;\r
+              if (SkipValue > 0 && SkipValue < (INTN) SavedMenuOption->Skip) {\r
+                TopOfScreen     = Link;\r
+                OldSkipValue    = SkipValue;\r
+              } else {\r
+                SkipValue       = 0;\r
+                TopOfScreen     = Link->ForwardLink;\r
+              }\r
             }\r
 \r
             Repaint = TRUE;\r