Change the FormBrowser behavior of "Pressing ESC":
The old behavior is: if press ESC, it will exit the whole Formset. The new behavior is: if press ESC, it will return to the parent Form; if current Form is the root Form of a FormSet, it will exit the whole FormSet. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9359 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -106,7 +106,7 @@ NewStrCat (
|
|||||||
|
|
||||||
This function handles the Unicode string with NARROW_CHAR
|
This function handles the Unicode string with NARROW_CHAR
|
||||||
and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
|
and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
|
||||||
does not count in the resultant output. If a WIDE_CHAR is
|
does not count in the resultant output. If a WIDE_CHAR is
|
||||||
hit, then 2 Unicode character will consume an output storage
|
hit, then 2 Unicode character will consume an output storage
|
||||||
space with size of CHAR16 till a NARROW_CHAR is hit.
|
space with size of CHAR16 till a NARROW_CHAR is hit.
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ DisplayPageFrame (
|
|||||||
|
|
||||||
ASSERT (RowIdx < BANNER_HEIGHT);
|
ASSERT (RowIdx < BANNER_HEIGHT);
|
||||||
ASSERT (ColumnIdx < BANNER_COLUMNS);
|
ASSERT (ColumnIdx < BANNER_COLUMNS);
|
||||||
|
|
||||||
if (gBannerData->Banner[RowIdx][ColumnIdx] != 0x0000) {
|
if (gBannerData->Banner[RowIdx][ColumnIdx] != 0x0000) {
|
||||||
StrFrontPageBanner = GetToken (
|
StrFrontPageBanner = GetToken (
|
||||||
gBannerData->Banner[RowIdx][ColumnIdx],
|
gBannerData->Banner[RowIdx][ColumnIdx],
|
||||||
@ -406,7 +406,7 @@ EvaluateFormExpressions (
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
+------------------------------------------------------------------------------+
|
+------------------------------------------------------------------------------+
|
||||||
?F2=Previous Page Setup Page ?
|
? Setup Page ?
|
||||||
+------------------------------------------------------------------------------+
|
+------------------------------------------------------------------------------+
|
||||||
|
|
||||||
|
|
||||||
@ -433,9 +433,9 @@ EvaluateFormExpressions (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
|
|
||||||
Display form and wait for user to select one menu option, then return it.
|
Display form and wait for user to select one menu option, then return it.
|
||||||
|
|
||||||
@param Selection On input, Selection tell setup browser the information
|
@param Selection On input, Selection tell setup browser the information
|
||||||
about the Selection, form and formset to be displayed.
|
about the Selection, form and formset to be displayed.
|
||||||
On output, Selection return the screen item that is selected
|
On output, Selection return the screen item that is selected
|
||||||
@ -481,16 +481,6 @@ DisplayForm (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
|
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, KEYHELP_TEXT | KEYHELP_BACKGROUND);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Display the infrastructure strings
|
|
||||||
//
|
|
||||||
if (!IsListEmpty (&gMenuList)) {
|
|
||||||
PrintStringAt (LocalScreen.LeftColumn + 2, LocalScreen.TopRow + 1, gFunctionTwoString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// Remove Buffer allocated for StringPtr after it has been used.
|
// Remove Buffer allocated for StringPtr after it has been used.
|
||||||
//
|
//
|
||||||
@ -564,7 +554,6 @@ InitializeBrowserStrings (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
gFunctionOneString = GetToken (STRING_TOKEN (FUNCTION_ONE_STRING), gHiiHandle);
|
gFunctionOneString = GetToken (STRING_TOKEN (FUNCTION_ONE_STRING), gHiiHandle);
|
||||||
gFunctionTwoString = GetToken (STRING_TOKEN (FUNCTION_TWO_STRING), gHiiHandle);
|
|
||||||
gFunctionNineString = GetToken (STRING_TOKEN (FUNCTION_NINE_STRING), gHiiHandle);
|
gFunctionNineString = GetToken (STRING_TOKEN (FUNCTION_NINE_STRING), gHiiHandle);
|
||||||
gFunctionTenString = GetToken (STRING_TOKEN (FUNCTION_TEN_STRING), gHiiHandle);
|
gFunctionTenString = GetToken (STRING_TOKEN (FUNCTION_TEN_STRING), gHiiHandle);
|
||||||
gEnterString = GetToken (STRING_TOKEN (ENTER_STRING), gHiiHandle);
|
gEnterString = GetToken (STRING_TOKEN (ENTER_STRING), gHiiHandle);
|
||||||
@ -608,7 +597,6 @@ FreeBrowserStrings (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
FreePool (gFunctionOneString);
|
FreePool (gFunctionOneString);
|
||||||
FreePool (gFunctionTwoString);
|
|
||||||
FreePool (gFunctionNineString);
|
FreePool (gFunctionNineString);
|
||||||
FreePool (gFunctionTenString);
|
FreePool (gFunctionTenString);
|
||||||
FreePool (gEnterString);
|
FreePool (gEnterString);
|
||||||
@ -857,15 +845,11 @@ SetupBrowser (
|
|||||||
EFI_HII_VALUE *HiiValue;
|
EFI_HII_VALUE *HiiValue;
|
||||||
FORM_BROWSER_STATEMENT *Statement;
|
FORM_BROWSER_STATEMENT *Statement;
|
||||||
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
|
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
|
||||||
EFI_INPUT_KEY Key;
|
FORM_BROWSER_FORMSET *FormSet;
|
||||||
CHAR16 YesResponse;
|
|
||||||
CHAR16 NoResponse;
|
|
||||||
|
|
||||||
gMenuRefreshHead = NULL;
|
gMenuRefreshHead = NULL;
|
||||||
gResetRequired = FALSE;
|
gResetRequired = FALSE;
|
||||||
gNvUpdateRequired = FALSE;
|
FormSet = Selection->FormSet;
|
||||||
|
|
||||||
UiInitMenuList ();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register notify for Form package update
|
// Register notify for Form package update
|
||||||
@ -882,6 +866,15 @@ SetupBrowser (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize current settings of Questions in this FormSet
|
||||||
|
//
|
||||||
|
Status = InitializeCurrentSetting (Selection->FormSet);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
Selection->Action = UI_ACTION_EXIT;
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
//
|
//
|
||||||
// Displays the Header and Footer borders
|
// Displays the Header and Footer borders
|
||||||
@ -913,7 +906,7 @@ SetupBrowser (
|
|||||||
//
|
//
|
||||||
// Load Questions' Value for display
|
// Load Questions' Value for display
|
||||||
//
|
//
|
||||||
Status = LoadFormConfig (Selection->FormSet, Selection->Form);
|
Status = LoadFormSetConfig (Selection->FormSet);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -1000,36 +993,19 @@ SetupBrowser (
|
|||||||
// Force to reparse IFR binary of target Formset
|
// Force to reparse IFR binary of target Formset
|
||||||
//
|
//
|
||||||
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
||||||
|
|
||||||
//
|
|
||||||
// Uncommitted data will be lost after IFR binary re-pasing, so confirm on whether to save
|
|
||||||
//
|
|
||||||
if (gNvUpdateRequired) {
|
|
||||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
|
||||||
|
|
||||||
YesResponse = gYesResponse[0];
|
|
||||||
NoResponse = gNoResponse[0];
|
|
||||||
|
|
||||||
do {
|
|
||||||
CreateDialog (3, TRUE, 0, NULL, &Key, gEmptyString, gSaveChanges, 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.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (YesResponse | UPPER_LOWER_CASE_OFFSET)) {
|
|
||||||
//
|
|
||||||
// If the user hits the YesResponse key
|
|
||||||
//
|
|
||||||
SubmitForm (Selection->FormSet, Selection->Form);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (Selection->Action == UI_ACTION_REFRESH_FORM);
|
} while (Selection->Action == UI_ACTION_REFRESH_FORM);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Record the old formset
|
||||||
|
//
|
||||||
|
if (gOldFormSet != NULL) {
|
||||||
|
DestroyFormSet (gOldFormSet);
|
||||||
|
}
|
||||||
|
gOldFormSet = FormSet;
|
||||||
|
|
||||||
|
Done:
|
||||||
//
|
//
|
||||||
// Unregister notify for Form package update
|
// Unregister notify for Form package update
|
||||||
//
|
//
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Entry and initialization module for the browser.
|
Entry and initialization module for the browser.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2008, Intel Corporation
|
Copyright (c) 2007 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -45,7 +45,6 @@ BOOLEAN gDownArrow;
|
|||||||
// Browser Global Strings
|
// Browser Global Strings
|
||||||
//
|
//
|
||||||
CHAR16 *gFunctionOneString;
|
CHAR16 *gFunctionOneString;
|
||||||
CHAR16 *gFunctionTwoString;
|
|
||||||
CHAR16 *gFunctionNineString;
|
CHAR16 *gFunctionNineString;
|
||||||
CHAR16 *gFunctionTenString;
|
CHAR16 *gFunctionTenString;
|
||||||
CHAR16 *gEnterString;
|
CHAR16 *gEnterString;
|
||||||
@ -87,6 +86,8 @@ EFI_GUID gSetupBrowserGuid = {
|
|||||||
0xab368524, 0xb60c, 0x495b, {0xa0, 0x9, 0x12, 0xe8, 0x5b, 0x1a, 0xea, 0x32}
|
0xab368524, 0xb60c, 0x495b, {0xa0, 0x9, 0x12, 0xe8, 0x5b, 0x1a, 0xea, 0x32}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FORM_BROWSER_FORMSET *gOldFormSet = NULL;
|
||||||
|
|
||||||
FUNCTIION_KEY_SETTING gFunctionKeySettingTable[] = {
|
FUNCTIION_KEY_SETTING gFunctionKeySettingTable[] = {
|
||||||
//
|
//
|
||||||
// Boot Manager
|
// Boot Manager
|
||||||
@ -190,7 +191,7 @@ FUNCTIION_KEY_SETTING gFunctionKeySettingTable[] = {
|
|||||||
@param FormId This field specifies which EFI_IFR_FORM to render as the first
|
@param FormId This field specifies which EFI_IFR_FORM to render as the first
|
||||||
displayable page. If this field has a value of 0x0000, then
|
displayable page. If this field has a value of 0x0000, then
|
||||||
the forms browser will render the specified forms in their encoded order.
|
the forms browser will render the specified forms in their encoded order.
|
||||||
@param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
|
@param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
|
||||||
characters.
|
characters.
|
||||||
@param ActionRequest Points to the action recommended by the form.
|
@param ActionRequest Points to the action recommended by the form.
|
||||||
|
|
||||||
@ -287,6 +288,8 @@ SendForm (
|
|||||||
Selection->FormId = FormId;
|
Selection->FormId = FormId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gNvUpdateRequired = FALSE;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
FormSet = AllocateZeroPool (sizeof (FORM_BROWSER_FORMSET));
|
FormSet = AllocateZeroPool (sizeof (FORM_BROWSER_FORMSET));
|
||||||
ASSERT (FormSet != NULL);
|
ASSERT (FormSet != NULL);
|
||||||
@ -301,15 +304,6 @@ SendForm (
|
|||||||
}
|
}
|
||||||
Selection->FormSet = FormSet;
|
Selection->FormSet = FormSet;
|
||||||
|
|
||||||
//
|
|
||||||
// Initialize current settings of Questions in this FormSet
|
|
||||||
//
|
|
||||||
Status = InitializeCurrentSetting (FormSet);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DestroyFormSet (FormSet);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Display this formset
|
// Display this formset
|
||||||
//
|
//
|
||||||
@ -318,7 +312,6 @@ SendForm (
|
|||||||
Status = SetupBrowser (Selection);
|
Status = SetupBrowser (Selection);
|
||||||
|
|
||||||
gCurrentSelection = NULL;
|
gCurrentSelection = NULL;
|
||||||
DestroyFormSet (FormSet);
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
break;
|
break;
|
||||||
@ -326,6 +319,11 @@ SendForm (
|
|||||||
|
|
||||||
} while (Selection->Action == UI_ACTION_REFRESH_FORMSET);
|
} while (Selection->Action == UI_ACTION_REFRESH_FORMSET);
|
||||||
|
|
||||||
|
if (gOldFormSet != NULL) {
|
||||||
|
DestroyFormSet (gOldFormSet);
|
||||||
|
gOldFormSet = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
FreePool (Selection);
|
FreePool (Selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1128,7 +1126,7 @@ GetQuestionValue (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
LengthStr = StrLen (Value);
|
LengthStr = StrLen (Value);
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
if (IsString) {
|
if (IsString) {
|
||||||
@ -1529,7 +1527,7 @@ SetQuestionValue (
|
|||||||
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemBuffer, 2);
|
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemBuffer, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert to lower char.
|
// Convert to lower char.
|
||||||
//
|
//
|
||||||
@ -1893,7 +1891,7 @@ GetQuestionDefault (
|
|||||||
//
|
//
|
||||||
// Take first oneof option as oneof's default value
|
// Take first oneof option as oneof's default value
|
||||||
//
|
//
|
||||||
if (ValueToOption (Question, HiiValue) == NULL) {
|
if (ValueToOption (Question, HiiValue) == NULL) {
|
||||||
Link = GetFirstNode (&Question->OptionListHead);
|
Link = GetFirstNode (&Question->OptionListHead);
|
||||||
if (!IsNull (&Question->OptionListHead, Link)) {
|
if (!IsNull (&Question->OptionListHead, Link)) {
|
||||||
Option = QUESTION_OPTION_FROM_LINK (Link);
|
Option = QUESTION_OPTION_FROM_LINK (Link);
|
||||||
@ -2026,6 +2024,42 @@ LoadFormConfig (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initialize Question's Edit copy from Storage for the whole Formset.
|
||||||
|
|
||||||
|
@param FormSet FormSet data structure.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
LoadFormSetConfig (
|
||||||
|
IN FORM_BROWSER_FORMSET *FormSet
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
LIST_ENTRY *Link;
|
||||||
|
FORM_BROWSER_FORM *Form;
|
||||||
|
|
||||||
|
Link = GetFirstNode (&FormSet->FormListHead);
|
||||||
|
while (!IsNull (&FormSet->FormListHead, Link)) {
|
||||||
|
Form = FORM_BROWSER_FORM_FROM_LINK (Link);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize local copy of Value for each Form
|
||||||
|
//
|
||||||
|
Status = LoadFormConfig (FormSet, Form);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Link = GetNextNode (&FormSet->FormListHead, Link);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Fill storage's edit copy with settings requested from Configuration Driver.
|
Fill storage's edit copy with settings requested from Configuration Driver.
|
||||||
|
|
||||||
@ -2088,6 +2122,54 @@ LoadStorage (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Copy uncommitted data from source Storage to destination Storage.
|
||||||
|
|
||||||
|
@param Dst Target Storage for uncommitted data.
|
||||||
|
@param Src Source Storage for uncommitted data.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER Source and destination Storage is not the same type.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
CopyStorage (
|
||||||
|
IN OUT FORMSET_STORAGE *Dst,
|
||||||
|
IN FORMSET_STORAGE *Src
|
||||||
|
)
|
||||||
|
{
|
||||||
|
LIST_ENTRY *Link;
|
||||||
|
NAME_VALUE_NODE *Node;
|
||||||
|
|
||||||
|
if ((Dst->Type != Src->Type) || (Dst->Size != Src->Size)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (Src->Type) {
|
||||||
|
case EFI_HII_VARSTORE_BUFFER:
|
||||||
|
CopyMem (Dst->EditBuffer, Src->EditBuffer, Src->Size);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_HII_VARSTORE_NAME_VALUE:
|
||||||
|
Link = GetFirstNode (&Src->NameValueListHead);
|
||||||
|
while (!IsNull (&Src->NameValueListHead, Link)) {
|
||||||
|
Node = NAME_VALUE_NODE_FROM_LINK (Link);
|
||||||
|
|
||||||
|
SetValueByName (Dst, Node->Name, Node->EditValue);
|
||||||
|
|
||||||
|
Link = GetNextNode (&Src->NameValueListHead, Link);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_HII_VARSTORE_EFI_VARIABLE:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get current setting of Questions.
|
Get current setting of Questions.
|
||||||
|
|
||||||
@ -2102,7 +2184,10 @@ InitializeCurrentSetting (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
|
LIST_ENTRY *Link2;
|
||||||
FORMSET_STORAGE *Storage;
|
FORMSET_STORAGE *Storage;
|
||||||
|
FORMSET_STORAGE *StorageSrc;
|
||||||
|
FORMSET_STORAGE *OldStorage;
|
||||||
FORM_BROWSER_FORM *Form;
|
FORM_BROWSER_FORM *Form;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
@ -2125,7 +2210,35 @@ InitializeCurrentSetting (
|
|||||||
while (!IsNull (&FormSet->StorageListHead, Link)) {
|
while (!IsNull (&FormSet->StorageListHead, Link)) {
|
||||||
Storage = FORMSET_STORAGE_FROM_LINK (Link);
|
Storage = FORMSET_STORAGE_FROM_LINK (Link);
|
||||||
|
|
||||||
Status = LoadStorage (FormSet, Storage);
|
OldStorage = NULL;
|
||||||
|
if (gOldFormSet != NULL) {
|
||||||
|
//
|
||||||
|
// Try to find the Storage in backup formset gOldFormSet
|
||||||
|
//
|
||||||
|
Link2 = GetFirstNode (&gOldFormSet->StorageListHead);
|
||||||
|
while (!IsNull (&gOldFormSet->StorageListHead, Link2)) {
|
||||||
|
StorageSrc = FORMSET_STORAGE_FROM_LINK (Link2);
|
||||||
|
|
||||||
|
if (StorageSrc->VarStoreId == Storage->VarStoreId) {
|
||||||
|
OldStorage = StorageSrc;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Link2 = GetNextNode (&gOldFormSet->StorageListHead, Link2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OldStorage == NULL) {
|
||||||
|
//
|
||||||
|
// Storage is not found in backup formset, request it from ConfigDriver
|
||||||
|
//
|
||||||
|
Status = LoadStorage (FormSet, Storage);
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Storage found in backup formset, use it
|
||||||
|
//
|
||||||
|
Status = CopyStorage (Storage, OldStorage);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now Edit Buffer is filled with default values(lower priority) and current
|
// Now Edit Buffer is filled with default values(lower priority) and current
|
||||||
@ -2211,7 +2324,7 @@ GetIfrBinaryData (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
ASSERT (HiiPackageList != NULL);
|
ASSERT (HiiPackageList != NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get Form package from this HII package List
|
// Get Form package from this HII package List
|
||||||
//
|
//
|
||||||
@ -2391,10 +2504,6 @@ InitializeFormSet (
|
|||||||
gFunctionOneString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
|
gFunctionOneString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gFunctionKeySetting & FUNCTION_TWO) != FUNCTION_TWO) {
|
|
||||||
gFunctionTwoString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((gFunctionKeySetting & FUNCTION_NINE) != FUNCTION_NINE) {
|
if ((gFunctionKeySetting & FUNCTION_NINE) != FUNCTION_NINE) {
|
||||||
gFunctionNineString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
|
gFunctionNineString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Private MACRO, structure and function definitions for Setup Browser module.
|
Private MACRO, structure and function definitions for Setup Browser module.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2009, Intel Corporation
|
Copyright (c) 2007 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
@ -71,10 +71,9 @@ extern UINT8 SetupBrowserStrings[];
|
|||||||
// Definition for function key setting
|
// Definition for function key setting
|
||||||
//
|
//
|
||||||
#define NONE_FUNCTION_KEY_SETTING 0
|
#define NONE_FUNCTION_KEY_SETTING 0
|
||||||
#define DEFAULT_FUNCTION_KEY_SETTING (FUNCTION_ONE | FUNCTION_TWO | FUNCTION_NINE | FUNCTION_TEN)
|
#define DEFAULT_FUNCTION_KEY_SETTING (FUNCTION_ONE | FUNCTION_NINE | FUNCTION_TEN)
|
||||||
|
|
||||||
#define FUNCTION_ONE (1 << 0)
|
#define FUNCTION_ONE (1 << 0)
|
||||||
#define FUNCTION_TWO (1 << 1)
|
|
||||||
#define FUNCTION_NINE (1 << 2)
|
#define FUNCTION_NINE (1 << 2)
|
||||||
#define FUNCTION_TEN (1 << 3)
|
#define FUNCTION_TEN (1 << 3)
|
||||||
|
|
||||||
@ -461,11 +460,12 @@ extern EFI_SCREEN_DESCRIPTOR gScreenDimensions;
|
|||||||
extern BOOLEAN gUpArrow;
|
extern BOOLEAN gUpArrow;
|
||||||
extern BOOLEAN gDownArrow;
|
extern BOOLEAN gDownArrow;
|
||||||
|
|
||||||
|
extern FORM_BROWSER_FORMSET *gOldFormSet;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Browser Global Strings
|
// Browser Global Strings
|
||||||
//
|
//
|
||||||
extern CHAR16 *gFunctionOneString;
|
extern CHAR16 *gFunctionOneString;
|
||||||
extern CHAR16 *gFunctionTwoString;
|
|
||||||
extern CHAR16 *gFunctionNineString;
|
extern CHAR16 *gFunctionNineString;
|
||||||
extern CHAR16 *gFunctionTenString;
|
extern CHAR16 *gFunctionTenString;
|
||||||
extern CHAR16 *gEnterString;
|
extern CHAR16 *gEnterString;
|
||||||
@ -892,6 +892,19 @@ LoadFormConfig (
|
|||||||
IN FORM_BROWSER_FORM *Form
|
IN FORM_BROWSER_FORM *Form
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initialize Question's Edit copy from Storage for the whole Formset.
|
||||||
|
|
||||||
|
@param FormSet FormSet data structure.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The function completed successfully.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
LoadFormSetConfig (
|
||||||
|
IN FORM_BROWSER_FORMSET *FormSet
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.
|
Convert setting of Buffer Storage or NameValue Storage to <ConfigResp>.
|
||||||
|
|
||||||
@ -983,7 +996,7 @@ GetIfrBinaryData (
|
|||||||
ScreenDimenions - This allows the browser to be called so that it occupies a
|
ScreenDimenions - This allows the browser to be called so that it occupies a
|
||||||
portion of the physical screen instead of dynamically determining the screen dimensions.
|
portion of the physical screen instead of dynamically determining the screen dimensions.
|
||||||
ActionRequest - Points to the action recommended by the form.
|
ActionRequest - Points to the action recommended by the form.
|
||||||
@param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
|
@param ScreenDimensions Points to recommended form dimensions, including any non-content area, in
|
||||||
characters.
|
characters.
|
||||||
@param ActionRequest Points to the action recommended by the form.
|
@param ActionRequest Points to the action recommended by the form.
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Utility functions for User Interface functions.
|
Utility functions for User Interface functions.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2008, Intel Corporation
|
Copyright (c) 2004 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include "Setup.h"
|
#include "Setup.h"
|
||||||
|
|
||||||
LIST_ENTRY Menu;
|
LIST_ENTRY Menu;
|
||||||
LIST_ENTRY gMenuList;
|
LIST_ENTRY gMenuList = INITIALIZE_LIST_HEAD_VARIABLE (gMenuList);
|
||||||
MENU_REFRESH_ENTRY *gMenuRefreshHead;
|
MENU_REFRESH_ENTRY *gMenuRefreshHead;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -43,10 +43,6 @@ SCAN_CODE_TO_SCREEN_OPERATION gScanCodeToOperation[] = {
|
|||||||
SCAN_ESC,
|
SCAN_ESC,
|
||||||
UiReset,
|
UiReset,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
SCAN_F2,
|
|
||||||
UiPrevious,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
SCAN_LEFT,
|
SCAN_LEFT,
|
||||||
UiLeft,
|
UiLeft,
|
||||||
@ -102,10 +98,6 @@ SCREEN_OPERATION_T0_CONTROL_FLAG gScreenOperationToControlFlag[] = {
|
|||||||
UiSave,
|
UiSave,
|
||||||
CfUiSave,
|
CfUiSave,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
UiPrevious,
|
|
||||||
CfUiPrevious,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
UiPageUp,
|
UiPageUp,
|
||||||
CfUiPageUp,
|
CfUiPageUp,
|
||||||
@ -127,8 +119,6 @@ BOOLEAN GetLineByWidthFinished = FALSE;
|
|||||||
@param Size Number of bytes to set
|
@param Size Number of bytes to set
|
||||||
@param Value Value of the set operation.
|
@param Value Value of the set operation.
|
||||||
|
|
||||||
@return Value.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
SetUnicodeMem (
|
SetUnicodeMem (
|
||||||
@ -159,86 +149,6 @@ UiInitMenu (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Initialize Menu option list.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiInitMenuList (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
InitializeListHead (&gMenuList);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Remove a Menu in list, and return FormId/QuestionId for previous Menu.
|
|
||||||
|
|
||||||
@param Selection Menu selection.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiRemoveMenuListEntry (
|
|
||||||
OUT UI_MENU_SELECTION *Selection
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UI_MENU_LIST *UiMenuList;
|
|
||||||
|
|
||||||
if (!IsListEmpty (&gMenuList)) {
|
|
||||||
UiMenuList = CR (gMenuList.ForwardLink, UI_MENU_LIST, MenuLink, UI_MENU_LIST_SIGNATURE);
|
|
||||||
|
|
||||||
Selection->FormId = UiMenuList->FormId;
|
|
||||||
Selection->QuestionId = UiMenuList->QuestionId;
|
|
||||||
RemoveEntryList (&UiMenuList->MenuLink);
|
|
||||||
FreePool (UiMenuList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Free Menu option linked list.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiFreeMenuList (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UI_MENU_LIST *UiMenuList;
|
|
||||||
|
|
||||||
while (!IsListEmpty (&gMenuList)) {
|
|
||||||
UiMenuList = CR (gMenuList.ForwardLink, UI_MENU_LIST, MenuLink, UI_MENU_LIST_SIGNATURE);
|
|
||||||
RemoveEntryList (&UiMenuList->MenuLink);
|
|
||||||
FreePool (UiMenuList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Add one menu entry to the linked lst
|
|
||||||
|
|
||||||
@param Selection Menu selection.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiAddMenuListEntry (
|
|
||||||
IN UI_MENU_SELECTION *Selection
|
|
||||||
)
|
|
||||||
{
|
|
||||||
UI_MENU_LIST *UiMenuList;
|
|
||||||
|
|
||||||
UiMenuList = AllocateZeroPool (sizeof (UI_MENU_LIST));
|
|
||||||
ASSERT (UiMenuList != NULL);
|
|
||||||
|
|
||||||
UiMenuList->Signature = UI_MENU_LIST_SIGNATURE;
|
|
||||||
UiMenuList->FormId = Selection->FormId;
|
|
||||||
UiMenuList->QuestionId = Selection->QuestionId;
|
|
||||||
|
|
||||||
InsertHeadList (&gMenuList, &UiMenuList->MenuLink);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free Menu option linked list.
|
Free Menu option linked list.
|
||||||
|
|
||||||
@ -270,6 +180,130 @@ UiFreeMenu (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create a menu with specified formset GUID and form ID, and add it as a child
|
||||||
|
of the given parent menu.
|
||||||
|
|
||||||
|
@param Parent The parent of menu to be added.
|
||||||
|
@param FormSetGuid The Formset Guid of menu to be added.
|
||||||
|
@param FormId The Form ID of menu to be added.
|
||||||
|
|
||||||
|
@return A pointer to the newly added menu or NULL if memory is insufficient.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UI_MENU_LIST *
|
||||||
|
UiAddMenuList (
|
||||||
|
IN OUT UI_MENU_LIST *Parent,
|
||||||
|
IN EFI_GUID *FormSetGuid,
|
||||||
|
IN UINT16 FormId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UI_MENU_LIST *MenuList;
|
||||||
|
|
||||||
|
MenuList = AllocateZeroPool (sizeof (UI_MENU_LIST));
|
||||||
|
if (MenuList == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuList->Signature = UI_MENU_LIST_SIGNATURE;
|
||||||
|
InitializeListHead (&MenuList->ChildListHead);
|
||||||
|
|
||||||
|
CopyMem (&MenuList->FormSetGuid, FormSetGuid, sizeof (EFI_GUID));
|
||||||
|
MenuList->FormId = FormId;
|
||||||
|
MenuList->Parent = Parent;
|
||||||
|
|
||||||
|
if (Parent == NULL) {
|
||||||
|
//
|
||||||
|
// If parent is not specified, it is the root Form of a Formset
|
||||||
|
//
|
||||||
|
InsertTailList (&gMenuList, &MenuList->Link);
|
||||||
|
} else {
|
||||||
|
InsertTailList (&Parent->ChildListHead, &MenuList->Link);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MenuList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Search Menu with given FormId in the parent menu and all its child menus.
|
||||||
|
|
||||||
|
@param Parent The parent of menu to search.
|
||||||
|
@param FormId The Form ID of menu to search.
|
||||||
|
|
||||||
|
@return A pointer to menu found or NULL if not found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UI_MENU_LIST *
|
||||||
|
UiFindChildMenuList (
|
||||||
|
IN UI_MENU_LIST *Parent,
|
||||||
|
IN UINT16 FormId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
LIST_ENTRY *Link;
|
||||||
|
UI_MENU_LIST *Child;
|
||||||
|
UI_MENU_LIST *MenuList;
|
||||||
|
|
||||||
|
if (Parent->FormId == FormId) {
|
||||||
|
return Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
Link = GetFirstNode (&Parent->ChildListHead);
|
||||||
|
while (!IsNull (&Parent->ChildListHead, Link)) {
|
||||||
|
Child = UI_MENU_LIST_FROM_LINK (Link);
|
||||||
|
|
||||||
|
MenuList = UiFindChildMenuList (Child, FormId);
|
||||||
|
if (MenuList != NULL) {
|
||||||
|
return MenuList;
|
||||||
|
}
|
||||||
|
|
||||||
|
Link = GetNextNode (&Parent->ChildListHead, Link);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Search Menu with given FormSetGuid and FormId in all cached menu list.
|
||||||
|
|
||||||
|
@param FormSetGuid The Formset GUID of the menu to search.
|
||||||
|
@param FormId The Form ID of menu to search.
|
||||||
|
|
||||||
|
@return A pointer to menu found or NULL if not found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UI_MENU_LIST *
|
||||||
|
UiFindMenuList (
|
||||||
|
IN EFI_GUID *FormSetGuid,
|
||||||
|
IN UINT16 FormId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
LIST_ENTRY *Link;
|
||||||
|
UI_MENU_LIST *MenuList;
|
||||||
|
UI_MENU_LIST *Child;
|
||||||
|
|
||||||
|
Link = GetFirstNode (&gMenuList);
|
||||||
|
while (!IsNull (&gMenuList, Link)) {
|
||||||
|
MenuList = UI_MENU_LIST_FROM_LINK (Link);
|
||||||
|
|
||||||
|
if (CompareGuid (FormSetGuid, &MenuList->FormSetGuid)) {
|
||||||
|
//
|
||||||
|
// This is the formset we are looking for, find the form in this formset
|
||||||
|
//
|
||||||
|
Child = UiFindChildMenuList (MenuList, FormId);
|
||||||
|
if (Child != NULL) {
|
||||||
|
return Child;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Link = GetNextNode (&gMenuList, Link);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free Menu option linked list.
|
Free Menu option linked list.
|
||||||
|
|
||||||
@ -929,7 +963,7 @@ CreateMultiStringPopUp (
|
|||||||
VA_LIST Marker;
|
VA_LIST Marker;
|
||||||
|
|
||||||
VA_START (Marker, NumberOfLines);
|
VA_START (Marker, NumberOfLines);
|
||||||
|
|
||||||
CreateSharedPopUp (RequestedWidth, NumberOfLines, Marker);
|
CreateSharedPopUp (RequestedWidth, NumberOfLines, Marker);
|
||||||
|
|
||||||
VA_END (Marker);
|
VA_END (Marker);
|
||||||
@ -1275,7 +1309,7 @@ IsSelectable (
|
|||||||
Determine if the menu is the last menu that can be selected.
|
Determine if the menu is the last menu that can be selected.
|
||||||
|
|
||||||
This is an internal function.
|
This is an internal function.
|
||||||
|
|
||||||
@param Direction The scroll direction. False is down. True is up.
|
@param Direction The scroll direction. False is down. True is up.
|
||||||
@param CurrentPos The current focus.
|
@param CurrentPos The current focus.
|
||||||
|
|
||||||
@ -1311,9 +1345,9 @@ ValueIsScroll (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Move to next selectable statement.
|
Move to next selectable statement.
|
||||||
|
|
||||||
This is an internal function.
|
This is an internal function.
|
||||||
|
|
||||||
@param GoUp The navigation direction. TRUE: up, FALSE: down.
|
@param GoUp The navigation direction. TRUE: up, FALSE: down.
|
||||||
@param CurrentPosition Current position.
|
@param CurrentPosition Current position.
|
||||||
|
|
||||||
@ -1379,7 +1413,7 @@ MoveToNextStatement (
|
|||||||
Adjust Data and Time position accordingly.
|
Adjust Data and Time position accordingly.
|
||||||
Data format : [01/02/2004] [11:22:33]
|
Data format : [01/02/2004] [11:22:33]
|
||||||
Line number : 0 0 1 0 0 1
|
Line number : 0 0 1 0 0 1
|
||||||
|
|
||||||
This is an internal function.
|
This is an internal function.
|
||||||
|
|
||||||
@param DirectionUp the up or down direction. False is down. True is
|
@param DirectionUp the up or down direction. False is down. True is
|
||||||
@ -1606,6 +1640,8 @@ UiDisplayMenu (
|
|||||||
CHAR16 TemStr[2];
|
CHAR16 TemStr[2];
|
||||||
UINT8 *DevicePathBuffer;
|
UINT8 *DevicePathBuffer;
|
||||||
UINT8 DigitUint8;
|
UINT8 DigitUint8;
|
||||||
|
UI_MENU_LIST *CurrentMenu;
|
||||||
|
UI_MENU_LIST *MenuList;
|
||||||
|
|
||||||
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
|
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
|
||||||
|
|
||||||
@ -1651,6 +1687,25 @@ UiDisplayMenu (
|
|||||||
Repaint = TRUE;
|
Repaint = TRUE;
|
||||||
MenuOption = NULL;
|
MenuOption = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find current Menu
|
||||||
|
//
|
||||||
|
CurrentMenu = UiFindMenuList (&Selection->FormSetGuid, Selection->FormId);
|
||||||
|
if (CurrentMenu == NULL) {
|
||||||
|
//
|
||||||
|
// Current menu not found, add it to the menu tree
|
||||||
|
//
|
||||||
|
CurrentMenu = UiAddMenuList (NULL, &Selection->FormSetGuid, Selection->FormId);
|
||||||
|
}
|
||||||
|
ASSERT (CurrentMenu != NULL);
|
||||||
|
|
||||||
|
if (Selection->QuestionId == 0) {
|
||||||
|
//
|
||||||
|
// Highlight not specified, fetch it from cached menu
|
||||||
|
//
|
||||||
|
Selection->QuestionId = CurrentMenu->QuestionId;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get user's selection
|
// Get user's selection
|
||||||
//
|
//
|
||||||
@ -2103,6 +2158,10 @@ UiDisplayMenu (
|
|||||||
//
|
//
|
||||||
Statement = MenuOption->ThisTag;
|
Statement = MenuOption->ThisTag;
|
||||||
Selection->Statement = Statement;
|
Selection->Statement = Statement;
|
||||||
|
//
|
||||||
|
// Record highlight for current menu
|
||||||
|
//
|
||||||
|
CurrentMenu->QuestionId = Statement->QuestionId;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set reverse attribute
|
// Set reverse attribute
|
||||||
@ -2258,27 +2317,19 @@ UiDisplayMenu (
|
|||||||
//
|
//
|
||||||
// IFR is updated in Callback of refresh opcode, re-parse it
|
// IFR is updated in Callback of refresh opcode, re-parse it
|
||||||
//
|
//
|
||||||
ControlFlag = CfUiReset;
|
|
||||||
Selection->Statement = NULL;
|
Selection->Statement = NULL;
|
||||||
break;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||||
//
|
//
|
||||||
// if we encounter error, continue to read another key in.
|
// If we encounter error, continue to read another key in.
|
||||||
//
|
//
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ControlFlag = CfReadKey;
|
ControlFlag = CfReadKey;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsListEmpty (&Menu) && Key.UnicodeChar != CHAR_NULL) {
|
|
||||||
//
|
|
||||||
// If the screen has no menu items, and the user didn't select UiPrevious, or UiReset
|
|
||||||
//
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (Key.UnicodeChar) {
|
switch (Key.UnicodeChar) {
|
||||||
case CHAR_CARRIAGE_RETURN:
|
case CHAR_CARRIAGE_RETURN:
|
||||||
ScreenOperation = UiSelect;
|
ScreenOperation = UiSelect;
|
||||||
@ -2334,7 +2385,6 @@ UiDisplayMenu (
|
|||||||
|
|
||||||
case CHAR_NULL:
|
case CHAR_NULL:
|
||||||
if (((Key.ScanCode == SCAN_F1) && ((gFunctionKeySetting & FUNCTION_ONE) != FUNCTION_ONE)) ||
|
if (((Key.ScanCode == SCAN_F1) && ((gFunctionKeySetting & FUNCTION_ONE) != FUNCTION_ONE)) ||
|
||||||
((Key.ScanCode == SCAN_F2) && ((gFunctionKeySetting & FUNCTION_TWO) != FUNCTION_TWO)) ||
|
|
||||||
((Key.ScanCode == SCAN_F9) && ((gFunctionKeySetting & FUNCTION_NINE) != FUNCTION_NINE)) ||
|
((Key.ScanCode == SCAN_F9) && ((gFunctionKeySetting & FUNCTION_NINE) != FUNCTION_NINE)) ||
|
||||||
((Key.ScanCode == SCAN_F10) && ((gFunctionKeySetting & FUNCTION_TEN) != FUNCTION_TEN))
|
((Key.ScanCode == SCAN_F10) && ((gFunctionKeySetting & FUNCTION_TEN) != FUNCTION_TEN))
|
||||||
) {
|
) {
|
||||||
@ -2360,9 +2410,9 @@ UiDisplayMenu (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CfScreenOperation:
|
case CfScreenOperation:
|
||||||
if (ScreenOperation != UiPrevious && ScreenOperation != UiReset) {
|
if (ScreenOperation != UiReset) {
|
||||||
//
|
//
|
||||||
// If the screen has no menu items, and the user didn't select UiPrevious, or UiReset
|
// If the screen has no menu items, and the user didn't select UiReset
|
||||||
// ignore the selection and go back to reading keys.
|
// ignore the selection and go back to reading keys.
|
||||||
//
|
//
|
||||||
if (IsListEmpty (&Menu)) {
|
if (IsListEmpty (&Menu)) {
|
||||||
@ -2383,12 +2433,6 @@ UiDisplayMenu (
|
|||||||
ControlFlag = CfPrepareToReadKey;
|
ControlFlag = CfPrepareToReadKey;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (ScreenOperation == UiReset) {
|
|
||||||
//
|
|
||||||
// Press ESC to exit FormSet
|
|
||||||
//
|
|
||||||
Selection->Action = UI_ACTION_EXIT;
|
|
||||||
Selection->Statement = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Index = 0;
|
for (Index = 0;
|
||||||
@ -2402,26 +2446,6 @@ UiDisplayMenu (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CfUiPrevious:
|
|
||||||
ControlFlag = CfCheckSelection;
|
|
||||||
|
|
||||||
if (IsListEmpty (&gMenuList)) {
|
|
||||||
Selection->Action = UI_ACTION_NONE;
|
|
||||||
if (IsListEmpty (&Menu)) {
|
|
||||||
ControlFlag = CfReadKey;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Remove the Cached page entry
|
|
||||||
//
|
|
||||||
UiRemoveMenuListEntry (Selection);
|
|
||||||
|
|
||||||
Selection->Action = UI_ACTION_REFRESH_FORM;
|
|
||||||
Selection->Statement = NULL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CfUiSelect:
|
case CfUiSelect:
|
||||||
ControlFlag = CfCheckSelection;
|
ControlFlag = CfCheckSelection;
|
||||||
|
|
||||||
@ -2444,7 +2468,7 @@ UiDisplayMenu (
|
|||||||
//
|
//
|
||||||
// Goto another Hii Package list
|
// Goto another Hii Package list
|
||||||
//
|
//
|
||||||
ControlFlag = CfUiReset;
|
ControlFlag = CfCheckSelection;
|
||||||
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
||||||
|
|
||||||
StringPtr = GetToken (Statement->RefDevicePath, Selection->FormSet->HiiHandle);
|
StringPtr = GetToken (Statement->RefDevicePath, Selection->FormSet->HiiHandle);
|
||||||
@ -2458,7 +2482,7 @@ UiDisplayMenu (
|
|||||||
}
|
}
|
||||||
BufferSize = StrLen (StringPtr) / 2;
|
BufferSize = StrLen (StringPtr) / 2;
|
||||||
DevicePath = AllocatePool (BufferSize);
|
DevicePath = AllocatePool (BufferSize);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert from Device Path String to DevicePath Buffer in the reverse order.
|
// Convert from Device Path String to DevicePath Buffer in the reverse order.
|
||||||
//
|
//
|
||||||
@ -2499,7 +2523,7 @@ UiDisplayMenu (
|
|||||||
//
|
//
|
||||||
// Goto another Formset, check for uncommitted data
|
// Goto another Formset, check for uncommitted data
|
||||||
//
|
//
|
||||||
ControlFlag = CfUiReset;
|
ControlFlag = CfCheckSelection;
|
||||||
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
||||||
|
|
||||||
CopyMem (&Selection->FormSetGuid, &Statement->RefFormSetId, sizeof (EFI_GUID));
|
CopyMem (&Selection->FormSetGuid, &Statement->RefFormSetId, sizeof (EFI_GUID));
|
||||||
@ -2512,9 +2536,12 @@ UiDisplayMenu (
|
|||||||
Selection->Action = UI_ACTION_REFRESH_FORM;
|
Selection->Action = UI_ACTION_REFRESH_FORM;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Link current form so that we can always go back when someone hits the UiPrevious
|
// Link current form so that we can always go back when someone hits the ESC
|
||||||
//
|
//
|
||||||
UiAddMenuListEntry (Selection);
|
MenuList = UiFindMenuList (&Selection->FormSetGuid, Statement->RefFormId);
|
||||||
|
if (MenuList == NULL) {
|
||||||
|
MenuList = UiAddMenuList (CurrentMenu, &Selection->FormSetGuid, Statement->RefFormId);
|
||||||
|
}
|
||||||
|
|
||||||
Selection->FormId = Statement->RefFormId;
|
Selection->FormId = Statement->RefFormId;
|
||||||
Selection->QuestionId = Statement->RefQuestionId;
|
Selection->QuestionId = Statement->RefQuestionId;
|
||||||
@ -2582,21 +2609,44 @@ UiDisplayMenu (
|
|||||||
|
|
||||||
case CfUiReset:
|
case CfUiReset:
|
||||||
//
|
//
|
||||||
// We are going to leave current FormSet, so check uncommited data in this FormSet
|
// We come here when someone press ESC
|
||||||
//
|
//
|
||||||
ControlFlag = CfCheckSelection;
|
ControlFlag = CfCheckSelection;
|
||||||
|
|
||||||
|
if (CurrentMenu->Parent != NULL) {
|
||||||
|
//
|
||||||
|
// we have a parent, so go to the parent menu
|
||||||
|
//
|
||||||
|
if (CompareGuid (&CurrentMenu->FormSetGuid, &CurrentMenu->Parent->FormSetGuid)) {
|
||||||
|
//
|
||||||
|
// The parent menu and current menu are in the same formset
|
||||||
|
//
|
||||||
|
Selection->Action = UI_ACTION_REFRESH_FORM;
|
||||||
|
} else {
|
||||||
|
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
||||||
|
}
|
||||||
|
Selection->Statement = NULL;
|
||||||
|
|
||||||
|
Selection->FormId = CurrentMenu->Parent->FormId;
|
||||||
|
Selection->QuestionId = CurrentMenu->Parent->QuestionId;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Clear highlight record for this menu
|
||||||
|
//
|
||||||
|
CurrentMenu->QuestionId = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (gClassOfVfr == FORMSET_CLASS_FRONT_PAGE) {
|
if (gClassOfVfr == FORMSET_CLASS_FRONT_PAGE) {
|
||||||
//
|
//
|
||||||
// There is no parent menu for FrontPage
|
// We never exit FrontPage, so skip the ESC
|
||||||
//
|
//
|
||||||
Selection->Action = UI_ACTION_NONE;
|
Selection->Action = UI_ACTION_NONE;
|
||||||
Selection->Statement = MenuOption->ThisTag;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If NV flag is up, prompt user
|
// We are going to leave current FormSet, so check uncommited data in this FormSet
|
||||||
//
|
//
|
||||||
if (gNvUpdateRequired) {
|
if (gNvUpdateRequired) {
|
||||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||||
@ -2604,8 +2654,11 @@ UiDisplayMenu (
|
|||||||
YesResponse = gYesResponse[0];
|
YesResponse = gYesResponse[0];
|
||||||
NoResponse = gNoResponse[0];
|
NoResponse = gNoResponse[0];
|
||||||
|
|
||||||
|
//
|
||||||
|
// If NV flag is up, prompt user
|
||||||
|
//
|
||||||
do {
|
do {
|
||||||
CreateDialog (3, TRUE, 0, NULL, &Key, gEmptyString, gAreYouSure, gEmptyString);
|
CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gSaveChanges, gAreYouSure, gEmptyString);
|
||||||
} while
|
} while
|
||||||
(
|
(
|
||||||
(Key.ScanCode != SCAN_ESC) &&
|
(Key.ScanCode != SCAN_ESC) &&
|
||||||
@ -2613,24 +2666,29 @@ UiDisplayMenu (
|
|||||||
((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (YesResponse | UPPER_LOWER_CASE_OFFSET))
|
((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (YesResponse | UPPER_LOWER_CASE_OFFSET))
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
if (Key.ScanCode == SCAN_ESC) {
|
||||||
// If the user hits the YesResponse key
|
//
|
||||||
//
|
// User hits the ESC key
|
||||||
if ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (YesResponse | UPPER_LOWER_CASE_OFFSET)) {
|
//
|
||||||
} else {
|
|
||||||
Repaint = TRUE;
|
Repaint = TRUE;
|
||||||
NewLine = TRUE;
|
NewLine = TRUE;
|
||||||
|
|
||||||
Selection->Action = UI_ACTION_NONE;
|
Selection->Action = UI_ACTION_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
|
Selection->Action = UI_ACTION_EXIT;
|
||||||
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
|
Selection->Statement = NULL;
|
||||||
|
CurrentMenu->QuestionId = 0;
|
||||||
|
|
||||||
UiFreeMenuList ();
|
|
||||||
gST->ConOut->ClearScreen (gST->ConOut);
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
case CfUiLeft:
|
case CfUiLeft:
|
||||||
@ -2696,19 +2754,19 @@ UiDisplayMenu (
|
|||||||
TopOfScreen = NewPos;
|
TopOfScreen = NewPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
Difference = MoveToNextStatement (TRUE, &NewPos);
|
Difference = MoveToNextStatement (TRUE, &NewPos);
|
||||||
PreviousMenuOption = MENU_OPTION_FROM_LINK (NewPos);
|
PreviousMenuOption = MENU_OPTION_FROM_LINK (NewPos);
|
||||||
DistanceValue += PreviousMenuOption->Skip;
|
DistanceValue += PreviousMenuOption->Skip;
|
||||||
|
|
||||||
if ((INTN) MenuOption->Row - (INTN) DistanceValue < (INTN) TopRow) {
|
if ((INTN) MenuOption->Row - (INTN) DistanceValue < (INTN) TopRow) {
|
||||||
if (Difference > 0) {
|
if (Difference > 0) {
|
||||||
//
|
//
|
||||||
// Previous focus MenuOption is above the TopOfScreen, so we need to scroll
|
// Previous focus MenuOption is above the TopOfScreen, so we need to scroll
|
||||||
//
|
//
|
||||||
TopOfScreen = NewPos;
|
TopOfScreen = NewPos;
|
||||||
Repaint = TRUE;
|
Repaint = TRUE;
|
||||||
SkipValue = 0;
|
SkipValue = 0;
|
||||||
OldSkipValue = 0;
|
OldSkipValue = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Difference < 0) {
|
if (Difference < 0) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Private structure, MACRO and function definitions for User Interface related functionalities.
|
Private structure, MACRO and function definitions for User Interface related functionalities.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2008, Intel Corporation
|
Copyright (c) 2004 - 2009, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -58,7 +58,6 @@ typedef enum {
|
|||||||
CfPrepareToReadKey,
|
CfPrepareToReadKey,
|
||||||
CfReadKey,
|
CfReadKey,
|
||||||
CfScreenOperation,
|
CfScreenOperation,
|
||||||
CfUiPrevious,
|
|
||||||
CfUiSelect,
|
CfUiSelect,
|
||||||
CfUiReset,
|
CfUiReset,
|
||||||
CfUiLeft,
|
CfUiLeft,
|
||||||
@ -145,13 +144,21 @@ typedef struct {
|
|||||||
|
|
||||||
#define MENU_OPTION_FROM_LINK(a) CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)
|
#define MENU_OPTION_FROM_LINK(a) CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct _UI_MENU_LIST UI_MENU_LIST;
|
||||||
UINTN Signature;
|
|
||||||
LIST_ENTRY MenuLink;
|
|
||||||
|
|
||||||
|
struct _UI_MENU_LIST {
|
||||||
|
UINTN Signature;
|
||||||
|
LIST_ENTRY Link;
|
||||||
|
|
||||||
|
EFI_GUID FormSetGuid;
|
||||||
UINT16 FormId;
|
UINT16 FormId;
|
||||||
UINT16 QuestionId;
|
UINT16 QuestionId;
|
||||||
} UI_MENU_LIST;
|
|
||||||
|
UI_MENU_LIST *Parent;
|
||||||
|
LIST_ENTRY ChildListHead;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define UI_MENU_LIST_FROM_LINK(a) CR (a, UI_MENU_LIST, Link, UI_MENU_LIST_SIGNATURE)
|
||||||
|
|
||||||
typedef struct _MENU_REFRESH_ENTRY {
|
typedef struct _MENU_REFRESH_ENTRY {
|
||||||
struct _MENU_REFRESH_ENTRY *Next;
|
struct _MENU_REFRESH_ENTRY *Next;
|
||||||
@ -173,7 +180,6 @@ typedef struct {
|
|||||||
} SCREEN_OPERATION_T0_CONTROL_FLAG;
|
} SCREEN_OPERATION_T0_CONTROL_FLAG;
|
||||||
|
|
||||||
|
|
||||||
extern LIST_ENTRY gMenuList;
|
|
||||||
extern MENU_REFRESH_ENTRY *gMenuRefreshHead;
|
extern MENU_REFRESH_ENTRY *gMenuRefreshHead;
|
||||||
extern UI_MENU_SELECTION *gCurrentSelection;
|
extern UI_MENU_SELECTION *gCurrentSelection;
|
||||||
extern BOOLEAN mHiiPackageListUpdated;
|
extern BOOLEAN mHiiPackageListUpdated;
|
||||||
@ -199,37 +205,6 @@ UiInitMenuList (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
Remove a Menu in list, and return FormId/QuestionId for previous Menu.
|
|
||||||
|
|
||||||
@param Selection Menu selection.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiRemoveMenuListEntry (
|
|
||||||
OUT UI_MENU_SELECTION *Selection
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Free Menu option linked list.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiFreeMenuList (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Add one menu entry to the linked lst
|
|
||||||
|
|
||||||
@param Selection Menu selection.
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
UiAddMenuListEntry (
|
|
||||||
IN UI_MENU_SELECTION *Selection
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free Menu option linked list.
|
Free Menu option linked list.
|
||||||
|
|
||||||
@ -239,6 +214,63 @@ UiFreeMenu (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Create a menu with specified formset GUID and form ID, and add it as a child
|
||||||
|
of the given parent menu.
|
||||||
|
|
||||||
|
@param Parent The parent of menu to be added.
|
||||||
|
@param FormSetGuid The Formset Guid of menu to be added.
|
||||||
|
@param FormId The Form ID of menu to be added.
|
||||||
|
|
||||||
|
@return A pointer to the newly added menu or NULL if memory is insufficient.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UI_MENU_LIST *
|
||||||
|
UiAddMenuList (
|
||||||
|
IN OUT UI_MENU_LIST *Parent,
|
||||||
|
IN EFI_GUID *FormSetGuid,
|
||||||
|
IN UINT16 FormId
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Search Menu with given FormId in the parent menu and all its child menus.
|
||||||
|
|
||||||
|
@param Parent The parent of menu to search.
|
||||||
|
@param FormId The Form ID of menu to search.
|
||||||
|
|
||||||
|
@return A pointer to menu found or NULL if not found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UI_MENU_LIST *
|
||||||
|
UiFindChildMenuList (
|
||||||
|
IN UI_MENU_LIST *Parent,
|
||||||
|
IN UINT16 FormId
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Search Menu with given FormSetGuid and FormId in all cached menu list.
|
||||||
|
|
||||||
|
@param FormSetGuid The Formset GUID of the menu to search.
|
||||||
|
@param FormId The Form ID of menu to search.
|
||||||
|
|
||||||
|
@return A pointer to menu found or NULL if not found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UI_MENU_LIST *
|
||||||
|
UiFindMenuList (
|
||||||
|
IN EFI_GUID *FormSetGuid,
|
||||||
|
IN UINT16 FormId
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Free Menu option linked list.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
UiFreeRefreshList (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add one menu option by specified description and context.
|
Add one menu option by specified description and context.
|
||||||
|
|
||||||
@ -557,7 +589,7 @@ ClearLines (
|
|||||||
|
|
||||||
This function handles the Unicode string with NARROW_CHAR
|
This function handles the Unicode string with NARROW_CHAR
|
||||||
and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
|
and WIDE_CHAR control characters. NARROW_HCAR and WIDE_CHAR
|
||||||
does not count in the resultant output. If a WIDE_CHAR is
|
does not count in the resultant output. If a WIDE_CHAR is
|
||||||
hit, then 2 Unicode character will consume an output storage
|
hit, then 2 Unicode character will consume an output storage
|
||||||
space with size of CHAR16 till a NARROW_CHAR is hit.
|
space with size of CHAR16 till a NARROW_CHAR is hit.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user