/** @file\r
Entry and initialization module for the browser.\r
\r
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
CHAR16 *gConfirmOpt;\r
CHAR16 *gConfirmOptYes;\r
CHAR16 *gConfirmOptNo;\r
+CHAR16 *gConfirmOptOk;\r
+CHAR16 *gConfirmOptCancel;\r
+CHAR16 *gYesOption;\r
+CHAR16 *gNoOption;\r
+CHAR16 *gOkOption;\r
+CHAR16 *gCancelOption;\r
+CHAR16 *gErrorPopup;\r
+CHAR16 *gWarningPopup;\r
+CHAR16 *gInfoPopup;\r
CHAR16 *gConfirmMsgConnect;\r
CHAR16 *gConfirmMsgEnd;\r
+CHAR16 *gPasswordUnsupported;\r
CHAR16 gModalSkipColumn;\r
CHAR16 gPromptBlockWidth;\r
CHAR16 gOptionBlockWidth;\r
FormDisplay,\r
DriverClearDisplayPage,\r
ConfirmDataChange\r
+ },\r
+ {\r
+ EFI_HII_POPUP_PROTOCOL_REVISION,\r
+ CreatePopup\r
}\r
};\r
\r
gConfirmOpt = GetToken (STRING_TOKEN (CONFIRM_OPTION), gHiiHandle);\r
gConfirmOptYes = GetToken (STRING_TOKEN (CONFIRM_OPTION_YES), gHiiHandle);\r
gConfirmOptNo = GetToken (STRING_TOKEN (CONFIRM_OPTION_NO), gHiiHandle);\r
+ gConfirmOptOk = GetToken (STRING_TOKEN (CONFIRM_OPTION_OK), gHiiHandle);\r
+ gConfirmOptCancel = GetToken (STRING_TOKEN (CONFIRM_OPTION_CANCEL), gHiiHandle);\r
+ gYesOption = GetToken (STRING_TOKEN (YES_SELECTABLE_OPTION), gHiiHandle);\r
+ gNoOption = GetToken (STRING_TOKEN (NO_SELECTABLE_OPTION), gHiiHandle);\r
+ gOkOption = GetToken (STRING_TOKEN (OK_SELECTABLE_OPTION), gHiiHandle);\r
+ gCancelOption = GetToken (STRING_TOKEN (CANCEL_SELECTABLE_OPTION), gHiiHandle);\r
+ gErrorPopup = GetToken (STRING_TOKEN (ERROR_POPUP_STRING), gHiiHandle);\r
+ gWarningPopup = GetToken (STRING_TOKEN (WARNING_POPUP_STRING), gHiiHandle);\r
+ gInfoPopup = GetToken (STRING_TOKEN (INFO_POPUP_STRING), gHiiHandle);\r
gConfirmMsgConnect = GetToken (STRING_TOKEN (CONFIRM_OPTION_CONNECT), gHiiHandle);\r
gConfirmMsgEnd = GetToken (STRING_TOKEN (CONFIRM_OPTION_END), gHiiHandle);\r
+ gPasswordUnsupported = GetToken (STRING_TOKEN (PASSWORD_NOT_SUPPORTED ), gHiiHandle);\r
}\r
\r
/**\r
FreePool (gConfirmOpt);\r
FreePool (gConfirmOptYes);\r
FreePool (gConfirmOptNo);\r
+ FreePool (gConfirmOptOk);\r
+ FreePool (gConfirmOptCancel);\r
+ FreePool (gYesOption);\r
+ FreePool (gNoOption);\r
+ FreePool (gOkOption);\r
+ FreePool (gCancelOption);\r
+ FreePool (gErrorPopup);\r
+ FreePool (gWarningPopup);\r
+ FreePool (gInfoPopup);\r
FreePool (gConfirmMsgConnect);\r
FreePool (gConfirmMsgEnd);\r
+ FreePool (gPasswordUnsupported);\r
}\r
\r
/**\r
//\r
// Need extra glyph info and '\0' info, so +2.\r
//\r
- *OutputString = AllocateZeroPool (((UINTN) (StrOffset + 2) * sizeof(CHAR16)));\r
+ *OutputString = AllocateZeroPool ((StrOffset + 2) * sizeof(CHAR16));\r
if (*OutputString == NULL) {\r
return 0;\r
}\r
CHAR16 *OutputString;\r
UINT16 GlyphWidth;\r
\r
- Width = (UINT16) gOptionBlockWidth;\r
+ Width = (UINT16) gOptionBlockWidth - 1;\r
GlyphWidth = 1;\r
Row = 1;\r
\r
UpdateOptionSkipLines (NextMenuOption);\r
}\r
\r
- if (IsSelectable (NextMenuOption)) {\r
- break;\r
- }\r
-\r
//\r
- // In this case, still can't find the selectable menu,\r
+ // Check whether the menu is beyond current showing form,\r
// return the first one beyond the showing form.\r
//\r
if ((UINTN) Distance + NextMenuOption->Skip > GapToTop) {\r
break;\r
}\r
\r
+ //\r
+ // return the selectable menu in the showing form.\r
+ //\r
+ if (IsSelectable (NextMenuOption)) {\r
+ break;\r
+ }\r
+\r
Distance += NextMenuOption->Skip;\r
\r
//\r
}\r
\r
/**\r
- Find the Top of screen menu.\r
+ Calculate the distance between two menus and include the skip value of StartMenu.\r
\r
- If the input is NULL, base on the record highlight info in\r
- gHighligthMenuInfo to find the last highlight menu.\r
+ @param StartMenu The link_entry pointer to start menu.\r
+ @param EndMenu The link_entry pointer to end menu.\r
\r
- @param HighLightedStatement The input highlight statement.\r
+**/\r
+UINTN\r
+GetDistanceBetweenMenus(\r
+ IN LIST_ENTRY *StartMenu,\r
+ IN LIST_ENTRY *EndMenu\r
+)\r
+{\r
+ LIST_ENTRY *Link;\r
+ UI_MENU_OPTION *MenuOption;\r
+ UINTN Distance;\r
\r
- @retval The highlight menu index.\r
+ Distance = 0;\r
+\r
+ Link = StartMenu;\r
+ while (Link != EndMenu) {\r
+ MenuOption = MENU_OPTION_FROM_LINK (Link);\r
+ if (MenuOption->Row == 0) {\r
+ UpdateOptionSkipLines (MenuOption);\r
+ }\r
+ Distance += MenuOption->Skip;\r
+ Link = Link->BackLink;\r
+ }\r
+ return Distance;\r
+}\r
+\r
+/**\r
+ Find the top of screen menu base on the previous record menu info.\r
+\r
+ @param HighLightMenu The link_entry pointer to highlight menu.\r
+\r
+ @retval Return the the link_entry pointer top of screen menu.\r
\r
**/\r
LIST_ENTRY *\r
FindTopOfScreenMenuOption (\r
- VOID\r
- )\r
+ IN LIST_ENTRY *HighLightMenu\r
+ )\r
{\r
LIST_ENTRY *NewPos;\r
UI_MENU_OPTION *MenuOption;\r
+ UINTN TopRow;\r
+ UINTN BottomRow;\r
+\r
+ TopRow = gStatementDimensions.TopRow + SCROLL_ARROW_HEIGHT;\r
+ BottomRow = gStatementDimensions.BottomRow - SCROLL_ARROW_HEIGHT;\r
\r
NewPos = gMenuOption.ForwardLink;\r
MenuOption = MENU_OPTION_FROM_LINK (NewPos);\r
// Last time top of screen menu has disappeared.\r
//\r
if (NewPos == &gMenuOption) {\r
- NewPos = NULL;\r
+ return NULL;\r
+ }\r
+ //\r
+ // Check whether highlight menu and top of screen menu can be shown within one page,\r
+ // if can't, return NULL to re-calcaulate the top of scrren menu. Because some new menus\r
+ // may be dynamically inserted between highlightmenu and previous top of screen menu,\r
+ // So previous record top of screen menu is not appropriate for current display.\r
+ //\r
+ if (GetDistanceBetweenMenus (HighLightMenu, NewPos) + 1 > BottomRow - TopRow) {\r
+ return NULL;\r
}\r
\r
return NewPos;\r
//\r
// Found the last time highlight menu.\r
//\r
- *TopOfScreen = FindTopOfScreenMenuOption();\r
+ *TopOfScreen = FindTopOfScreenMenuOption(*HighlightMenu);\r
if (*TopOfScreen != NULL) {\r
//\r
// Found the last time selectable top of screen menu.\r
MenuOption = MENU_OPTION_FROM_LINK (*HighlightMenu);\r
UpdateOptionSkipLines (MenuOption);\r
\r
- *TopOfScreen = FindTopOfScreenMenuOption();\r
+ *TopOfScreen = FindTopOfScreenMenuOption(*HighlightMenu);\r
if (*TopOfScreen == NULL) {\r
//\r
// Not found last time top of screen menu, so base on current highlight menu\r
gST->ConOut->SetAttribute (gST->ConOut, GetInfoTextColor ());\r
for (Index = 0; Index < HelpHeaderLine; Index++) {\r
ASSERT (HelpHeaderLine == 1);\r
- ASSERT (GetStringWidth (HelpHeaderString) / 2 < (UINTN) (gHelpBlockWidth - 1));\r
+ ASSERT (GetStringWidth (HelpHeaderString) / 2 < ((UINT32) gHelpBlockWidth - 1));\r
PrintStringAtWithWidth (\r
gStatementDimensions.RightColumn - gHelpBlockWidth,\r
Index + TopRow,\r
gST->ConOut->SetAttribute (gST->ConOut, GetInfoTextColor ());\r
for (Index = 0; Index < HelpBottomLine; Index++) {\r
ASSERT (HelpBottomLine == 1);\r
- ASSERT (GetStringWidth (HelpBottomString) / 2 < (UINTN) (gHelpBlockWidth - 1)); \r
+ ASSERT (GetStringWidth (HelpBottomString) / 2 < ((UINT32) gHelpBlockWidth - 1));\r
PrintStringAtWithWidth (\r
gStatementDimensions.RightColumn - gHelpBlockWidth,\r
BottomRow + Index - HelpBottomLine + 1,\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
+ //\r
+ // Install HII Popup Protocol.\r
+ //\r
+ Status = gBS->InstallProtocolInterface (\r
+ &mPrivateData.Handle,\r
+ &gEfiHiiPopupProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ &mPrivateData.HiiPopup\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
InitializeDisplayStrings();\r
\r
ZeroMem (&gHighligthMenuInfo, sizeof (gHighligthMenuInfo));\r