]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Enable Help string scroll when the help info can't show all at current page.
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 11 Apr 2012 05:44:40 +0000 (05:44 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 11 Apr 2012 05:44:40 +0000 (05:44 +0000)
Signed-off-by: Dong Eric <eric.dong@intel.com>
Reviewed-by: Gao Liming <liming.gao@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13184 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni
MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
MdeModulePkg/Universal/SetupBrowserDxe/Ui.h

index c388247a88ff3b044f884c8c83ea1b7649b03b6f..c91ba48d2172da8c5304b3214146167b9bcf4940 100644 (file)
@@ -981,7 +981,7 @@ ProcessOptions (
   @param  RowCount               TRUE: if Question is selected.\r
 \r
 **/\r
-VOID\r
+UINTN\r
 ProcessHelpString (\r
   IN  CHAR16  *StringPtr,\r
   OUT CHAR16  **FormattedString,\r
@@ -1182,4 +1182,6 @@ ProcessHelpString (
   }\r
 \r
   FreePool (IndexArray);\r
+\r
+  return LineCount;\r
 }\r
index fdecbe85a16b7e20981c79250f6322fb40c4b13e..b155a5577ca691dd6deb28e8f3336f29ad594601 100644 (file)
Binary files a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni and b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni differ
index 1c3a7f6ba441f54879fd2864b3208231b8b3091e..82a82e5115f159829bbe8fdd385fc16fab56ece7 100644 (file)
@@ -2090,7 +2090,9 @@ UiDisplayMenu (
   CHAR16                          *StringPtr;\r
   CHAR16                          *OptionString;\r
   CHAR16                          *OutputString;\r
-  CHAR16                          *FormattedString;\r
+  CHAR16                          *HelpString;\r
+  CHAR16                          *HelpHeaderString;\r
+  CHAR16                          *HelpBottomString;\r
   BOOLEAN                         NewLine;\r
   BOOLEAN                         Repaint;\r
   BOOLEAN                         SavedValue;\r
@@ -2118,16 +2120,32 @@ UiDisplayMenu (
   UI_MENU_LIST                    *CurrentMenu;\r
   UINTN                           ModalSkipColumn;\r
   BROWSER_HOT_KEY                 *HotKey;\r
+  UINTN                           HelpPageIndex;\r
+  UINTN                           HelpPageCount;\r
+  UINTN                           RowCount;\r
+  UINTN                           HelpLine;\r
+  UINTN                           HelpHeaderLine;\r
+  UINTN                           HelpBottomLine;\r
+  BOOLEAN                         MultiHelpPage;\r
 \r
   CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));\r
 \r
   Status              = EFI_SUCCESS;\r
-  FormattedString     = NULL;\r
+  HelpString          = NULL;\r
+  HelpHeaderString    = NULL;\r
+  HelpBottomString    = NULL;\r
   OptionString        = NULL;\r
   ScreenOperation     = UiNoOperation;\r
   NewLine             = TRUE;\r
   MinRefreshInterval  = 0;\r
   DefaultId           = 0;\r
+  HelpPageCount       = 0;\r
+  HelpLine            = 0;\r
+  RowCount            = 0;\r
+  HelpBottomLine      = 0;\r
+  HelpHeaderLine      = 0;\r
+  HelpPageIndex       = 0;\r
+  MultiHelpPage       = FALSE;\r
 \r
   OutputString        = NULL;\r
   UpArrow             = FALSE;\r
@@ -2842,22 +2860,112 @@ UiDisplayMenu (
           StringPtr = GetToken (MenuOption->ThisTag->Help, MenuOption->Handle);\r
         }\r
 \r
-        ProcessHelpString (StringPtr, &FormattedString, BottomRow - TopRow);\r
-\r
-        gST->ConOut->SetAttribute (gST->ConOut, HELP_TEXT | FIELD_BACKGROUND);\r
-\r
-        for (Index = 0; Index < BottomRow - TopRow; Index++) {\r
+        RowCount      = BottomRow - TopRow;\r
+        HelpPageIndex = 0;\r
+        //\r
+        // 1.Calculate how many line the help string need to print.\r
+        //\r
+        HelpLine = ProcessHelpString (StringPtr, &HelpString, RowCount);\r
+        if (HelpLine > RowCount) {\r
+          MultiHelpPage   = TRUE;\r
+          StringPtr       = GetToken (STRING_TOKEN(ADJUST_HELP_PAGE_UP), gHiiHandle);\r
+          HelpHeaderLine  = ProcessHelpString (StringPtr, &HelpHeaderString, RowCount);\r
+          StringPtr       = GetToken (STRING_TOKEN(ADJUST_HELP_PAGE_DOWN), gHiiHandle);\r
+          HelpBottomLine  = ProcessHelpString (StringPtr, &HelpBottomString, RowCount);\r
           //\r
-          // Pad String with spaces to simulate a clearing of the previous line\r
+          // Calculate the help page count.\r
           //\r
-          for (; GetStringWidth (&FormattedString[Index * gHelpBlockWidth * 2]) / 2 < gHelpBlockWidth;) {\r
-            StrCat (&FormattedString[Index * gHelpBlockWidth * 2], L" ");\r
+          if (HelpLine > 2 * RowCount - 2) {\r
+            HelpPageCount = (HelpLine - RowCount + 1) / (RowCount - 2) + 1;\r
+            if ((HelpLine - RowCount + 1) % (RowCount - 2) > 1) {\r
+              HelpPageCount += 1;\r
+            }\r
+          } else {\r
+            HelpPageCount = 2;\r
           }\r
+        } else {\r
+          MultiHelpPage = FALSE;\r
+        }\r
+      }\r
+\r
+      //\r
+      // Clean the help field first.\r
+      //\r
+      ClearLines (\r
+        LocalScreen.RightColumn - gHelpBlockWidth,\r
+        LocalScreen.RightColumn,\r
+        TopRow,\r
+        BottomRow,\r
+        PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND\r
+        );\r
 \r
+      gST->ConOut->SetAttribute (gST->ConOut, INFO_TEXT | FIELD_BACKGROUND);\r
+      //\r
+      // Check whether need to show the 'More(U/u)' at the begin.\r
+      // Base on current direct info, here shows aligned to the right side of the column.\r
+      // If the direction is multi line and aligned to right side may have problem, so \r
+      // add ASSERT code here.\r
+      //\r
+      if (HelpPageIndex > 0) {\r
+        for (Index = 0; Index < HelpHeaderLine; Index++) {\r
+          ASSERT (HelpHeaderLine == 1);\r
+          ASSERT (GetStringWidth (HelpHeaderString) / 2 < (UINTN) (gHelpBlockWidth - 1));\r
+          PrintStringAt (\r
+            LocalScreen.RightColumn - GetStringWidth (HelpHeaderString) / 2 - 1,\r
+            Index + TopRow,\r
+            &HelpHeaderString[Index * gHelpBlockWidth * 2]\r
+            );\r
+        }\r
+      }\r
+\r
+      gST->ConOut->SetAttribute (gST->ConOut, HELP_TEXT | FIELD_BACKGROUND);\r
+      //\r
+      // Print the help string info.\r
+      //\r
+      if (!MultiHelpPage) {\r
+        for (Index = 0; Index < RowCount; Index++) {\r
           PrintStringAt (\r
             LocalScreen.RightColumn - gHelpBlockWidth,\r
             Index + TopRow,\r
-            &FormattedString[Index * gHelpBlockWidth * 2]\r
+            &HelpString[Index * gHelpBlockWidth * 2]\r
+            );\r
+        }\r
+      } else  {\r
+        if (HelpPageIndex == 0) {\r
+          for (Index = 0; Index < RowCount - HelpBottomLine; Index++) {\r
+            PrintStringAt (\r
+              LocalScreen.RightColumn - gHelpBlockWidth,\r
+              Index + TopRow,\r
+              &HelpString[Index * gHelpBlockWidth * 2]\r
+              );\r
+          }\r
+        } else {\r
+          for (Index = 0; (Index < RowCount - HelpBottomLine - HelpHeaderLine) && \r
+              (Index + HelpPageIndex * (RowCount - 2) + 1 < HelpLine); Index++) {\r
+            PrintStringAt (\r
+              LocalScreen.RightColumn - gHelpBlockWidth,\r
+              Index + TopRow + HelpHeaderLine,\r
+              &HelpString[(Index + HelpPageIndex * (RowCount - 2) + 1)* gHelpBlockWidth * 2]\r
+              );\r
+          }\r
+        } \r
+      }\r
+\r
+      gST->ConOut->SetAttribute (gST->ConOut, INFO_TEXT | FIELD_BACKGROUND);\r
+      //\r
+      // Check whether need to print the 'More(D/d)' at the bottom.\r
+      // Base on current direct info, here shows aligned to the right side of the column.\r
+      // If the direction is multi line and aligned to right side may have problem, so \r
+      // add ASSERT code here.\r
+      //\r
+      if (HelpPageIndex < HelpPageCount - 1 && MultiHelpPage) {\r
+        for (Index = 0; Index < HelpBottomLine; Index++) {\r
+          ASSERT (HelpBottomLine == 1);\r
+          ASSERT (GetStringWidth (HelpBottomString) / 2 < (UINTN) (gHelpBlockWidth - 1)); \r
+          PrintStringAt (\r
+            LocalScreen.RightColumn - GetStringWidth (HelpBottomString) / 2 - 1,\r
+            Index + BottomRow - HelpBottomLine,\r
+            &HelpBottomString[Index * gHelpBlockWidth * 2]\r
             );\r
         }\r
       }\r
@@ -2981,6 +3089,26 @@ UiDisplayMenu (
         }\r
         break;\r
 \r
+      case 'D':\r
+      case 'd':\r
+        if (!MultiHelpPage) {\r
+          ControlFlag = CfReadKey;\r
+          break;\r
+        }\r
+        ControlFlag    = CfUpdateHelpString;\r
+        HelpPageIndex  = HelpPageIndex < HelpPageCount - 1 ? HelpPageIndex + 1 : HelpPageCount - 1;\r
+        break;\r
+\r
+      case 'U':\r
+      case 'u':\r
+        if (!MultiHelpPage) {\r
+          ControlFlag = CfReadKey;\r
+          break;\r
+        }\r
+        ControlFlag    = CfUpdateHelpString;\r
+        HelpPageIndex  = HelpPageIndex > 0 ? HelpPageIndex - 1 : 0;\r
+        break;\r
+\r
       case CHAR_NULL:\r
         for (Index = 0; Index < mScanCodeNumber; Index++) {\r
           if (Key.ScanCode == gScanCodeToOperation[Index].ScanCode) {\r
index db19888b22e3028f35393bd14aca3ec852ca7e0f..53309623cd720e287a65abc6f0ec456aad434c9f 100644 (file)
@@ -607,7 +607,7 @@ ProcessOptions (
   @param  RowCount               TRUE: if Question is selected.\r
 \r
 **/\r
-VOID\r
+UINTN\r
 ProcessHelpString (\r
   IN  CHAR16                      *StringPtr,\r
   OUT CHAR16                      **FormattedString,\r