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
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
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
}\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