]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix the following three issues:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 25 Oct 2010 05:32:17 +0000 (05:32 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 25 Oct 2010 05:32:17 +0000 (05:32 +0000)
  1. When question is grayout, its value is not gray.
  2. When type Ui UP action, Repaint is not trigged when next MenuOption is above the TopOfScreen.
  3. When type Ui Down action, TopOfScreen is not calculated correctly when screen roll is required.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10977 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/SetupBrowserDxe/Ui.c

index 3310bb284e62263c751fd91811832261649a4111..3448df8d19e51a8960fa0906ef2e026b8e143a0f 100644 (file)
@@ -1833,7 +1833,6 @@ UiDisplayMenu (
           Temp  = 0;\r
           Row   = OriginalRow;\r
 \r
-          gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND);\r
           Status = ProcessOptions (Selection, MenuOption, FALSE, &OptionString);\r
           if (EFI_ERROR (Status)) {\r
             //\r
@@ -1981,6 +1980,7 @@ UiDisplayMenu (
             Row = OriginalRow;\r
             FreePool (StringPtr);\r
           }\r
+          gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND);\r
 \r
           //\r
           // Need to handle the bottom of the display\r
@@ -2813,6 +2813,7 @@ UiDisplayMenu (
           NewPos = NewPos->BackLink;\r
         }\r
 \r
+        Difference = MoveToNextStatement (TRUE, &NewPos);\r
         PreviousMenuOption = MENU_OPTION_FROM_LINK (NewPos);\r
         DistanceValue = PreviousMenuOption->Skip;\r
 \r
@@ -2824,31 +2825,6 @@ UiDisplayMenu (
         //\r
         DistanceValue += AdjustDateAndTimePosition (TRUE, &NewPos);\r
 \r
-        //\r
-        // Check the previous menu entry to see if it was a zero-length advance.  If it was,\r
-        // don't worry about a redraw.\r
-        //\r
-        ASSERT(MenuOption != NULL);\r
-        if ((INTN) MenuOption->Row - (INTN) DistanceValue < (INTN) TopRow) {\r
-          Repaint     = TRUE;\r
-          TopOfScreen = NewPos;\r
-        }\r
-\r
-        Difference = MoveToNextStatement (TRUE, &NewPos);\r
-        PreviousMenuOption = MENU_OPTION_FROM_LINK (NewPos);\r
-        DistanceValue += PreviousMenuOption->Skip;\r
-\r
-        if ((INTN) MenuOption->Row - (INTN) DistanceValue  < (INTN) TopRow) {\r
-          if (Difference > 0) {\r
-            //\r
-            // Previous focus MenuOption is above the TopOfScreen, so we need to scroll\r
-            //\r
-            TopOfScreen = NewPos;\r
-            Repaint     = TRUE;\r
-            SkipValue = 0;\r
-            OldSkipValue = 0;\r
-          }\r
-        }\r
         if (Difference < 0) {\r
           //\r
           // We want to goto previous MenuOption, but finally we go down.\r
@@ -2859,6 +2835,14 @@ UiDisplayMenu (
             TopOfScreen = gMenuOption.ForwardLink;\r
             Repaint     = TRUE;\r
           }\r
+        } else if ((INTN) MenuOption->Row - (INTN) DistanceValue - Difference < (INTN) TopRow) {\r
+          //\r
+          // Previous focus MenuOption is above the TopOfScreen, so we need to scroll\r
+          //\r
+          TopOfScreen = NewPos;\r
+          Repaint     = TRUE;\r
+          SkipValue = 0;\r
+          OldSkipValue = 0;\r
         }\r
 \r
         //\r
@@ -3002,14 +2986,15 @@ UiDisplayMenu (
         MenuOption      = MENU_OPTION_FROM_LINK (NewPos);\r
         NewLine         = TRUE;\r
         NewPos          = NewPos->ForwardLink;\r
-        NextMenuOption  = MENU_OPTION_FROM_LINK (NewPos);\r
 \r
-        DistanceValue  += NextMenuOption->Skip;\r
         DistanceValue  += MoveToNextStatement (FALSE, &NewPos);\r
+        NextMenuOption  = MENU_OPTION_FROM_LINK (NewPos);\r
+\r
         //\r
         // An option might be multi-line, so we need to reflect that data in the overall skip value\r
         //\r
         UpdateOptionSkipLines (Selection, NextMenuOption, &OptionString, (UINTN) SkipValue);\r
+        DistanceValue  += NextMenuOption->Skip;\r
 \r
         Temp = MenuOption->Row + MenuOption->Skip + DistanceValue - 1;\r
         if ((MenuOption->Row + MenuOption->Skip == BottomRow + 1) &&\r
@@ -3051,26 +3036,13 @@ UiDisplayMenu (
                 //\r
                 // If we have a remainder, skip that many more op-codes until we drain the remainder\r
                 //\r
-                for (;\r
-                     Difference >= (INTN) SavedMenuOption->Skip;\r
-                     Difference = Difference - (INTN) SavedMenuOption->Skip\r
-                    ) {\r
+                while (Difference >= (INTN) SavedMenuOption->Skip) {\r
                   //\r
                   // Since the Difference is greater than or equal to this op-code's skip value, skip it\r
                   //\r
+                  Difference      = Difference - (INTN) SavedMenuOption->Skip;\r
                   TopOfScreen     = TopOfScreen->ForwardLink;\r
                   SavedMenuOption = MENU_OPTION_FROM_LINK (TopOfScreen);\r
-                  if (Difference < (INTN) SavedMenuOption->Skip) {\r
-                    Difference = SavedMenuOption->Skip - Difference - 1;\r
-                    break;\r
-                  } else {\r
-                    if (Difference == (INTN) SavedMenuOption->Skip) {\r
-                      TopOfScreen     = TopOfScreen->ForwardLink;\r
-                      SavedMenuOption = MENU_OPTION_FROM_LINK (TopOfScreen);\r
-                      Difference      = SavedMenuOption->Skip - Difference;\r
-                      break;\r
-                    }\r
-                  }\r
                 }\r
                 //\r
                 // Since we will act on this op-code in the next routine, and increment the\r
@@ -3103,6 +3075,8 @@ UiDisplayMenu (
               } else {\r
                 SkipValue++;\r
               }\r
+            } else if (SavedMenuOption->Skip == 1) {\r
+              SkipValue   = 0;\r
             } else {\r
               SkipValue   = 0;\r
               TopOfScreen = TopOfScreen->ForwardLink;\r