/** @file\r
Utility functions for User Interface functions.\r
\r
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
{\r
SCAN_RIGHT,\r
UiRight,\r
- },\r
- {\r
- SCAN_F9,\r
- UiDefault,\r
- },\r
- {\r
- SCAN_F10,\r
- UiSave\r
}\r
};\r
\r
+UINTN mScanCodeNumber = sizeof (gScanCodeToOperation) / sizeof (gScanCodeToOperation[0]);\r
+\r
SCREEN_OPERATION_T0_CONTROL_FLAG gScreenOperationToControlFlag[] = {\r
{\r
UiNoOperation,\r
CfUiNoOperation,\r
},\r
- {\r
- UiDefault,\r
- CfUiDefault,\r
- },\r
{\r
UiSelect,\r
CfUiSelect,\r
UiReset,\r
CfUiReset,\r
},\r
- {\r
- UiSave,\r
- CfUiSave,\r
- },\r
{\r
UiPageUp,\r
CfUiPageUp,\r
{\r
UiPageDown,\r
CfUiPageDown\r
+ }, \r
+ {\r
+ UiHotKey,\r
+ CfUiHotKey\r
}\r
};\r
\r
of the given parent menu.\r
\r
@param Parent The parent of menu to be added.\r
+ @param HiiHandle Hii handle related to this formset.\r
@param FormSetGuid The Formset Guid of menu to be added.\r
@param FormId The Form ID of menu to be added.\r
\r
UI_MENU_LIST *\r
UiAddMenuList (\r
IN OUT UI_MENU_LIST *Parent,\r
+ IN EFI_HII_HANDLE HiiHandle,\r
IN EFI_GUID *FormSetGuid,\r
IN UINT16 FormId\r
)\r
MenuList->Signature = UI_MENU_LIST_SIGNATURE;\r
InitializeListHead (&MenuList->ChildListHead);\r
\r
+ MenuList->HiiHandle = HiiHandle;\r
CopyMem (&MenuList->FormSetGuid, FormSetGuid, sizeof (EFI_GUID));\r
MenuList->FormId = FormId;\r
MenuList->Parent = Parent;\r
\r
\r
/**\r
- Search Menu with given FormId in the parent menu and all its child menus.\r
+ Search Menu with given FormId and FormSetGuid in all cached menu list.\r
\r
@param Parent The parent of menu to search.\r
+ @param FormSetGuid The Formset GUID of the menu to search. \r
@param FormId The Form ID of menu to search.\r
\r
@return A pointer to menu found or NULL if not found.\r
UI_MENU_LIST *\r
UiFindChildMenuList (\r
IN UI_MENU_LIST *Parent,\r
+ IN EFI_GUID *FormSetGuid, \r
IN UINT16 FormId\r
)\r
{\r
UI_MENU_LIST *Child;\r
UI_MENU_LIST *MenuList;\r
\r
- if (Parent->FormId == FormId) {\r
+ ASSERT (Parent != NULL);\r
+\r
+ if (Parent->FormId == FormId && CompareGuid (FormSetGuid, &Parent->FormSetGuid)) {\r
return Parent;\r
}\r
\r
while (!IsNull (&Parent->ChildListHead, Link)) {\r
Child = UI_MENU_LIST_FROM_LINK (Link);\r
\r
- MenuList = UiFindChildMenuList (Child, FormId);\r
+ MenuList = UiFindChildMenuList (Child, FormSetGuid, FormId);\r
if (MenuList != NULL) {\r
return MenuList;\r
}\r
while (!IsNull (&gMenuList, Link)) {\r
MenuList = UI_MENU_LIST_FROM_LINK (Link);\r
\r
- if (CompareGuid (FormSetGuid, &MenuList->FormSetGuid)) {\r
- //\r
- // This is the formset we are looking for, find the form in this formset\r
- //\r
- Child = UiFindChildMenuList (MenuList, FormId);\r
- if (Child != NULL) {\r
- return Child;\r
- }\r
+ Child = UiFindChildMenuList(MenuList, FormSetGuid, FormId);\r
+ if (Child != NULL) {\r
+ return Child;\r
}\r
\r
Link = GetNextNode (&gMenuList, Link);\r
}\r
\r
\r
+/**\r
+ Process option string for date/time opcode.\r
+\r
+ @param MenuOption Menu option point to date/time.\r
+ @param OptionString Option string input for process.\r
+ @param AddOptCol Whether need to update MenuOption->OptCol. \r
+\r
+**/\r
+VOID \r
+ProcessStringForDateTime (\r
+ UI_MENU_OPTION *MenuOption,\r
+ CHAR16 *OptionString,\r
+ BOOLEAN AddOptCol\r
+ )\r
+{\r
+ UINTN Index;\r
+ UINTN Count;\r
+ FORM_BROWSER_STATEMENT *Statement;\r
+\r
+ ASSERT (MenuOption != NULL && OptionString != NULL);\r
+ \r
+ Statement = MenuOption->ThisTag;\r
+ \r
+ //\r
+ // If leading spaces on OptionString - remove the spaces\r
+ //\r
+ for (Index = 0; OptionString[Index] == L' '; Index++) {\r
+ //\r
+ // Base on the blockspace to get the option column info.\r
+ //\r
+ if (AddOptCol) {\r
+ MenuOption->OptCol++;\r
+ }\r
+ }\r
+ \r
+ for (Count = 0; OptionString[Index] != CHAR_NULL; Index++) {\r
+ OptionString[Count] = OptionString[Index];\r
+ Count++;\r
+ }\r
+ OptionString[Count] = CHAR_NULL;\r
+ \r
+ //\r
+ // Enable to suppress field in the opcode base on the flag.\r
+ //\r
+ if (Statement->Operand == EFI_IFR_DATE_OP) {\r
+ //\r
+ // OptionString format is: <**: **: ****>\r
+ // |month|day|year|\r
+ // 4 3 5\r
+ //\r
+ if ((Statement->Flags & EFI_QF_DATE_MONTH_SUPPRESS) && (MenuOption->Sequence == 0)) {\r
+ //\r
+ // At this point, only "<**:" in the optionstring. \r
+ // Clean the day's ** field, after clean, the format is "< :"\r
+ //\r
+ SetUnicodeMem (&OptionString[1], 2, L' ');\r
+ } else if ((Statement->Flags & EFI_QF_DATE_DAY_SUPPRESS) && (MenuOption->Sequence == 1)) {\r
+ //\r
+ // At this point, only "**:" in the optionstring. \r
+ // Clean the month's "**" field, after clean, the format is " :"\r
+ // \r
+ SetUnicodeMem (&OptionString[0], 2, L' ');\r
+ } else if ((Statement->Flags & EFI_QF_DATE_YEAR_SUPPRESS) && (MenuOption->Sequence == 2)) {\r
+ //\r
+ // At this point, only "****>" in the optionstring. \r
+ // Clean the year's "****" field, after clean, the format is " >"\r
+ // \r
+ SetUnicodeMem (&OptionString[0], 4, L' ');\r
+ }\r
+ } else if (Statement->Operand == EFI_IFR_TIME_OP) {\r
+ //\r
+ // OptionString format is: <**: **: **>\r
+ // |hour|minute|second|\r
+ // 4 3 3\r
+ //\r
+ if ((Statement->Flags & QF_TIME_HOUR_SUPPRESS) && (MenuOption->Sequence == 0)) {\r
+ //\r
+ // At this point, only "<**:" in the optionstring. \r
+ // Clean the hour's ** field, after clean, the format is "< :"\r
+ //\r
+ SetUnicodeMem (&OptionString[1], 2, L' ');\r
+ } else if ((Statement->Flags & QF_TIME_MINUTE_SUPPRESS) && (MenuOption->Sequence == 1)) {\r
+ //\r
+ // At this point, only "**:" in the optionstring. \r
+ // Clean the minute's "**" field, after clean, the format is " :"\r
+ // \r
+ SetUnicodeMem (&OptionString[0], 2, L' ');\r
+ } else if ((Statement->Flags & QF_TIME_SECOND_SUPPRESS) && (MenuOption->Sequence == 2)) {\r
+ //\r
+ // At this point, only "**>" in the optionstring. \r
+ // Clean the second's "**" field, after clean, the format is " >"\r
+ // \r
+ SetUnicodeMem (&OptionString[0], 2, L' ');\r
+ }\r
+ }\r
+}\r
\r
/**\r
Refresh question.\r
)\r
{\r
CHAR16 *OptionString;\r
- UINTN Index;\r
EFI_STATUS Status;\r
UI_MENU_SELECTION *Selection;\r
FORM_BROWSER_STATEMENT *Question;\r
ProcessOptions (Selection, MenuRefreshEntry->MenuOption, FALSE, &OptionString);\r
\r
if (OptionString != NULL) {\r
- //\r
- // If leading spaces on OptionString - remove the spaces\r
- //\r
- for (Index = 0; OptionString[Index] == L' '; Index++)\r
- ;\r
-\r
//\r
// If old Text is longer than new string, need to clean the old string before paint the newer.\r
// This option is no need for time/date opcode, because time/data opcode has fixed string length.\r
}\r
\r
gST->ConOut->SetAttribute (gST->ConOut, MenuRefreshEntry->CurrentAttribute);\r
- PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, &OptionString[Index]);\r
+ ProcessStringForDateTime(MenuRefreshEntry->MenuOption, OptionString, FALSE);\r
+ PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, OptionString);\r
FreePool (OptionString);\r
}\r
\r
\r
@param String String description for this option.\r
@param Handle Hii handle for the package list.\r
+ @param Form The form this statement belong to.\r
@param Statement Statement of this Menu Option.\r
@param NumberOfLines Display lines for this Menu Option.\r
@param MenuItemCount The index for this Option in the Menu.\r
UiAddMenuOption (\r
IN CHAR16 *String,\r
IN EFI_HII_HANDLE Handle,\r
+ IN FORM_BROWSER_FORM *Form,\r
IN FORM_BROWSER_STATEMENT *Statement,\r
IN UINT16 NumberOfLines,\r
IN UINT16 MenuItemCount\r
}\r
MenuOption->Sequence = Index;\r
\r
- if (Statement->GrayOutExpression != NULL) {\r
- MenuOption->GrayOut = Statement->GrayOutExpression->Result.Value.b;\r
+ if (EvaluateExpressionList(Statement->Expression, FALSE, NULL, NULL) == ExpressGrayOut ) {\r
+ MenuOption->GrayOut = TRUE;\r
+ } else {\r
+ MenuOption->GrayOut = FALSE;\r
}\r
\r
+ //\r
+ // If the form or the question has the lock attribute, deal same as grayout.\r
+ //\r
+ if (Form->Locked || Statement->Locked) {\r
+ MenuOption->GrayOut = TRUE;\r
+ }\r
+ \r
switch (Statement->Operand) {\r
case EFI_IFR_ORDERED_LIST_OP:\r
case EFI_IFR_ONE_OF_OP:\r
ASSERT (TempString);\r
ASSERT (BufferedString);\r
\r
- VA_START (Marker, KeyValue);\r
-\r
//\r
// Zero the outgoing buffer\r
//\r
\r
LargestString = 0;\r
\r
+ VA_START (Marker, KeyValue);\r
+\r
//\r
// Determine the largest string in the dialog box\r
// Notice we are starting with 1 since String is the first string\r
UINTN Index;\r
CHAR16 *NvUpdateMessage;\r
CHAR16 *InputErrorMessage;\r
-\r
+ LIST_ENTRY *Link;\r
+ FORM_BROWSER_FORMSET *LocalFormSet;\r
+ FORM_BROWSER_STATEMENT *Question;\r
+ \r
NvUpdateMessage = GetToken (STRING_TOKEN (NV_UPDATE_MESSAGE), gHiiHandle);\r
InputErrorMessage = GetToken (STRING_TOKEN (INPUT_ERROR_MESSAGE), gHiiHandle);\r
\r
break;\r
\r
case NV_UPDATE_REQUIRED:\r
- if ((gClassOfVfr & FORMSET_CLASS_FRONT_PAGE) != FORMSET_CLASS_FRONT_PAGE) {\r
- if (State) {\r
+ //\r
+ // Global setting support. Show configuration change on every form.\r
+ //\r
+ if (State) {\r
+ gResetRequired = (BOOLEAN) (gResetRequired | ((Flags & EFI_IFR_FLAG_RESET_REQUIRED) == EFI_IFR_FLAG_RESET_REQUIRED));\r
+\r
+ if (Selection != NULL && Selection->Statement != NULL) {\r
+ Question = Selection->Statement;\r
+ if (Question->Storage != NULL || Question->Operand == EFI_IFR_DATE_OP || Question->Operand == EFI_IFR_TIME_OP) {\r
+ //\r
+ // Update only for Question value that need to be saved into Storage.\r
+ //\r
+ Selection->Form->NvUpdateRequired = TRUE;\r
+ }\r
+ }\r
+ \r
+ if (Selection == NULL || IsNvUpdateRequired (Selection->FormSet)) {\r
gST->ConOut->SetAttribute (gST->ConOut, INFO_TEXT);\r
PrintStringAt (\r
gScreenDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth,\r
gScreenDimensions.BottomRow - 1,\r
NvUpdateMessage\r
);\r
- gResetRequired = (BOOLEAN) (gResetRequired | ((Flags & EFI_IFR_FLAG_RESET_REQUIRED) == EFI_IFR_FLAG_RESET_REQUIRED));\r
-\r
- if (Selection != NULL) {\r
- Selection->Form->NvUpdateRequired = TRUE;\r
- }\r
- } else {\r
- gST->ConOut->SetAttribute (gST->ConOut, PcdGet8 (PcdBrowserFieldTextHighlightColor));\r
- for (Index = 0; Index < (GetStringWidth (NvUpdateMessage) - 2) / 2; Index++) {\r
- PrintAt (\r
- (gScreenDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + Index),\r
- gScreenDimensions.BottomRow - 1,\r
- L" "\r
- );\r
- }\r
-\r
- if (Selection != NULL) {\r
- Selection->Form->NvUpdateRequired = FALSE;\r
- }\r
+ }\r
+ } else {\r
+ gST->ConOut->SetAttribute (gST->ConOut, PcdGet8 (PcdBrowserFieldTextHighlightColor));\r
+ for (Index = 0; Index < (GetStringWidth (NvUpdateMessage) - 2) / 2; Index++) {\r
+ PrintAt (\r
+ (gScreenDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + Index),\r
+ gScreenDimensions.BottomRow - 1,\r
+ L" "\r
+ );\r
}\r
}\r
break;\r
UpdateStatusBar (Selection, INPUT_ERROR, Flags, TRUE);\r
}\r
\r
- if (IsNvUpdateRequired(Selection->FormSet)) {\r
- UpdateStatusBar (NULL, NV_UPDATE_REQUIRED, Flags, TRUE);\r
+ switch (gBrowserSettingScope) {\r
+ case SystemLevel:\r
+ //\r
+ // Check the maintain list to see whether there is any change.\r
+ //\r
+ Link = GetFirstNode (&gBrowserFormSetList);\r
+ while (!IsNull (&gBrowserFormSetList, Link)) {\r
+ LocalFormSet = FORM_BROWSER_FORMSET_FROM_LINK (Link);\r
+ if (IsNvUpdateRequired(LocalFormSet)) {\r
+ UpdateStatusBar (NULL, NV_UPDATE_REQUIRED, Flags, TRUE);\r
+ break;\r
+ }\r
+ Link = GetNextNode (&gBrowserFormSetList, Link);\r
+ }\r
+ break;\r
+ case FormSetLevel:\r
+ case FormLevel:\r
+ UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Flags, TRUE);\r
+ default:\r
+ break;\r
}\r
+\r
break;\r
\r
default:\r
\r
@param Selection The user's selection.\r
@param MenuOption The MenuOption to be checked.\r
- @param OptionalString The option string.\r
- @param SkipValue The number of lins to skip.\r
\r
**/\r
VOID\r
UpdateOptionSkipLines (\r
IN UI_MENU_SELECTION *Selection,\r
- IN UI_MENU_OPTION *MenuOption,\r
- OUT CHAR16 **OptionalString,\r
- IN UINTN SkipValue\r
+ IN UI_MENU_OPTION *MenuOption\r
)\r
{\r
UINTN Index;\r
CHAR16 *OptionString;\r
\r
Row = 0;\r
- OptionString = *OptionalString;\r
- OutputString = NULL;\r
-\r
+ OptionString = NULL;\r
ProcessOptions (Selection, MenuOption, FALSE, &OptionString);\r
\r
if (OptionString != NULL) {\r
// If there is more string to process print on the next row and increment the Skip value\r
//\r
if (StrLen (&OptionString[Index]) != 0) {\r
- if (SkipValue == 0) {\r
- Row++;\r
- //\r
- // Since the Number of lines for this menu entry may or may not be reflected accurately\r
- // since the prompt might be 1 lines and option might be many, and vice versa, we need to do\r
- // some testing to ensure we are keeping this in-sync.\r
- //\r
- // If the difference in rows is greater than or equal to the skip value, increase the skip value\r
- //\r
- if ((Row - OriginalRow) >= MenuOption->Skip) {\r
- MenuOption->Skip++;\r
- }\r
+ Row++;\r
+ //\r
+ // Since the Number of lines for this menu entry may or may not be reflected accurately\r
+ // since the prompt might be 1 lines and option might be many, and vice versa, we need to do\r
+ // some testing to ensure we are keeping this in-sync.\r
+ //\r
+ // If the difference in rows is greater than or equal to the skip value, increase the skip value\r
+ //\r
+ if ((Row - OriginalRow) >= MenuOption->Skip) {\r
+ MenuOption->Skip++;\r
}\r
}\r
\r
FreePool (OutputString);\r
- if (SkipValue != 0) {\r
- SkipValue--;\r
- }\r
}\r
\r
Row = OriginalRow;\r
}\r
\r
- *OptionalString = OptionString;\r
+ if (OptionString != NULL) {\r
+ FreePool (OptionString);\r
+ }\r
}\r
\r
\r
\r
This is an internal function.\r
\r
+ @param Selection Menu selection.\r
@param GoUp The navigation direction. TRUE: up, FALSE: down.\r
@param CurrentPosition Current position.\r
@param GapToTop Gap position to top or bottom.\r
**/\r
INTN\r
MoveToNextStatement (\r
+ IN UI_MENU_SELECTION *Selection,\r
IN BOOLEAN GoUp,\r
IN OUT LIST_ENTRY **CurrentPosition,\r
IN UINTN GapToTop\r
\r
while (TRUE) {\r
NextMenuOption = MENU_OPTION_FROM_LINK (Pos);\r
+ if (NextMenuOption->Row == 0) {\r
+ UpdateOptionSkipLines (Selection, NextMenuOption);\r
+ }\r
+ \r
if (GoUp && (PreMenuOption != NextMenuOption)) {\r
//\r
// Current Position doesn't need to be caculated when go up.\r
return HiiHandle;\r
}\r
\r
+/**\r
+ Find HII Handle in the HII database associated with given form set guid.\r
+\r
+ If FormSetGuid is NULL, then ASSERT.\r
+\r
+ @param ComparingGuid FormSet Guid associated with the HII package list\r
+ handle.\r
+\r
+ @retval Handle HII package list Handle associated with the Device\r
+ Path.\r
+ @retval NULL Hii Package list handle is not found.\r
+\r
+**/\r
+EFI_HII_HANDLE\r
+FormSetGuidToHiiHandle (\r
+ EFI_GUID *ComparingGuid\r
+ )\r
+{\r
+ EFI_HII_HANDLE *HiiHandles;\r
+ UINTN Index;\r
+ EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;\r
+ UINTN BufferSize;\r
+ UINT32 Offset;\r
+ UINT32 Offset2;\r
+ UINT32 PackageListLength;\r
+ EFI_HII_PACKAGE_HEADER PackageHeader;\r
+ UINT8 *Package;\r
+ UINT8 *OpCodeData;\r
+ EFI_STATUS Status;\r
+ EFI_HII_HANDLE HiiHandle;\r
+\r
+ ASSERT (ComparingGuid != NULL);\r
+\r
+ HiiHandle = NULL;\r
+ //\r
+ // Get all the Hii handles\r
+ //\r
+ HiiHandles = HiiGetHiiHandles (NULL);\r
+ ASSERT (HiiHandles != NULL);\r
+\r
+ //\r
+ // Search for formset of each class type\r
+ //\r
+ for (Index = 0; HiiHandles[Index] != NULL; Index++) {\r
+ BufferSize = 0;\r
+ HiiPackageList = NULL;\r
+ Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, HiiHandles[Index], &BufferSize, HiiPackageList);\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
+ HiiPackageList = AllocatePool (BufferSize);\r
+ ASSERT (HiiPackageList != NULL);\r
+\r
+ Status = mHiiDatabase->ExportPackageLists (mHiiDatabase, HiiHandles[Index], &BufferSize, HiiPackageList);\r
+ }\r
+ if (EFI_ERROR (Status) || HiiPackageList == NULL) {\r
+ return NULL;\r
+ }\r
+\r
+ //\r
+ // Get Form package from this HII package List\r
+ //\r
+ Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);\r
+ Offset2 = 0;\r
+ CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32)); \r
+\r
+ while (Offset < PackageListLength) {\r
+ Package = ((UINT8 *) HiiPackageList) + Offset;\r
+ CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));\r
+\r
+ if (PackageHeader.Type == EFI_HII_PACKAGE_FORMS) {\r
+ //\r
+ // Search FormSet in this Form Package\r
+ //\r
+ Offset2 = sizeof (EFI_HII_PACKAGE_HEADER);\r
+ while (Offset2 < PackageHeader.Length) {\r
+ OpCodeData = Package + Offset2;\r
+\r
+ if (((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_FORM_SET_OP) {\r
+ //\r
+ // Try to compare against formset GUID\r
+ //\r
+ if (CompareGuid (ComparingGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)))) {\r
+ HiiHandle = HiiHandles[Index];\r
+ break;\r
+ }\r
+ }\r
+\r
+ Offset2 += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;\r
+ }\r
+ }\r
+ if (HiiHandle != NULL) {\r
+ break;\r
+ }\r
+ Offset += PackageHeader.Length;\r
+ }\r
+ \r
+ FreePool (HiiPackageList);\r
+ if (HiiHandle != NULL) {\r
+ break;\r
+ }\r
+ }\r
+\r
+ FreePool (HiiHandles);\r
+\r
+ return HiiHandle;\r
+}\r
+\r
/**\r
Process the goto op code, update the info in the selection structure.\r
\r
)\r
{\r
CHAR16 *StringPtr;\r
+ UINTN StringLen;\r
UINTN BufferSize;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
CHAR16 TemStr[2];\r
EFI_INPUT_KEY Key;\r
EFI_STATUS Status;\r
UI_MENU_LIST *MenuList;\r
+ BOOLEAN UpdateFormInfo;\r
\r
Status = EFI_SUCCESS;\r
+ UpdateFormInfo = TRUE;\r
+ StringPtr = NULL;\r
+ StringLen = 0;\r
\r
+ //\r
+ // Prepare the device path check, get the device path info first.\r
+ //\r
if (Statement->HiiValue.Value.ref.DevicePath != 0) {\r
+ StringPtr = GetToken (Statement->HiiValue.Value.ref.DevicePath, Selection->FormSet->HiiHandle);\r
+ if (StringPtr != NULL) {\r
+ StringLen = StrLen (StringPtr);\r
+ }\r
+ }\r
+\r
+ //\r
+ // Check whether the device path string is a valid string.\r
+ //\r
+ if (Statement->HiiValue.Value.ref.DevicePath != 0 && StringPtr != NULL && StringLen != 0) {\r
if (Selection->Form->ModalForm) {\r
return Status;\r
}\r
// Goto another Hii Package list\r
//\r
Selection->Action = UI_ACTION_REFRESH_FORMSET;\r
-\r
- StringPtr = GetToken (Statement->HiiValue.Value.ref.DevicePath, Selection->FormSet->HiiHandle);\r
- if (StringPtr == NULL) {\r
- //\r
- // No device path string not found, exit\r
- //\r
- Selection->Action = UI_ACTION_EXIT;\r
- Selection->Statement = NULL;\r
- return Status;\r
- }\r
BufferSize = StrLen (StringPtr) / 2;\r
DevicePath = AllocatePool (BufferSize);\r
ASSERT (DevicePath != NULL);\r
DevicePathBuffer [Index/2] = (UINT8) ((DevicePathBuffer [Index/2] << 4) + DigitUint8);\r
}\r
}\r
+ FreePool (StringPtr);\r
\r
Selection->Handle = DevicePathToHiiHandle (DevicePath);\r
+ FreePool (DevicePath);\r
+\r
if (Selection->Handle == NULL) {\r
//\r
// If target Hii Handle not found, exit\r
return Status;\r
}\r
\r
- FreePool (StringPtr);\r
- FreePool (DevicePath);\r
-\r
CopyMem (&Selection->FormSetGuid,&Statement->HiiValue.Value.ref.FormSetGuid, sizeof (EFI_GUID));\r
Selection->FormId = Statement->HiiValue.Value.ref.FormId;\r
Selection->QuestionId = Statement->HiiValue.Value.ref.QuestionId;\r
// Goto another Formset, check for uncommitted data\r
//\r
Selection->Action = UI_ACTION_REFRESH_FORMSET;\r
+ \r
+ Selection->Handle = FormSetGuidToHiiHandle(&Statement->HiiValue.Value.ref.FormSetGuid);\r
+ if (Selection->Handle == NULL) {\r
+ //\r
+ // If target Hii Handle not found, exit\r
+ //\r
+ Selection->Action = UI_ACTION_EXIT;\r
+ Selection->Statement = NULL;\r
+ return Status;\r
+ } \r
\r
CopyMem (&Selection->FormSetGuid, &Statement->HiiValue.Value.ref.FormSetGuid, sizeof (EFI_GUID));\r
Selection->FormId = Statement->HiiValue.Value.ref.FormId;\r
RefForm = IdToForm (Selection->FormSet, Statement->HiiValue.Value.ref.FormId);\r
\r
if ((RefForm != NULL) && (RefForm->SuppressExpression != NULL)) {\r
- Status = EvaluateExpression (Selection->FormSet, RefForm, RefForm->SuppressExpression);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- if (RefForm->SuppressExpression->Result.Value.b) {\r
+ if (EvaluateExpressionList(RefForm->SuppressExpression, TRUE, Selection->FormSet, RefForm) != ExpressFalse) {\r
//\r
// Form is suppressed. \r
//\r
//\r
Selection->Action = UI_ACTION_REFRESH_FORM;\r
\r
- //\r
- // Link current form so that we can always go back when someone hits the ESC\r
- //\r
- MenuList = UiFindMenuList (&Selection->FormSetGuid, Statement->HiiValue.Value.ref.FormId);\r
- if (MenuList == NULL && Selection->CurrentMenu != NULL) {\r
- MenuList = UiAddMenuList (Selection->CurrentMenu, &Selection->FormSetGuid, Statement->HiiValue.Value.ref.FormId);\r
- }\r
-\r
Selection->FormId = Statement->HiiValue.Value.ref.FormId;\r
Selection->QuestionId = Statement->HiiValue.Value.ref.QuestionId;\r
} else if (Statement->HiiValue.Value.ref.QuestionId != 0) {\r
*NewLine = TRUE;\r
}\r
}\r
+ UpdateFormInfo = FALSE;\r
} else {\r
if ((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {\r
Selection->Action = UI_ACTION_REFRESH_FORM;\r
}\r
+ UpdateFormInfo = FALSE;\r
+ }\r
+\r
+ if (UpdateFormInfo) {\r
+ //\r
+ // Link current form so that we can always go back when someone hits the ESC\r
+ //\r
+ MenuList = UiFindMenuList (&Selection->FormSetGuid, Selection->FormId);\r
+ if (MenuList == NULL && Selection->CurrentMenu != NULL) {\r
+ MenuList = UiAddMenuList (Selection->CurrentMenu, Selection->Handle, &Selection->FormSetGuid, Selection->FormId);\r
+ }\r
}\r
\r
return Status;\r
UINTN BottomRow;\r
UINTN OriginalRow;\r
UINTN Index;\r
- UINT32 Count;\r
UINT16 Width;\r
CHAR16 *StringPtr;\r
CHAR16 *OptionString;\r
FORM_BROWSER_STATEMENT *Statement;\r
UI_MENU_LIST *CurrentMenu;\r
UINTN ModalSkipColumn;\r
+ BROWSER_HOT_KEY *HotKey;\r
\r
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));\r
\r
NextMenuOption = NULL;\r
PreviousMenuOption = NULL;\r
SavedMenuOption = NULL;\r
+ HotKey = NULL;\r
ModalSkipColumn = (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 6;\r
\r
ZeroMem (&Key, sizeof (EFI_INPUT_KEY));\r
Col = LocalScreen.LeftColumn + LEFT_SKIPPED_COLUMNS;\r
}\r
\r
- BottomRow = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT - SCROLL_ARROW_HEIGHT - 1;\r
+ BottomRow = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight - SCROLL_ARROW_HEIGHT - 1;\r
\r
Selection->TopRow = TopRow;\r
Selection->BottomRow = BottomRow;\r
//\r
// Current menu not found, add it to the menu tree\r
//\r
- CurrentMenu = UiAddMenuList (NULL, &Selection->FormSetGuid, Selection->FormId);\r
+ CurrentMenu = UiAddMenuList (NULL, Selection->Handle, &Selection->FormSetGuid, Selection->FormId);\r
}\r
ASSERT (CurrentMenu != NULL);\r
Selection->CurrentMenu = CurrentMenu;\r
\r
if (OptionString != NULL) {\r
if (Statement->Operand == EFI_IFR_DATE_OP || Statement->Operand == EFI_IFR_TIME_OP) {\r
- //\r
- // If leading spaces on OptionString - remove the spaces\r
- //\r
- for (Index = 0; OptionString[Index] == L' '; Index++) {\r
- MenuOption->OptCol++;\r
- }\r
-\r
- for (Count = 0; OptionString[Index] != CHAR_NULL; Index++) {\r
- OptionString[Count] = OptionString[Index];\r
- Count++;\r
- }\r
-\r
- OptionString[Count] = CHAR_NULL;\r
+ ProcessStringForDateTime(MenuOption, OptionString, TRUE);\r
}\r
\r
Width = (UINT16) gOptionBlockWidth;\r
ControlFlag = CfUpdateHelpString;\r
if (InitializedFlag) {\r
InitializedFlag = FALSE;\r
- MoveToNextStatement (FALSE, &NewPos, BottomRow - TopRow);\r
+ MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow);\r
}\r
\r
//\r
for (Index = TopRow; Index <= BottomRow && Link != NewPos;) {\r
SavedMenuOption = MENU_OPTION_FROM_LINK (Link);\r
Index += SavedMenuOption->Skip;\r
+ if (Link == TopOfScreen) {\r
+ Index -= OldSkipValue;\r
+ }\r
Link = Link->ForwardLink;\r
}\r
+ if (NewPos == Link) {\r
+ SavedMenuOption = MENU_OPTION_FROM_LINK (Link);\r
+ }\r
\r
- if (Link != NewPos || Index > 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
+ AdjustDateAndTimePosition(FALSE, &NewPos);\r
//\r
// NewPos is not in the current page, simply scroll page so that NewPos is in the end of the page\r
//\r
+ SavedMenuOption = MENU_OPTION_FROM_LINK (NewPos);\r
+ //\r
+ // SavedMenuOption->Row == 0 means the menu not show yet.\r
+ //\r
+ if (SavedMenuOption->Row == 0) {\r
+ UpdateOptionSkipLines (Selection, SavedMenuOption);\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; Index <= BottomRow; ) {\r
+ for (Index = TopRow + SavedMenuOption->Skip; Index <= BottomRow + 1; ) { \r
Link = Link->BackLink;\r
SavedMenuOption = MENU_OPTION_FROM_LINK (Link);\r
- Index += SavedMenuOption->Skip;\r
+ if (SavedMenuOption->Row == 0) {\r
+ UpdateOptionSkipLines (Selection, SavedMenuOption);\r
+ }\r
+ Index += SavedMenuOption->Skip;\r
+ }\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
+ //\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
- TopOfScreen = Link->ForwardLink;\r
\r
Repaint = TRUE;\r
NewLine = TRUE;\r
if ((MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) ||\r
(MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)\r
) {\r
- //\r
- // If leading spaces on OptionString - remove the spaces\r
- //\r
- for (Index = 0; OptionString[Index] == L' '; Index++)\r
- ;\r
-\r
- for (Count = 0; OptionString[Index] != CHAR_NULL; Index++) {\r
- OptionString[Count] = OptionString[Index];\r
- Count++;\r
- }\r
-\r
- OptionString[Count] = CHAR_NULL;\r
+ ProcessStringForDateTime(MenuOption, OptionString, FALSE);\r
}\r
\r
Width = (UINT16) gOptionBlockWidth;\r
ProcessOptions (Selection, MenuOption, FALSE, &OptionString);\r
if (OptionString != NULL) {\r
if (Statement->Operand == EFI_IFR_DATE_OP || Statement->Operand == EFI_IFR_TIME_OP) {\r
- //\r
- // If leading spaces on OptionString - remove the spaces\r
- //\r
- for (Index = 0; OptionString[Index] == L' '; Index++)\r
- ;\r
-\r
- for (Count = 0; OptionString[Index] != CHAR_NULL; Index++) {\r
- OptionString[Count] = OptionString[Index];\r
- Count++;\r
- }\r
-\r
- OptionString[Count] = CHAR_NULL;\r
+ ProcessStringForDateTime(MenuOption, OptionString, FALSE);\r
}\r
Width = (UINT16) gOptionBlockWidth;\r
\r
//\r
// IFR is updated in Callback of refresh opcode, re-parse it\r
//\r
+ ControlFlag = CfCheckSelection;\r
Selection->Statement = NULL;\r
- return EFI_SUCCESS;\r
+ break;\r
}\r
\r
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
\r
switch (Key.UnicodeChar) {\r
case CHAR_CARRIAGE_RETURN:\r
+ if(MenuOption->GrayOut || MenuOption->ReadOnly) {\r
+ ControlFlag = CfReadKey;\r
+ break;\r
+ }\r
+\r
ScreenOperation = UiSelect;\r
gDirection = 0;\r
break;\r
// If the screen has no menu items, and the user didn't select UiReset\r
// ignore the selection and go back to reading keys.\r
//\r
- if(IsListEmpty (&gMenuOption)) {\r
+ if(IsListEmpty (&gMenuOption) || MenuOption->GrayOut || MenuOption->ReadOnly) {\r
ControlFlag = CfReadKey;\r
break;\r
}\r
}\r
\r
ASSERT(MenuOption != NULL);\r
- if (MenuOption->ThisTag->Operand == EFI_IFR_CHECKBOX_OP && !MenuOption->GrayOut) {\r
+ if (MenuOption->ThisTag->Operand == EFI_IFR_CHECKBOX_OP && !MenuOption->GrayOut && !MenuOption->ReadOnly) {\r
ScreenOperation = UiSelect;\r
}\r
}\r
break;\r
\r
case CHAR_NULL:\r
- if (((Key.ScanCode == SCAN_F9) && ((gFunctionKeySetting & FUNCTION_NINE) != FUNCTION_NINE)) ||\r
- ((Key.ScanCode == SCAN_F10) && ((gFunctionKeySetting & FUNCTION_TEN) != FUNCTION_TEN))\r
- ) {\r
+ for (Index = 0; Index < mScanCodeNumber; Index++) {\r
+ if (Key.ScanCode == gScanCodeToOperation[Index].ScanCode) {\r
+ ScreenOperation = gScanCodeToOperation[Index].ScreenOperation;\r
+ break;\r
+ }\r
+ }\r
+ \r
+ if (Selection->Form->ModalForm && (Key.ScanCode == SCAN_ESC || Index == mScanCodeNumber)) {\r
//\r
- // If the function key has been disabled, just ignore the key.\r
+ // ModalForm has no ESC key and Hot Key.\r
//\r
- } else {\r
- for (Index = 0; Index < sizeof (gScanCodeToOperation) / sizeof (gScanCodeToOperation[0]); Index++) {\r
- if (Selection->Form->ModalForm && \r
- (Key.ScanCode == SCAN_F9 || Key.ScanCode == SCAN_F10 || Key.ScanCode == SCAN_ESC)) {\r
- ControlFlag = CfReadKey;\r
- break;\r
- }\r
-\r
- if (Key.ScanCode == gScanCodeToOperation[Index].ScanCode) {\r
- if (Key.ScanCode == SCAN_F9) {\r
- //\r
- // Reset to standard default\r
- //\r
- DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;\r
- }\r
- ScreenOperation = gScanCodeToOperation[Index].ScreenOperation;\r
- break;\r
- }\r
+ ControlFlag = CfReadKey;\r
+ } else if (Index == mScanCodeNumber) {\r
+ //\r
+ // Check whether Key matches the registered hot key.\r
+ //\r
+ HotKey = NULL;\r
+ if ((gBrowserSettingScope == SystemLevel) || (gFunctionKeySetting != NONE_FUNCTION_KEY_SETTING)) {\r
+ HotKey = GetHotKeyFromRegisterList (&Key);\r
+ }\r
+ if (HotKey != NULL) {\r
+ ScreenOperation = UiHotKey;\r
}\r
}\r
break;\r
// We come here when someone press ESC\r
//\r
ControlFlag = CfCheckSelection;\r
- if (FindNextMenu (Selection, &Repaint, &NewLine)) {\r
- return EFI_SUCCESS;\r
- } \r
+ FindNextMenu (Selection, &Repaint, &NewLine);\r
break;\r
\r
case CfUiLeft:\r
NewPos = NewPos->BackLink;\r
\r
PreviousMenuOption = MENU_OPTION_FROM_LINK (NewPos);\r
+ if (PreviousMenuOption->Row == 0) {\r
+ UpdateOptionSkipLines (Selection, PreviousMenuOption);\r
+ }\r
DistanceValue = PreviousMenuOption->Skip;\r
Difference = 0;\r
if (MenuOption->Row >= DistanceValue + TopRow) {\r
- Difference = MoveToNextStatement (TRUE, &NewPos, MenuOption->Row - TopRow - DistanceValue);\r
+ Difference = MoveToNextStatement (Selection, TRUE, &NewPos, MenuOption->Row - TopRow - DistanceValue);\r
}\r
NextMenuOption = MENU_OPTION_FROM_LINK (NewPos);\r
\r
while ((Index >= TopRow) && (Link->BackLink != &gMenuOption)) {\r
Link = Link->BackLink;\r
PreviousMenuOption = MENU_OPTION_FROM_LINK (Link);\r
+ if (PreviousMenuOption->Row == 0) {\r
+ UpdateOptionSkipLines (Selection, PreviousMenuOption);\r
+ } \r
if (Index < PreviousMenuOption->Skip) {\r
Index = 0;\r
break;\r
if (TopOfScreen == &gMenuOption) {\r
TopOfScreen = gMenuOption.ForwardLink;\r
NewPos = gMenuOption.BackLink;\r
- MoveToNextStatement (TRUE, &NewPos, BottomRow - TopRow);\r
+ MoveToNextStatement (Selection, TRUE, &NewPos, BottomRow - TopRow);\r
Repaint = FALSE;\r
} else if (TopOfScreen != Link) {\r
TopOfScreen = Link;\r
NewPos = Link;\r
- MoveToNextStatement (FALSE, &NewPos, BottomRow - TopRow);\r
+ MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow);\r
} else {\r
//\r
// Finally we know that NewPos is the last MenuOption can be focused.\r
//\r
Repaint = FALSE;\r
NewPos = Link;\r
- MoveToNextStatement (FALSE, &NewPos, BottomRow - TopRow);\r
+ MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow);\r
}\r
} else {\r
if (Index + 1 < TopRow) {\r
//\r
if (TopOfScreen == &gMenuOption) {\r
NewPos = gMenuOption.BackLink;\r
- MoveToNextStatement (TRUE, &NewPos, BottomRow - TopRow);\r
+ MoveToNextStatement (Selection, TRUE, &NewPos, BottomRow - TopRow);\r
} else {\r
NewPos = Link;\r
- MoveToNextStatement (FALSE, &NewPos, BottomRow - TopRow);\r
+ MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow);\r
}\r
\r
//\r
// Finally we know that NewPos is the last MenuOption can be focused.\r
//\r
Repaint = FALSE;\r
- MoveToNextStatement (TRUE, &Link, Index - TopRow);\r
+ MoveToNextStatement (Selection, TRUE, &Link, Index - TopRow);\r
} else {\r
if (Index - 1 > BottomRow) {\r
//\r
//\r
// Move to the option in Next page.\r
//\r
- MoveToNextStatement (FALSE, &Link, BottomRow - TopRow);\r
+ MoveToNextStatement (Selection, FALSE, &Link, BottomRow - TopRow);\r
}\r
\r
//\r
\r
Difference = 0;\r
if (BottomRow >= MenuOption->Row + MenuOption->Skip) {\r
- Difference = MoveToNextStatement (FALSE, &NewPos, BottomRow - MenuOption->Row - MenuOption->Skip);\r
+ Difference = MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - MenuOption->Row - MenuOption->Skip);\r
//\r
// We hit the end of MenuOption that can be focused\r
// so we simply scroll to the first page.\r
MenuOption = MENU_OPTION_FROM_LINK (SavedListEntry);\r
}\r
NewPos = gMenuOption.ForwardLink;\r
- MoveToNextStatement (FALSE, &NewPos, BottomRow - TopRow);\r
+ MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow);\r
\r
//\r
// If we are at the end of the list and sitting on a Date/Time op, rewind to the head.\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
+ UpdateOptionSkipLines (Selection, NextMenuOption);\r
DistanceValue = Difference + NextMenuOption->Skip;\r
\r
Temp = MenuOption->Row + MenuOption->Skip + DistanceValue - 1;\r
}\r
NewLine = TRUE;\r
NewPos = gMenuOption.ForwardLink;\r
- MoveToNextStatement (FALSE, &NewPos, BottomRow - TopRow);\r
+ MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow);\r
}\r
\r
//\r
AdjustDateAndTimePosition (TRUE, &NewPos);\r
break;\r
\r
- case CfUiSave:\r
+ case CfUiHotKey:\r
ControlFlag = CfCheckSelection;\r
-\r
+ \r
+ Status = EFI_SUCCESS;\r
//\r
- // Submit the form\r
+ // Discard changes. After it, no NV flag is showed.\r
//\r
- Status = SubmitForm (Selection->FormSet, Selection->Form, FALSE);\r
+ if ((HotKey->Action & BROWSER_ACTION_DISCARD) == BROWSER_ACTION_DISCARD) {\r
+ Status = DiscardForm (Selection->FormSet, Selection->Form, gBrowserSettingScope);\r
+ if (!EFI_ERROR (Status)) {\r
+ Selection->Action = UI_ACTION_REFRESH_FORM;\r
+ Selection->Statement = NULL;\r
+ gResetRequired = FALSE;\r
+ } else {\r
+ do {\r
+ CreateDialog (4, TRUE, 0, NULL, &Key, HotKey->HelpString, gDiscardFailed, gPressEnter, gEmptyString);\r
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+ //\r
+ // Still show current page.\r
+ //\r
+ Selection->Action = UI_ACTION_NONE;\r
+ Repaint = TRUE;\r
+ NewLine = TRUE;\r
+ break;\r
+ }\r
+ }\r
\r
- if (!EFI_ERROR (Status)) {\r
- ASSERT(MenuOption != NULL);\r
- UpdateStatusBar (Selection, INPUT_ERROR, MenuOption->ThisTag->QuestionFlags, FALSE);\r
- UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, MenuOption->ThisTag->QuestionFlags, FALSE);\r
- } else {\r
- do {\r
- CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gSaveFailed, gPressEnter, gEmptyString);\r
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+ //\r
+ // Reterieve default setting. After it. NV flag will be showed.\r
+ //\r
+ if ((HotKey->Action & BROWSER_ACTION_DEFAULT) == BROWSER_ACTION_DEFAULT) {\r
+ Status = ExtractDefault (Selection->FormSet, Selection->Form, HotKey->DefaultId, gBrowserSettingScope);\r
+ if (!EFI_ERROR (Status)) {\r
+ Selection->Action = UI_ACTION_REFRESH_FORM;\r
+ Selection->Statement = NULL;\r
+ gResetRequired = TRUE;\r
+ } else {\r
+ do {\r
+ CreateDialog (4, TRUE, 0, NULL, &Key, HotKey->HelpString, gDefaultFailed, gPressEnter, gEmptyString);\r
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+ //\r
+ // Still show current page.\r
+ //\r
+ Selection->Action = UI_ACTION_NONE;\r
+ Repaint = TRUE;\r
+ NewLine = TRUE;\r
+ break;\r
+ }\r
+ }\r
\r
- Repaint = TRUE;\r
- NewLine = TRUE;\r
+ //\r
+ // Save changes. After it, no NV flag is showed.\r
+ //\r
+ if ((HotKey->Action & BROWSER_ACTION_SUBMIT) == BROWSER_ACTION_SUBMIT) {\r
+ Status = SubmitForm (Selection->FormSet, Selection->Form, gBrowserSettingScope);\r
+ if (!EFI_ERROR (Status)) {\r
+ ASSERT(MenuOption != NULL);\r
+ UpdateStatusBar (Selection, INPUT_ERROR, MenuOption->ThisTag->QuestionFlags, FALSE);\r
+ UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, MenuOption->ThisTag->QuestionFlags, FALSE);\r
+ } else {\r
+ do {\r
+ CreateDialog (4, TRUE, 0, NULL, &Key, HotKey->HelpString, gSaveFailed, gPressEnter, gEmptyString);\r
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+ //\r
+ // Still show current page.\r
+ //\r
+ Selection->Action = UI_ACTION_NONE;\r
+ Repaint = TRUE;\r
+ NewLine = TRUE;\r
+ break;\r
+ }\r
+ }\r
+ \r
+ //\r
+ // Set Reset required Flag\r
+ //\r
+ if ((HotKey->Action & BROWSER_ACTION_RESET) == BROWSER_ACTION_RESET) {\r
+ gResetRequired = TRUE;\r
+ }\r
+ \r
+ //\r
+ // Exit Action\r
+ //\r
+ if ((HotKey->Action & BROWSER_ACTION_EXIT) == BROWSER_ACTION_EXIT) {\r
+ //\r
+ // Form Exit without saving, Similar to ESC Key.\r
+ // FormSet Exit without saving, Exit SendForm.\r
+ // System Exit without saving, CallExitHandler and Exit SendForm.\r
+ //\r
+ DiscardForm (Selection->FormSet, Selection->Form, gBrowserSettingScope);\r
+ if (gBrowserSettingScope == FormLevel) {\r
+ ControlFlag = CfUiReset;\r
+ } else if (gBrowserSettingScope == FormSetLevel) {\r
+ Selection->Action = UI_ACTION_EXIT;\r
+ } else if (gBrowserSettingScope == SystemLevel) {\r
+ if (ExitHandlerFunction != NULL) {\r
+ ExitHandlerFunction ();\r
+ }\r
+ Selection->Action = UI_ACTION_EXIT;\r
+ }\r
+ Selection->Statement = NULL;\r
}\r
break;\r
\r
case CfUiDefault:\r
ControlFlag = CfCheckSelection;\r
//\r
- // Reset to default values for the whole formset\r
+ // Reset to default value for all forms in the whole system.\r
//\r
- Status = ExtractFormSetDefault (Selection->FormSet, DefaultId);\r
+ Status = ExtractDefault (Selection->FormSet, NULL, DefaultId, FormSetLevel);\r
\r
if (!EFI_ERROR (Status)) {\r
Selection->Action = UI_ACTION_REFRESH_FORM;\r
Selection->Statement = NULL;\r
-\r
- //\r
- // Show NV update flag on status bar\r
- //\r
- UpdateNvInfoInForm(Selection->FormSet, TRUE);\r
gResetRequired = TRUE;\r
}\r
break;\r