mirror of https://github.com/acidanthera/audk.git
Enhance EDKII Browser to support flexible HotKey setting.
Signed-off-by: lgao4 Reviewed-by: ydong10 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12336 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
3e710183d1
commit
48a9d5f778
|
@ -0,0 +1,147 @@
|
|||
/** @file
|
||||
Extension Form Browser Protocol provides the services that can be used to
|
||||
register the different hot keys for the standard Browser actions described in UEFI specification.
|
||||
|
||||
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __FORM_BROWSER_EXTENSION_H__
|
||||
#define __FORM_BROWSER_EXTENSION_H__
|
||||
|
||||
#define FORM_BROWSER_EXTENSION_PROTOCOL_GUID \
|
||||
{ 0x1f73b18d, 0x4630, 0x43c1, { 0xa1, 0xde, 0x6f, 0x80, 0x85, 0x5d, 0x7d, 0xa4 } }
|
||||
|
||||
typedef struct _EFI_FORM_BROWSER_EXTENSION_PROTOCOL EFI_FORM_BROWSER_EXTENSION_PROTOCOL;
|
||||
|
||||
//
|
||||
// Return value of EXIT_REMINDER() that describes whether the changed data is saved or discarded.
|
||||
//
|
||||
#define BROWSER_NO_CHANGES 0
|
||||
#define BROWSER_SAVE_CHANGES 1
|
||||
#define BROWSER_DISCARD_CHANGES 2
|
||||
|
||||
//
|
||||
// Browser actions. They can be cominbed together.
|
||||
// If more than one actions are specified, the action with low bit will be executed first.
|
||||
//
|
||||
#define BROWSER_ACTION_UNREGISTER 0
|
||||
#define BROWSER_ACTION_DISCARD BIT0
|
||||
#define BROWSER_ACTION_DEFAULT BIT1
|
||||
#define BROWSER_ACTION_SUBMIT BIT2
|
||||
#define BROWSER_ACTION_RESET BIT3
|
||||
#define BROWSER_ACTION_EXIT BIT4
|
||||
|
||||
//
|
||||
// Scope for Browser action. It may be Form, FormSet or System level.
|
||||
//
|
||||
typedef enum {
|
||||
FormLevel,
|
||||
FormSetLevel,
|
||||
SystemLevel,
|
||||
MaxLevel
|
||||
} BROWSER_SETTING_SCOPE;
|
||||
|
||||
/**
|
||||
Configure what scope the hot key will impact.
|
||||
All hot keys have the same scope. The mixed hot keys with the different level are not supported.
|
||||
If no scope is set, the default scope will be FormSet level.
|
||||
After all registered hot keys are removed, previous Scope can reset to another level.
|
||||
|
||||
@param[in] Scope Scope level to be set.
|
||||
|
||||
@retval EFI_SUCCESS Scope is set correctly.
|
||||
@retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE.
|
||||
@retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SET_SCOPE) (
|
||||
IN BROWSER_SETTING_SCOPE Scope
|
||||
);
|
||||
|
||||
/**
|
||||
Register the hot key with its browser action, or unregistered the hot key.
|
||||
If the action value is zero, the hot key will be unregistered if it has been registered.
|
||||
If the same hot key has been registered, the new action and help string will override the previous ones.
|
||||
|
||||
@param[in] KeyData A pointer to a buffer that describes the keystroke
|
||||
information for the hot key. Its type is EFI_INPUT_KEY to
|
||||
be supported by all ConsoleIn devices.
|
||||
@param[in] Action Action value that describes what action will be trigged when the hot key is pressed.
|
||||
@param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action.
|
||||
@param[in] HelpString Help string that describes the hot key information.
|
||||
Its value may be NULL for the unregistered hot key.
|
||||
|
||||
@retval EFI_SUCCESS Hot key is registered or unregistered.
|
||||
@retval EFI_INVALID_PARAMETER KeyData is NULL.
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *REGISTER_HOT_KEY) (
|
||||
IN EFI_INPUT_KEY *KeyData,
|
||||
IN UINT32 Action,
|
||||
IN UINT16 DefaultId,
|
||||
IN EFI_STRING HelpString OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
This handler is responsbile for the left things on normal boot after all UI forms are closed.
|
||||
For example, it can continue to boot the first boot option.
|
||||
|
||||
It will be used only when EXIT action is trigged as system level.
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EXIT_HANDLER) (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Register Exit handler function.
|
||||
When more than one handler function is registered, the latter one will override the previous one.
|
||||
When NULL handler is specified, the previous Exit handler will be unregistered.
|
||||
|
||||
@param[in] Handler Pointer to handler function.
|
||||
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *REGISTER_EXIT_HANDLER) (
|
||||
IN EXIT_HANDLER Handler
|
||||
);
|
||||
|
||||
/**
|
||||
Create reminder to let user to choose save or discard the changed browser data.
|
||||
Caller can use it to actively check the changed browser data.
|
||||
|
||||
@retval BROWSER_NO_CHANGES No browser data is changed.
|
||||
@retval BROWSER_SAVE_CHANGES The changed browser data is saved.
|
||||
@retval BROWSER_DISCARD_CHANGES The changed browser data is discard.
|
||||
|
||||
**/
|
||||
typedef
|
||||
UINT32
|
||||
(EFIAPI *SAVE_REMINDER)(
|
||||
VOID
|
||||
);
|
||||
|
||||
struct _EFI_FORM_BROWSER_EXTENSION_PROTOCOL {
|
||||
SET_SCOPE SetScope;
|
||||
REGISTER_HOT_KEY RegisterHotKey;
|
||||
REGISTER_EXIT_HANDLER RegiserExitHandler;
|
||||
SAVE_REMINDER SaveReminder;
|
||||
};
|
||||
|
||||
extern EFI_GUID gEfiFormBrowserExProtocolGuid;
|
||||
|
||||
#endif
|
||||
|
|
@ -202,6 +202,9 @@
|
|||
gEfiBootScriptExecutorVariableGuid = { 0x3079818c, 0x46d4, 0x4a73, { 0xae, 0xf3, 0xe3, 0xe4, 0x6c, 0xf1, 0xee, 0xdb }}
|
||||
gEfiBootScriptExecutorContextGuid = { 0x79cb58c4, 0xac51, 0x442f, { 0xaf, 0xd7, 0x98, 0xe4, 0x7d, 0x2e, 0x99, 0x8 }}
|
||||
|
||||
## Include/Guid/UsbKeyBoardLayout.h
|
||||
gUsbKeyboardLayoutPackageGuid = { 0xc0f3b43, 0x44de, 0x4907, { 0xb4, 0x78, 0x22, 0x5f, 0x6f, 0x62, 0x89, 0xdc }}
|
||||
gUsbKeyboardLayoutKeyGuid = { 0x3a4d7a7c, 0x18a, 0x4b42, { 0x81, 0xb3, 0xdc, 0x10, 0xe3, 0xb5, 0x91, 0xbd }}
|
||||
[Ppis]
|
||||
## Include/Ppi/AtaController.h
|
||||
gPeiAtaControllerPpiGuid = { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0, 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }}
|
||||
|
@ -285,6 +288,8 @@
|
|||
## Include/Protocol/LockBox.h
|
||||
gEfiLockBoxProtocolGuid = { 0xbd445d79, 0xb7ad, 0x4f04, { 0x9a, 0xd8, 0x29, 0xbd, 0x20, 0x40, 0xeb, 0x3c }}
|
||||
|
||||
gEfiFormBrowserExProtocolGuid = { 0x1f73b18d, 0x4630, 0x43c1, { 0xa1, 0xde, 0x6f, 0x80, 0x85, 0x5d, 0x7d, 0xa4 } }
|
||||
|
||||
[PcdsFeatureFlag]
|
||||
## Indicate whether platform can support update capsule across a system reset
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportUpdateCapsuleReset|FALSE|BOOLEAN|0x0001001d
|
||||
|
|
|
@ -992,6 +992,7 @@ ParseOpCodes (
|
|||
InitializeListHead (&FormSet->StorageListHead);
|
||||
InitializeListHead (&FormSet->DefaultStoreListHead);
|
||||
InitializeListHead (&FormSet->FormListHead);
|
||||
InitializeListHead (&FormSet->ExpressionListHead);
|
||||
ResetCurrentExpressionStack ();
|
||||
ResetMapExpressionListStack ();
|
||||
|
||||
|
@ -1332,8 +1333,6 @@ ParseOpCodes (
|
|||
FormSet->NumberOfClassGuid = (UINT8) (((EFI_IFR_FORM_SET *) OpCodeData)->Flags & 0x3);
|
||||
CopyMem (FormSet->ClassGuid, OpCodeData + sizeof (EFI_IFR_FORM_SET), FormSet->NumberOfClassGuid * sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
InitializeListHead (&FormSet->ExpressionListHead);
|
||||
break;
|
||||
|
||||
case EFI_IFR_FORM_OP:
|
||||
|
|
|
@ -1060,7 +1060,7 @@ GetSelectionInputPopUp (
|
|||
Start = (DimensionsWidth - PopUpWidth - POPUP_FRAME_WIDTH) / 2 + gScreenDimensions.LeftColumn;
|
||||
End = Start + PopUpWidth + POPUP_FRAME_WIDTH;
|
||||
Top = gScreenDimensions.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT;
|
||||
Bottom = gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT - 1;
|
||||
Bottom = gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight - 1;
|
||||
|
||||
MenuLinesInView = Bottom - Top - 1;
|
||||
if (MenuLinesInView >= PopUpMenuLines) {
|
||||
|
|
|
@ -300,7 +300,7 @@ DisplayPageFrame (
|
|||
ClearLines (
|
||||
LocalScreen.LeftColumn,
|
||||
LocalScreen.RightColumn,
|
||||
LocalScreen.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT,
|
||||
LocalScreen.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight,
|
||||
LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 1,
|
||||
KEYHELP_TEXT | KEYHELP_BACKGROUND
|
||||
);
|
||||
|
@ -348,14 +348,14 @@ DisplayPageFrame (
|
|||
// +------------------------------------------------------------------------------+
|
||||
//
|
||||
Character = BOXDRAW_DOWN_RIGHT;
|
||||
PrintCharAt (LocalScreen.LeftColumn, LocalScreen.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT, Character);
|
||||
PrintCharAt (LocalScreen.LeftColumn, LocalScreen.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight, Character);
|
||||
|
||||
PrintString (Buffer);
|
||||
|
||||
Character = BOXDRAW_DOWN_LEFT;
|
||||
PrintChar (Character);
|
||||
Character = BOXDRAW_VERTICAL;
|
||||
for (Row = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT + 1;
|
||||
for (Row = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight + 1;
|
||||
Row <= LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 2;
|
||||
Row++
|
||||
) {
|
||||
|
@ -583,13 +583,10 @@ InitializeBrowserStrings (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
gFunctionNineString = GetToken (STRING_TOKEN (FUNCTION_NINE_STRING), gHiiHandle);
|
||||
gFunctionTenString = GetToken (STRING_TOKEN (FUNCTION_TEN_STRING), gHiiHandle);
|
||||
gEnterString = GetToken (STRING_TOKEN (ENTER_STRING), gHiiHandle);
|
||||
gEnterCommitString = GetToken (STRING_TOKEN (ENTER_COMMIT_STRING), gHiiHandle);
|
||||
gEnterEscapeString = GetToken (STRING_TOKEN (ENTER_ESCAPE_STRING), gHiiHandle);
|
||||
gEscapeString = GetToken (STRING_TOKEN (ESCAPE_STRING), gHiiHandle);
|
||||
gSaveFailed = GetToken (STRING_TOKEN (SAVE_FAILED), gHiiHandle);
|
||||
gMoveHighlight = GetToken (STRING_TOKEN (MOVE_HIGHLIGHT), gHiiHandle);
|
||||
gMakeSelection = GetToken (STRING_TOKEN (MAKE_SELECTION), gHiiHandle);
|
||||
gDecNumericInput = GetToken (STRING_TOKEN (DEC_NUMERIC_INPUT), gHiiHandle);
|
||||
|
@ -626,8 +623,6 @@ FreeBrowserStrings (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
FreePool (gFunctionNineString);
|
||||
FreePool (gFunctionTenString);
|
||||
FreePool (gEnterString);
|
||||
FreePool (gEnterCommitString);
|
||||
FreePool (gEnterEscapeString);
|
||||
|
@ -658,6 +653,64 @@ FreeBrowserStrings (
|
|||
return ;
|
||||
}
|
||||
|
||||
/**
|
||||
Show all registered HotKey help strings on bottom Rows.
|
||||
|
||||
**/
|
||||
VOID
|
||||
PrintHotKeyHelpString (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINTN CurrentCol;
|
||||
UINTN CurrentRow;
|
||||
UINTN BottomRowOfHotKeyHelp;
|
||||
UINTN ColumnWidth;
|
||||
UINTN Index;
|
||||
EFI_SCREEN_DESCRIPTOR LocalScreen;
|
||||
LIST_ENTRY *Link;
|
||||
BROWSER_HOT_KEY *HotKey;
|
||||
|
||||
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
|
||||
ColumnWidth = (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3;
|
||||
BottomRowOfHotKeyHelp = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 3;
|
||||
|
||||
//
|
||||
// Calculate total number of Register HotKeys.
|
||||
//
|
||||
Index = 0;
|
||||
Link = GetFirstNode (&gBrowserHotKeyList);
|
||||
while (!IsNull (&gBrowserHotKeyList, Link)) {
|
||||
HotKey = BROWSER_HOT_KEY_FROM_LINK (Link);
|
||||
//
|
||||
// Help string can't exceed ColumnWidth. One Row will show three Help information.
|
||||
//
|
||||
if (StrLen (HotKey->HelpString) > ColumnWidth) {
|
||||
HotKey->HelpString[ColumnWidth] = L'\0';
|
||||
}
|
||||
//
|
||||
// Calculate help information Column and Row.
|
||||
//
|
||||
if ((Index % 3) != 2) {
|
||||
CurrentCol = LocalScreen.LeftColumn + (2 - Index % 3) * ColumnWidth;
|
||||
} else {
|
||||
CurrentCol = LocalScreen.LeftColumn + 2;
|
||||
}
|
||||
CurrentRow = BottomRowOfHotKeyHelp - Index / 3;
|
||||
//
|
||||
// Print HotKey help string on bottom Row.
|
||||
//
|
||||
PrintStringAt (CurrentCol, CurrentRow, HotKey->HelpString);
|
||||
|
||||
//
|
||||
// Get Next Hot Key.
|
||||
//
|
||||
Link = GetNextNode (&gBrowserHotKeyList, Link);
|
||||
Index ++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
Update key's help imformation.
|
||||
|
@ -693,13 +746,13 @@ UpdateKeyHelp (
|
|||
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
|
||||
|
||||
SecCol = LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3;
|
||||
ThdCol = LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) * 2 / 3;
|
||||
ThdCol = LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3 * 2;
|
||||
|
||||
StartColumnOfHelp = LocalScreen.LeftColumn + 2;
|
||||
LeftColumnOfHelp = LocalScreen.LeftColumn + 1;
|
||||
RightColumnOfHelp = LocalScreen.RightColumn - 2;
|
||||
TopRowOfHelp = LocalScreen.BottomRow - 4;
|
||||
BottomRowOfHelp = LocalScreen.BottomRow - 3;
|
||||
TopRowOfHelp = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight + 1;
|
||||
BottomRowOfHelp = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 2;
|
||||
|
||||
Statement = MenuOption->ThisTag;
|
||||
switch (Statement->Operand) {
|
||||
|
@ -711,11 +764,15 @@ UpdateKeyHelp (
|
|||
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
|
||||
|
||||
if (!Selected) {
|
||||
//
|
||||
// On system setting, HotKey will show on every form.
|
||||
//
|
||||
if (gBrowserSettingScope == SystemLevel ||
|
||||
(Selection->FormEditable && gFunctionKeySetting != NONE_FUNCTION_KEY_SETTING)) {
|
||||
PrintHotKeyHelpString ();
|
||||
}
|
||||
|
||||
if ((gClassOfVfr & FORMSET_CLASS_PLATFORM_SETUP) == FORMSET_CLASS_PLATFORM_SETUP) {
|
||||
if (Selection->FormEditable) {
|
||||
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
|
||||
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
|
||||
}
|
||||
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
|
||||
}
|
||||
|
||||
|
@ -770,11 +827,14 @@ UpdateKeyHelp (
|
|||
case EFI_IFR_CHECKBOX_OP:
|
||||
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
|
||||
|
||||
//
|
||||
// On system setting, HotKey will show on every form.
|
||||
//
|
||||
if (gBrowserSettingScope == SystemLevel ||
|
||||
(Selection->FormEditable && gFunctionKeySetting != NONE_FUNCTION_KEY_SETTING)) {
|
||||
PrintHotKeyHelpString ();
|
||||
}
|
||||
if ((gClassOfVfr & FORMSET_CLASS_PLATFORM_SETUP) == FORMSET_CLASS_PLATFORM_SETUP) {
|
||||
if (Selection->FormEditable) {
|
||||
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
|
||||
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
|
||||
}
|
||||
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
|
||||
}
|
||||
|
||||
|
@ -792,11 +852,14 @@ UpdateKeyHelp (
|
|||
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
|
||||
|
||||
if (!Selected) {
|
||||
//
|
||||
// On system setting, HotKey will show on every form.
|
||||
//
|
||||
if (gBrowserSettingScope == SystemLevel ||
|
||||
(Selection->FormEditable && gFunctionKeySetting != NONE_FUNCTION_KEY_SETTING)) {
|
||||
PrintHotKeyHelpString ();
|
||||
}
|
||||
if ((gClassOfVfr & FORMSET_CLASS_PLATFORM_SETUP) == FORMSET_CLASS_PLATFORM_SETUP) {
|
||||
if (Selection->FormEditable) {
|
||||
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
|
||||
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
|
||||
}
|
||||
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
|
||||
}
|
||||
|
||||
|
@ -946,6 +1009,55 @@ FindNextMenu (
|
|||
CurrentMenu = Selection->CurrentMenu;
|
||||
|
||||
if (CurrentMenu != NULL && CurrentMenu->Parent != NULL) {
|
||||
//
|
||||
// Form Level Check whether the data is changed.
|
||||
//
|
||||
if (gBrowserSettingScope == FormLevel && Selection->Form->NvUpdateRequired) {
|
||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
|
||||
YesResponse = gYesResponse[0];
|
||||
NoResponse = gNoResponse[0];
|
||||
|
||||
//
|
||||
// If NV flag is up, prompt user
|
||||
//
|
||||
do {
|
||||
CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gSaveChanges, gAreYouSure, gEmptyString);
|
||||
} while
|
||||
(
|
||||
(Key.ScanCode != SCAN_ESC) &&
|
||||
((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (NoResponse | UPPER_LOWER_CASE_OFFSET)) &&
|
||||
((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (YesResponse | UPPER_LOWER_CASE_OFFSET))
|
||||
);
|
||||
|
||||
if (Key.ScanCode == SCAN_ESC) {
|
||||
//
|
||||
// User hits the ESC key, Ingore.
|
||||
//
|
||||
if (Repaint != NULL) {
|
||||
*Repaint = TRUE;
|
||||
}
|
||||
if (NewLine != NULL) {
|
||||
*NewLine = TRUE;
|
||||
}
|
||||
|
||||
Selection->Action = UI_ACTION_NONE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (YesResponse | UPPER_LOWER_CASE_OFFSET)) {
|
||||
//
|
||||
// If the user hits the YesResponse key
|
||||
//
|
||||
Status = SubmitForm (Selection->FormSet, Selection->Form, FormLevel);
|
||||
} else {
|
||||
//
|
||||
// If the user hits the NoResponse key
|
||||
//
|
||||
Status = DiscardForm (Selection->FormSet, Selection->Form, FormLevel);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// we have a parent, so go to the parent menu
|
||||
//
|
||||
|
@ -980,7 +1092,7 @@ FindNextMenu (
|
|||
//
|
||||
// We are going to leave current FormSet, so check uncommited data in this FormSet
|
||||
//
|
||||
if (IsNvUpdateRequired(Selection->FormSet)) {
|
||||
if (gBrowserSettingScope != SystemLevel && IsNvUpdateRequired(Selection->FormSet)) {
|
||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
|
||||
YesResponse = gYesResponse[0];
|
||||
|
@ -1014,11 +1126,16 @@ FindNextMenu (
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// If the user hits the YesResponse key
|
||||
//
|
||||
if ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (YesResponse | UPPER_LOWER_CASE_OFFSET)) {
|
||||
Status = SubmitForm (Selection->FormSet, Selection->Form, FALSE);
|
||||
//
|
||||
// If the user hits the YesResponse key
|
||||
//
|
||||
Status = SubmitForm (Selection->FormSet, Selection->Form, FormSetLevel);
|
||||
} else {
|
||||
//
|
||||
// If the user hits the NoResponse key
|
||||
//
|
||||
Status = DiscardForm (Selection->FormSet, Selection->Form, FormSetLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1060,14 +1177,14 @@ ProcessCallBackFunction (
|
|||
EFI_IFR_TYPE_VALUE *TypeValue;
|
||||
FORM_BROWSER_STATEMENT *Statement;
|
||||
BOOLEAN SubmitFormIsRequired;
|
||||
BOOLEAN SingleForm;
|
||||
BOOLEAN DiscardFormIsRequired;
|
||||
BOOLEAN NeedExit;
|
||||
LIST_ENTRY *Link;
|
||||
BROWSER_SETTING_SCOPE SettingLevel;
|
||||
|
||||
ConfigAccess = Selection->FormSet->ConfigAccess;
|
||||
SubmitFormIsRequired = FALSE;
|
||||
SingleForm = FALSE;
|
||||
SettingLevel = FormSetLevel;
|
||||
DiscardFormIsRequired = FALSE;
|
||||
NeedExit = FALSE;
|
||||
Status = EFI_SUCCESS;
|
||||
|
@ -1139,24 +1256,24 @@ ProcessCallBackFunction (
|
|||
|
||||
case EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT:
|
||||
SubmitFormIsRequired = TRUE;
|
||||
SingleForm = TRUE;
|
||||
SettingLevel = FormLevel;
|
||||
NeedExit = TRUE;
|
||||
break;
|
||||
|
||||
case EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT:
|
||||
DiscardFormIsRequired = TRUE;
|
||||
SingleForm = TRUE;
|
||||
SettingLevel = FormLevel;
|
||||
NeedExit = TRUE;
|
||||
break;
|
||||
|
||||
case EFI_BROWSER_ACTION_REQUEST_FORM_APPLY:
|
||||
SubmitFormIsRequired = TRUE;
|
||||
SingleForm = TRUE;
|
||||
SettingLevel = FormLevel;
|
||||
break;
|
||||
|
||||
case EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD:
|
||||
DiscardFormIsRequired = TRUE;
|
||||
SingleForm = TRUE;
|
||||
SettingLevel = FormLevel;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1179,11 +1296,11 @@ ProcessCallBackFunction (
|
|||
}
|
||||
|
||||
if (SubmitFormIsRequired && !SkipSaveOrDiscard) {
|
||||
SubmitForm (Selection->FormSet, Selection->Form, SingleForm);
|
||||
SubmitForm (Selection->FormSet, Selection->Form, SettingLevel);
|
||||
}
|
||||
|
||||
if (DiscardFormIsRequired && !SkipSaveOrDiscard) {
|
||||
DiscardForm (Selection->FormSet, Selection->Form, SingleForm);
|
||||
DiscardForm (Selection->FormSet, Selection->Form, SettingLevel);
|
||||
}
|
||||
|
||||
if (NeedExit) {
|
||||
|
@ -1216,12 +1333,9 @@ SetupBrowser (
|
|||
EFI_HANDLE NotifyHandle;
|
||||
FORM_BROWSER_STATEMENT *Statement;
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
|
||||
FORM_BROWSER_FORMSET *FormSet;
|
||||
EFI_INPUT_KEY Key;
|
||||
|
||||
gMenuRefreshHead = NULL;
|
||||
gResetRequired = FALSE;
|
||||
FormSet = Selection->FormSet;
|
||||
ConfigAccess = Selection->FormSet->ConfigAccess;
|
||||
|
||||
//
|
||||
|
@ -1247,6 +1361,17 @@ SetupBrowser (
|
|||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
// Update gOldFormSet on maintain back up FormSet list.
|
||||
// And, make gOldFormSet point to current FormSet.
|
||||
//
|
||||
if (gOldFormSet != NULL) {
|
||||
RemoveEntryList (&gOldFormSet->Link);
|
||||
DestroyFormSet (gOldFormSet);
|
||||
}
|
||||
gOldFormSet = Selection->FormSet;
|
||||
InsertTailList (&gBrowserFormSetList, &gOldFormSet->Link);
|
||||
|
||||
do {
|
||||
//
|
||||
// Initialize Selection->Form
|
||||
|
@ -1442,14 +1567,6 @@ SetupBrowser (
|
|||
}
|
||||
} while (Selection->Action == UI_ACTION_REFRESH_FORM);
|
||||
|
||||
//
|
||||
// Record the old formset
|
||||
//
|
||||
if (gOldFormSet != NULL) {
|
||||
DestroyFormSet (gOldFormSet);
|
||||
}
|
||||
gOldFormSet = FormSet;
|
||||
|
||||
Done:
|
||||
//
|
||||
// Reset current form information to the initial setting when error happens or form exit.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include <Protocol/SimpleTextOut.h>
|
||||
#include <Protocol/SimpleTextIn.h>
|
||||
#include <Protocol/FormBrowser2.h>
|
||||
#include <Protocol/FormBrowserEx.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/UnicodeCollation.h>
|
||||
#include <Protocol/HiiConfigAccess.h>
|
||||
|
@ -74,10 +75,7 @@ extern UINT8 SetupBrowserStrings[];
|
|||
// Definition for function key setting
|
||||
//
|
||||
#define NONE_FUNCTION_KEY_SETTING 0
|
||||
#define DEFAULT_FUNCTION_KEY_SETTING (FUNCTION_NINE | FUNCTION_TEN)
|
||||
|
||||
#define FUNCTION_NINE (1 << 2)
|
||||
#define FUNCTION_TEN (1 << 3)
|
||||
#define ENABLE_FUNCTION_KEY_SETTING 1
|
||||
|
||||
typedef struct {
|
||||
EFI_GUID FormSetGuid;
|
||||
|
@ -164,7 +162,9 @@ typedef struct {
|
|||
//
|
||||
// Produced protocol
|
||||
//
|
||||
EFI_FORM_BROWSER2_PROTOCOL FormBrowser2;
|
||||
EFI_FORM_BROWSER2_PROTOCOL FormBrowser2;
|
||||
|
||||
EFI_FORM_BROWSER_EXTENSION_PROTOCOL FormBrowserEx;
|
||||
|
||||
} SETUP_DRIVER_PRIVATE_DATA;
|
||||
|
||||
|
@ -448,8 +448,12 @@ typedef struct {
|
|||
|
||||
#define FORMSET_DEFAULTSTORE_FROM_LINK(a) CR (a, FORMSET_DEFAULTSTORE, Link, FORMSET_DEFAULTSTORE_SIGNATURE)
|
||||
|
||||
#define FORM_BROWSER_FORMSET_SIGNATURE SIGNATURE_32 ('F', 'B', 'F', 'S')
|
||||
|
||||
typedef struct {
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
EFI_HII_HANDLE HiiHandle; // unique id for formset.
|
||||
EFI_HANDLE DriverHandle;
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
@ -475,6 +479,8 @@ typedef struct {
|
|||
LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)
|
||||
} FORM_BROWSER_FORMSET;
|
||||
|
||||
#define FORM_BROWSER_FORMSET_FROM_LINK(a) CR (a, FORM_BROWSER_FORMSET, Link, FORM_BROWSER_FORMSET_SIGNATURE)
|
||||
|
||||
#define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')
|
||||
|
||||
typedef struct {
|
||||
|
@ -490,13 +496,10 @@ typedef struct {
|
|||
BOOLEAN ResetRequired;
|
||||
UINT16 Direction;
|
||||
EFI_SCREEN_DESCRIPTOR ScreenDimensions;
|
||||
CHAR16 *FunctionNineString;
|
||||
CHAR16 *FunctionTenString;
|
||||
CHAR16 *EnterString;
|
||||
CHAR16 *EnterCommitString;
|
||||
CHAR16 *EnterEscapeString;
|
||||
CHAR16 *EscapeString;
|
||||
CHAR16 *SaveFailed;
|
||||
CHAR16 *MoveHighlight;
|
||||
CHAR16 *MakeSelection;
|
||||
CHAR16 *DecNumericInput;
|
||||
|
@ -534,6 +537,20 @@ typedef struct {
|
|||
|
||||
#define BROWSER_CONTEXT_FROM_LINK(a) CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)
|
||||
|
||||
#define BROWSER_HOT_KEY_SIGNATURE SIGNATURE_32 ('B', 'H', 'K', 'S')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
EFI_INPUT_KEY *KeyData;
|
||||
IN UINT32 Action;
|
||||
IN UINT16 DefaultId;
|
||||
IN EFI_STRING HelpString;
|
||||
} BROWSER_HOT_KEY;
|
||||
|
||||
#define BROWSER_HOT_KEY_FROM_LINK(a) CR (a, BROWSER_HOT_KEY, Link, BROWSER_HOT_KEY_SIGNATURE)
|
||||
|
||||
extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
|
||||
extern EFI_HII_STRING_PROTOCOL *mHiiString;
|
||||
extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;
|
||||
|
@ -548,12 +565,17 @@ extern UINT16 gDirection;
|
|||
extern EFI_SCREEN_DESCRIPTOR gScreenDimensions;
|
||||
|
||||
extern FORM_BROWSER_FORMSET *gOldFormSet;
|
||||
extern LIST_ENTRY gBrowserFormSetList;
|
||||
extern LIST_ENTRY gBrowserHotKeyList;
|
||||
extern BROWSER_SETTING_SCOPE gBrowserSettingScope;
|
||||
extern EXIT_HANDLER ExitHandlerFunction;
|
||||
extern UINTN gFooterHeight;
|
||||
|
||||
//
|
||||
// Browser Global Strings
|
||||
//
|
||||
extern CHAR16 *gFunctionNineString;
|
||||
extern CHAR16 *gFunctionTenString;
|
||||
extern CHAR16 *gDiscardFailed;
|
||||
extern CHAR16 *gDefaultFailed;
|
||||
extern CHAR16 *gEnterString;
|
||||
extern CHAR16 *gEnterCommitString;
|
||||
extern CHAR16 *gEnterEscapeString;
|
||||
|
@ -924,38 +946,41 @@ ValidateQuestion (
|
|||
IN UINTN Type
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Discard data for form level or formset level.
|
||||
Discard data based on the input setting scope (Form, FormSet or System).
|
||||
|
||||
@param FormSet FormSet data structure.
|
||||
@param Form Form data structure.
|
||||
@param SingleForm whether submit single form or formset.
|
||||
@param SettingScope Setting Scope for Discard action.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_UNSUPPORTED Unsupport SettingScope.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
DiscardForm (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN BOOLEAN SingleForm
|
||||
IN BROWSER_SETTING_SCOPE SettingScope
|
||||
);
|
||||
|
||||
/**
|
||||
Submit data for form level or formset level.
|
||||
Submit data based on the input Setting level (Form, FormSet or System).
|
||||
|
||||
@param FormSet FormSet data structure.
|
||||
@param Form Form data structure.
|
||||
@param SingleForm whether submit single form or formset.
|
||||
@param SettingScope Setting Scope for Submit action.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_UNSUPPORTED Unsupport SettingScope.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SubmitForm (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN BOOLEAN SingleForm
|
||||
IN BROWSER_SETTING_SCOPE SettingScope
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1011,18 +1036,23 @@ InitializeFormSet (
|
|||
);
|
||||
|
||||
/**
|
||||
Reset Questions in a Formset to their default value.
|
||||
Reset Questions to their default value in a Form, Formset or System.
|
||||
|
||||
@param FormSet FormSet data structure.
|
||||
@param Form Form data structure.
|
||||
@param DefaultId The Class of the default.
|
||||
@param SettingScope Setting Scope for Default action.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_UNSUPPORTED Unsupport SettingScope.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
ExtractFormSetDefault (
|
||||
ExtractDefault (
|
||||
IN FORM_BROWSER_FORMSET *FormSet,
|
||||
IN UINT16 DefaultId
|
||||
IN FORM_BROWSER_FORM *Form,
|
||||
IN UINT16 DefaultId,
|
||||
IN BROWSER_SETTING_SCOPE SettingScope
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1300,4 +1330,121 @@ ProcessCallBackFunction (
|
|||
IN EFI_BROWSER_ACTION Action,
|
||||
IN BOOLEAN SkipSaveOrDiscard
|
||||
);
|
||||
|
||||
/**
|
||||
Find the matched FormSet context in the backup maintain list based on HiiHandle.
|
||||
|
||||
@param Handle The Hii Handle.
|
||||
|
||||
@return the found FormSet context. If no found, NULL will return.
|
||||
|
||||
**/
|
||||
FORM_BROWSER_FORMSET *
|
||||
GetFormSetFromHiiHandle (
|
||||
EFI_HII_HANDLE Handle
|
||||
);
|
||||
|
||||
/**
|
||||
Check whether the input HII handle is the FormSet that is being used.
|
||||
|
||||
@param Handle The Hii Handle.
|
||||
|
||||
@retval TRUE HII handle is being used.
|
||||
@retval FALSE HII handle is not being used.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
IsHiiHandleInBrowserContext (
|
||||
EFI_HII_HANDLE Handle
|
||||
);
|
||||
|
||||
/**
|
||||
Configure what scope the hot key will impact.
|
||||
All hot keys have the same scope. The mixed hot keys with the different level are not supported.
|
||||
If no scope is set, the default scope will be FormSet level.
|
||||
After all registered hot keys are removed, previous Scope can reset to another level.
|
||||
|
||||
@param[in] Scope Scope level to be set.
|
||||
|
||||
@retval EFI_SUCCESS Scope is set correctly.
|
||||
@retval EFI_INVALID_PARAMETER Scope is not the valid value specified in BROWSER_SETTING_SCOPE.
|
||||
@retval EFI_UNSPPORTED Scope level is different from current one that the registered hot keys have.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SetScope (
|
||||
IN BROWSER_SETTING_SCOPE Scope
|
||||
);
|
||||
|
||||
/**
|
||||
Register the hot key with its browser action, or unregistered the hot key.
|
||||
Only support hot key that is not printable character (control key, function key, etc.).
|
||||
If the action value is zero, the hot key will be unregistered if it has been registered.
|
||||
If the same hot key has been registered, the new action and help string will override the previous ones.
|
||||
|
||||
@param[in] KeyData A pointer to a buffer that describes the keystroke
|
||||
information for the hot key. Its type is EFI_INPUT_KEY to
|
||||
be supported by all ConsoleIn devices.
|
||||
@param[in] Action Action value that describes what action will be trigged when the hot key is pressed.
|
||||
@param[in] DefaultId Specifies the type of defaults to retrieve, which is only for DEFAULT action.
|
||||
@param[in] HelpString Help string that describes the hot key information.
|
||||
Its value may be NULL for the unregistered hot key.
|
||||
|
||||
@retval EFI_SUCCESS Hot key is registered or unregistered.
|
||||
@retval EFI_INVALID_PARAMETER KeyData is NULL.
|
||||
@retval EFI_NOT_FOUND KeyData is not found to be unregistered.
|
||||
@retval EFI_UNSUPPORTED Key represents a printable character. It is conflicted with Browser.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
RegisterHotKey (
|
||||
IN EFI_INPUT_KEY *KeyData,
|
||||
IN UINT32 Action,
|
||||
IN UINT16 DefaultId,
|
||||
IN EFI_STRING HelpString OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Register Exit handler function.
|
||||
When more than one handler function is registered, the latter one will override the previous one.
|
||||
When NULL handler is specified, the previous Exit handler will be unregistered.
|
||||
|
||||
@param[in] Handler Pointer to handler function.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
RegiserExitHandler (
|
||||
IN EXIT_HANDLER Handler
|
||||
);
|
||||
|
||||
/**
|
||||
Create reminder to let user to choose save or discard the changed browser data.
|
||||
Caller can use it to actively check the changed browser data.
|
||||
|
||||
@retval BROWSER_NO_CHANGES No browser data is changed.
|
||||
@retval BROWSER_SAVE_CHANGES The changed browser data is saved.
|
||||
@retval BROWSER_DISCARD_CHANGES The changed browser data is discard.
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
SaveReminder (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Find the registered HotKey based on KeyData.
|
||||
|
||||
@param[in] KeyData A pointer to a buffer that describes the keystroke
|
||||
information for the hot key.
|
||||
|
||||
@return The registered HotKey context. If no found, NULL will return.
|
||||
**/
|
||||
BROWSER_HOT_KEY *
|
||||
GetHotKeyFromRegisterList (
|
||||
IN EFI_INPUT_KEY *KeyData
|
||||
);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
gEfiHiiConfigAccessProtocolGuid ## CONSUMES
|
||||
gEfiHiiStringProtocolGuid ## CONSUMES
|
||||
gEfiFormBrowser2ProtocolGuid ## PRODUCES
|
||||
gEfiFormBrowserExProtocolGuid ## PRODUCES
|
||||
gEfiHiiConfigRoutingProtocolGuid ## CONSUMES
|
||||
gEfiHiiDatabaseProtocolGuid ## CONSUMES
|
||||
gEfiUnicodeCollation2ProtocolGuid ## CONSUMES
|
||||
|
|
Binary file not shown.
|
@ -50,26 +50,16 @@ SCAN_CODE_TO_SCREEN_OPERATION gScanCodeToOperation[] = {
|
|||
{
|
||||
SCAN_RIGHT,
|
||||
UiRight,
|
||||
},
|
||||
{
|
||||
SCAN_F9,
|
||||
UiDefault,
|
||||
},
|
||||
{
|
||||
SCAN_F10,
|
||||
UiSave
|
||||
}
|
||||
};
|
||||
|
||||
UINTN mScanCodeNumber = sizeof (gScanCodeToOperation) / sizeof (gScanCodeToOperation[0]);
|
||||
|
||||
SCREEN_OPERATION_T0_CONTROL_FLAG gScreenOperationToControlFlag[] = {
|
||||
{
|
||||
UiNoOperation,
|
||||
CfUiNoOperation,
|
||||
},
|
||||
{
|
||||
UiDefault,
|
||||
CfUiDefault,
|
||||
},
|
||||
{
|
||||
UiSelect,
|
||||
CfUiSelect,
|
||||
|
@ -94,10 +84,6 @@ SCREEN_OPERATION_T0_CONTROL_FLAG gScreenOperationToControlFlag[] = {
|
|||
UiReset,
|
||||
CfUiReset,
|
||||
},
|
||||
{
|
||||
UiSave,
|
||||
CfUiSave,
|
||||
},
|
||||
{
|
||||
UiPageUp,
|
||||
CfUiPageUp,
|
||||
|
@ -105,6 +91,10 @@ SCREEN_OPERATION_T0_CONTROL_FLAG gScreenOperationToControlFlag[] = {
|
|||
{
|
||||
UiPageDown,
|
||||
CfUiPageDown
|
||||
},
|
||||
{
|
||||
UiHotKey,
|
||||
CfUiHotKey
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1057,7 +1047,10 @@ UpdateStatusBar (
|
|||
UINTN Index;
|
||||
CHAR16 *NvUpdateMessage;
|
||||
CHAR16 *InputErrorMessage;
|
||||
|
||||
LIST_ENTRY *Link;
|
||||
FORM_BROWSER_FORMSET *LocalFormSet;
|
||||
FORM_BROWSER_STATEMENT *Question;
|
||||
|
||||
NvUpdateMessage = GetToken (STRING_TOKEN (NV_UPDATE_MESSAGE), gHiiHandle);
|
||||
InputErrorMessage = GetToken (STRING_TOKEN (INPUT_ERROR_MESSAGE), gHiiHandle);
|
||||
|
||||
|
@ -1082,32 +1075,38 @@ UpdateStatusBar (
|
|||
break;
|
||||
|
||||
case NV_UPDATE_REQUIRED:
|
||||
if ((gClassOfVfr & FORMSET_CLASS_FRONT_PAGE) != FORMSET_CLASS_FRONT_PAGE) {
|
||||
if (State) {
|
||||
//
|
||||
// Global setting support. Show configuration change on every form.
|
||||
//
|
||||
if (State) {
|
||||
gResetRequired = (BOOLEAN) (gResetRequired | ((Flags & EFI_IFR_FLAG_RESET_REQUIRED) == EFI_IFR_FLAG_RESET_REQUIRED));
|
||||
|
||||
if (Selection != NULL && Selection->Statement != NULL) {
|
||||
Question = Selection->Statement;
|
||||
if (Question->Storage != NULL || Question->Operand == EFI_IFR_DATE_OP || Question->Operand == EFI_IFR_TIME_OP) {
|
||||
//
|
||||
// Update only for Question value that need to be saved into Storage.
|
||||
//
|
||||
Selection->Form->NvUpdateRequired = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (Selection == NULL || IsNvUpdateRequired (Selection->FormSet)) {
|
||||
gST->ConOut->SetAttribute (gST->ConOut, INFO_TEXT);
|
||||
PrintStringAt (
|
||||
gScreenDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth,
|
||||
gScreenDimensions.BottomRow - 1,
|
||||
NvUpdateMessage
|
||||
);
|
||||
gResetRequired = (BOOLEAN) (gResetRequired | ((Flags & EFI_IFR_FLAG_RESET_REQUIRED) == EFI_IFR_FLAG_RESET_REQUIRED));
|
||||
|
||||
if (Selection != NULL) {
|
||||
Selection->Form->NvUpdateRequired = TRUE;
|
||||
}
|
||||
} else {
|
||||
gST->ConOut->SetAttribute (gST->ConOut, PcdGet8 (PcdBrowserFieldTextHighlightColor));
|
||||
for (Index = 0; Index < (GetStringWidth (NvUpdateMessage) - 2) / 2; Index++) {
|
||||
PrintAt (
|
||||
(gScreenDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + Index),
|
||||
gScreenDimensions.BottomRow - 1,
|
||||
L" "
|
||||
);
|
||||
}
|
||||
|
||||
if (Selection != NULL) {
|
||||
Selection->Form->NvUpdateRequired = FALSE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gST->ConOut->SetAttribute (gST->ConOut, PcdGet8 (PcdBrowserFieldTextHighlightColor));
|
||||
for (Index = 0; Index < (GetStringWidth (NvUpdateMessage) - 2) / 2; Index++) {
|
||||
PrintAt (
|
||||
(gScreenDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + Index),
|
||||
gScreenDimensions.BottomRow - 1,
|
||||
L" "
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1117,9 +1116,28 @@ UpdateStatusBar (
|
|||
UpdateStatusBar (Selection, INPUT_ERROR, Flags, TRUE);
|
||||
}
|
||||
|
||||
if (IsNvUpdateRequired(Selection->FormSet)) {
|
||||
UpdateStatusBar (NULL, NV_UPDATE_REQUIRED, Flags, TRUE);
|
||||
switch (gBrowserSettingScope) {
|
||||
case SystemLevel:
|
||||
//
|
||||
// Check the maintain list to see whether there is any change.
|
||||
//
|
||||
Link = GetFirstNode (&gBrowserFormSetList);
|
||||
while (!IsNull (&gBrowserFormSetList, Link)) {
|
||||
LocalFormSet = FORM_BROWSER_FORMSET_FROM_LINK (Link);
|
||||
if (IsNvUpdateRequired(LocalFormSet)) {
|
||||
UpdateStatusBar (NULL, NV_UPDATE_REQUIRED, Flags, TRUE);
|
||||
break;
|
||||
}
|
||||
Link = GetNextNode (&gBrowserFormSetList, Link);
|
||||
}
|
||||
break;
|
||||
case FormSetLevel:
|
||||
case FormLevel:
|
||||
UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Flags, TRUE);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1877,6 +1895,7 @@ UiDisplayMenu (
|
|||
FORM_BROWSER_STATEMENT *Statement;
|
||||
UI_MENU_LIST *CurrentMenu;
|
||||
UINTN ModalSkipColumn;
|
||||
BROWSER_HOT_KEY *HotKey;
|
||||
|
||||
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
|
||||
|
||||
|
@ -1898,6 +1917,7 @@ UiDisplayMenu (
|
|||
NextMenuOption = NULL;
|
||||
PreviousMenuOption = NULL;
|
||||
SavedMenuOption = NULL;
|
||||
HotKey = NULL;
|
||||
ModalSkipColumn = (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 6;
|
||||
|
||||
ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
|
||||
|
@ -1916,7 +1936,7 @@ UiDisplayMenu (
|
|||
Col = LocalScreen.LeftColumn + LEFT_SKIPPED_COLUMNS;
|
||||
}
|
||||
|
||||
BottomRow = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT - SCROLL_ARROW_HEIGHT - 1;
|
||||
BottomRow = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight - SCROLL_ARROW_HEIGHT - 1;
|
||||
|
||||
Selection->TopRow = TopRow;
|
||||
Selection->BottomRow = BottomRow;
|
||||
|
@ -2620,8 +2640,9 @@ UiDisplayMenu (
|
|||
//
|
||||
// IFR is updated in Callback of refresh opcode, re-parse it
|
||||
//
|
||||
ControlFlag = CfCheckSelection;
|
||||
Selection->Statement = NULL;
|
||||
return EFI_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
|
@ -2709,30 +2730,28 @@ UiDisplayMenu (
|
|||
break;
|
||||
|
||||
case CHAR_NULL:
|
||||
if (((Key.ScanCode == SCAN_F9) && ((gFunctionKeySetting & FUNCTION_NINE) != FUNCTION_NINE)) ||
|
||||
((Key.ScanCode == SCAN_F10) && ((gFunctionKeySetting & FUNCTION_TEN) != FUNCTION_TEN))
|
||||
) {
|
||||
for (Index = 0; Index < mScanCodeNumber; Index++) {
|
||||
if (Key.ScanCode == gScanCodeToOperation[Index].ScanCode) {
|
||||
ScreenOperation = gScanCodeToOperation[Index].ScreenOperation;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Selection->Form->ModalForm && (Key.ScanCode == SCAN_ESC || Index == mScanCodeNumber)) {
|
||||
//
|
||||
// If the function key has been disabled, just ignore the key.
|
||||
// ModalForm has no ESC key and Hot Key.
|
||||
//
|
||||
} else {
|
||||
for (Index = 0; Index < sizeof (gScanCodeToOperation) / sizeof (gScanCodeToOperation[0]); Index++) {
|
||||
if (Selection->Form->ModalForm &&
|
||||
(Key.ScanCode == SCAN_F9 || Key.ScanCode == SCAN_F10 || Key.ScanCode == SCAN_ESC)) {
|
||||
ControlFlag = CfReadKey;
|
||||
break;
|
||||
}
|
||||
|
||||
if (Key.ScanCode == gScanCodeToOperation[Index].ScanCode) {
|
||||
if (Key.ScanCode == SCAN_F9) {
|
||||
//
|
||||
// Reset to standard default
|
||||
//
|
||||
DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
|
||||
}
|
||||
ScreenOperation = gScanCodeToOperation[Index].ScreenOperation;
|
||||
break;
|
||||
}
|
||||
ControlFlag = CfReadKey;
|
||||
} else if (Index == mScanCodeNumber) {
|
||||
//
|
||||
// Check whether Key matches the registered hot key.
|
||||
//
|
||||
HotKey = NULL;
|
||||
if ((gBrowserSettingScope == SystemLevel) || (gFunctionKeySetting != NONE_FUNCTION_KEY_SETTING)) {
|
||||
HotKey = GetHotKeyFromRegisterList (&Key);
|
||||
}
|
||||
if (HotKey != NULL) {
|
||||
ScreenOperation = UiHotKey;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2832,9 +2851,7 @@ UiDisplayMenu (
|
|||
// We come here when someone press ESC
|
||||
//
|
||||
ControlFlag = CfCheckSelection;
|
||||
if (FindNextMenu (Selection, &Repaint, &NewLine)) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
FindNextMenu (Selection, &Repaint, &NewLine);
|
||||
break;
|
||||
|
||||
case CfUiLeft:
|
||||
|
@ -3252,43 +3269,120 @@ UiDisplayMenu (
|
|||
AdjustDateAndTimePosition (TRUE, &NewPos);
|
||||
break;
|
||||
|
||||
case CfUiSave:
|
||||
case CfUiHotKey:
|
||||
ControlFlag = CfCheckSelection;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
//
|
||||
// Discard changes. After it, no NV flag is showed.
|
||||
//
|
||||
if ((HotKey->Action & BROWSER_ACTION_DISCARD) == BROWSER_ACTION_DISCARD) {
|
||||
Status = DiscardForm (Selection->FormSet, Selection->Form, gBrowserSettingScope);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Selection->Action = UI_ACTION_REFRESH_FORM;
|
||||
Selection->Statement = NULL;
|
||||
gResetRequired = FALSE;
|
||||
} else {
|
||||
do {
|
||||
CreateDialog (4, TRUE, 0, NULL, &Key, HotKey->HelpString, gDiscardFailed, gPressEnter, gEmptyString);
|
||||
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
|
||||
//
|
||||
// Still show current page.
|
||||
//
|
||||
Selection->Action = UI_ACTION_NONE;
|
||||
Repaint = TRUE;
|
||||
NewLine = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Submit the form
|
||||
// Reterieve default setting. After it. NV flag will be showed.
|
||||
//
|
||||
Status = SubmitForm (Selection->FormSet, Selection->Form, FALSE);
|
||||
if ((HotKey->Action & BROWSER_ACTION_DEFAULT) == BROWSER_ACTION_DEFAULT) {
|
||||
Status = ExtractDefault (Selection->FormSet, Selection->Form, HotKey->DefaultId, gBrowserSettingScope);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Selection->Action = UI_ACTION_REFRESH_FORM;
|
||||
Selection->Statement = NULL;
|
||||
gResetRequired = TRUE;
|
||||
} else {
|
||||
do {
|
||||
CreateDialog (4, TRUE, 0, NULL, &Key, HotKey->HelpString, gDefaultFailed, gPressEnter, gEmptyString);
|
||||
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
|
||||
//
|
||||
// Still show current page.
|
||||
//
|
||||
Selection->Action = UI_ACTION_NONE;
|
||||
Repaint = TRUE;
|
||||
NewLine = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ASSERT(MenuOption != NULL);
|
||||
UpdateStatusBar (Selection, INPUT_ERROR, MenuOption->ThisTag->QuestionFlags, FALSE);
|
||||
UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, MenuOption->ThisTag->QuestionFlags, FALSE);
|
||||
} else {
|
||||
do {
|
||||
CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gSaveFailed, gPressEnter, gEmptyString);
|
||||
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
|
||||
|
||||
Repaint = TRUE;
|
||||
NewLine = TRUE;
|
||||
//
|
||||
// Save changes. After it, no NV flag is showed.
|
||||
//
|
||||
if ((HotKey->Action & BROWSER_ACTION_SUBMIT) == BROWSER_ACTION_SUBMIT) {
|
||||
Status = SubmitForm (Selection->FormSet, Selection->Form, gBrowserSettingScope);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ASSERT(MenuOption != NULL);
|
||||
UpdateStatusBar (Selection, INPUT_ERROR, MenuOption->ThisTag->QuestionFlags, FALSE);
|
||||
UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, MenuOption->ThisTag->QuestionFlags, FALSE);
|
||||
} else {
|
||||
do {
|
||||
CreateDialog (4, TRUE, 0, NULL, &Key, HotKey->HelpString, gSaveFailed, gPressEnter, gEmptyString);
|
||||
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
|
||||
//
|
||||
// Still show current page.
|
||||
//
|
||||
Selection->Action = UI_ACTION_NONE;
|
||||
Repaint = TRUE;
|
||||
NewLine = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Set Reset required Flag
|
||||
//
|
||||
if ((HotKey->Action & BROWSER_ACTION_RESET) == BROWSER_ACTION_RESET) {
|
||||
gResetRequired = TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Exit Action
|
||||
//
|
||||
if ((HotKey->Action & BROWSER_ACTION_EXIT) == BROWSER_ACTION_EXIT) {
|
||||
//
|
||||
// Form Exit without saving, Similar to ESC Key.
|
||||
// FormSet Exit without saving, Exit SendForm.
|
||||
// System Exit without saving, CallExitHandler and Exit SendForm.
|
||||
//
|
||||
DiscardForm (Selection->FormSet, Selection->Form, gBrowserSettingScope);
|
||||
if (gBrowserSettingScope == FormLevel) {
|
||||
ControlFlag = CfUiReset;
|
||||
} else if (gBrowserSettingScope == FormSetLevel) {
|
||||
Selection->Action = UI_ACTION_EXIT;
|
||||
} else if (gBrowserSettingScope == SystemLevel) {
|
||||
if (ExitHandlerFunction != NULL) {
|
||||
ExitHandlerFunction ();
|
||||
}
|
||||
Selection->Action = UI_ACTION_EXIT;
|
||||
}
|
||||
Selection->Statement = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case CfUiDefault:
|
||||
ControlFlag = CfCheckSelection;
|
||||
//
|
||||
// Reset to default values for the whole formset
|
||||
// Reset to default value for all forms in the whole system.
|
||||
//
|
||||
Status = ExtractFormSetDefault (Selection->FormSet, DefaultId);
|
||||
Status = ExtractDefault (Selection->FormSet, NULL, DefaultId, FormSetLevel);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Selection->Action = UI_ACTION_REFRESH_FORM;
|
||||
Selection->Statement = NULL;
|
||||
|
||||
//
|
||||
// Show NV update flag on status bar
|
||||
//
|
||||
UpdateNvInfoInForm(Selection->FormSet, TRUE);
|
||||
gResetRequired = TRUE;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -33,17 +33,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
typedef enum {
|
||||
UiNoOperation,
|
||||
UiDefault,
|
||||
UiSelect,
|
||||
UiUp,
|
||||
UiDown,
|
||||
UiLeft,
|
||||
UiRight,
|
||||
UiReset,
|
||||
UiSave,
|
||||
UiPrevious,
|
||||
UiPageUp,
|
||||
UiPageDown,
|
||||
UiHotKey,
|
||||
UiMaxOperation
|
||||
} UI_SCREEN_OPERATION;
|
||||
|
||||
|
@ -64,10 +63,10 @@ typedef enum {
|
|||
CfUiPageUp,
|
||||
CfUiPageDown,
|
||||
CfUiDown,
|
||||
CfUiSave,
|
||||
CfUiDefault,
|
||||
CfUiNoOperation,
|
||||
CfExit,
|
||||
CfUiHotKey,
|
||||
CfMaxControlFlag
|
||||
} UI_CONTROL_FLAG;
|
||||
|
||||
|
|
Loading…
Reference in New Issue