1. Code clean up: add IN/OUT modifier for parameters.

2. UI enchancement: if there is no editable item in a Form, the F9/F10 will not be displayed in the footer.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9363 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
xdu2 2009-10-26 03:05:16 +00:00
parent f4a2af1f4d
commit 8b0fc5c1e1
11 changed files with 125 additions and 76 deletions

View File

@ -512,7 +512,7 @@ InitializeUnicodeCollationProtocol (
**/ **/
VOID VOID
IfrStrToUpper ( IfrStrToUpper (
CHAR16 *String IN CHAR16 *String
) )
{ {
while (*String != 0) { while (*String != 0) {
@ -635,7 +635,7 @@ IfrToUint (
if (String == NULL) { if (String == NULL) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
IfrStrToUpper (String); IfrStrToUpper (String);
StringPtr = StrStr (String, L"0X"); StringPtr = StrStr (String, L"0X");
if (StringPtr != NULL) { if (StringPtr != NULL) {
@ -724,7 +724,7 @@ Done:
} }
if (String[1] != NULL) { if (String[1] != NULL) {
FreePool (String[1]); FreePool (String[1]);
} }
if (StringPtr != NULL) { if (StringPtr != NULL) {
FreePool (StringPtr); FreePool (StringPtr);
} }
@ -788,7 +788,7 @@ Done:
} }
if (String[1] != NULL) { if (String[1] != NULL) {
FreePool (String[1]); FreePool (String[1]);
} }
return Status; return Status;
} }
@ -877,7 +877,7 @@ Done:
} }
if (String[1] != NULL) { if (String[1] != NULL) {
FreePool (String[1]); FreePool (String[1]);
} }
return Status; return Status;
} }
@ -1051,7 +1051,7 @@ Done:
} }
if (String[1] != NULL) { if (String[1] != NULL) {
FreePool (String[1]); FreePool (String[1]);
} }
return Status; return Status;
} }
@ -1159,7 +1159,7 @@ Done:
} }
if (String[1] != NULL) { if (String[1] != NULL) {
FreePool (String[1]); FreePool (String[1]);
} }
return Status; return Status;
} }

View File

@ -96,15 +96,15 @@ CreateStatement (
Convert a numeric value to a Unicode String and insert it to String Package. Convert a numeric value to a Unicode String and insert it to String Package.
This string is used as the Unicode Name for the EFI Variable. This is to support This string is used as the Unicode Name for the EFI Variable. This is to support
the deprecated vareqval opcode. the deprecated vareqval opcode.
@param FormSet The FormSet. @param FormSet The FormSet.
@param Statement The numeric question whose VarStoreInfo.VarName is the @param Statement The numeric question whose VarStoreInfo.VarName is the
numeric value which is used to produce the Unicode Name numeric value which is used to produce the Unicode Name
for the EFI Variable. for the EFI Variable.
If the Statement is NULL, the ASSERT. If the Statement is NULL, the ASSERT.
If the opcode is not Numeric, then ASSERT. If the opcode is not Numeric, then ASSERT.
@retval EFI_SUCCESS The funtion always succeeds. @retval EFI_SUCCESS The funtion always succeeds.
**/ **/
EFI_STATUS EFI_STATUS
@ -118,7 +118,7 @@ UpdateCheckBoxStringToken (
ASSERT (Statement != NULL); ASSERT (Statement != NULL);
ASSERT (Statement->Operand == EFI_IFR_NUMERIC_OP); ASSERT (Statement->Operand == EFI_IFR_NUMERIC_OP);
UnicodeValueToString (Str, 0, Statement->VarStoreInfo.VarName, MAXIMUM_VALUE_CHARACTERS - 1); UnicodeValueToString (Str, 0, Statement->VarStoreInfo.VarName, MAXIMUM_VALUE_CHARACTERS - 1);
Id = HiiSetString (FormSet->HiiHandle, 0, Str, NULL); Id = HiiSetString (FormSet->HiiHandle, 0, Str, NULL);
@ -127,21 +127,21 @@ UpdateCheckBoxStringToken (
} }
Statement->VarStoreInfo.VarName = Id; Statement->VarStoreInfo.VarName = Id;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/** /**
Check if the next opcode is the EFI_IFR_EXTEND_OP_VAREQNAME. Check if the next opcode is the EFI_IFR_EXTEND_OP_VAREQNAME.
@param OpCodeData The current opcode. @param OpCodeData The current opcode.
@retval TRUE Yes. @retval TRUE Yes.
@retval FALSE No. @retval FALSE No.
**/ **/
BOOLEAN BOOLEAN
IsNextOpCodeGuidedVarEqName ( IsNextOpCodeGuidedVarEqName (
UINT8 *OpCodeData IN UINT8 *OpCodeData
) )
{ {
// //
@ -151,7 +151,7 @@ IsNextOpCodeGuidedVarEqName (
if (*OpCodeData == EFI_IFR_GUID_OP) { if (*OpCodeData == EFI_IFR_GUID_OP) {
if (CompareGuid (&gEfiIfrFrameworkGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)))) { if (CompareGuid (&gEfiIfrFrameworkGuid, (EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)))) {
// //
// Specific GUIDed opcodes to support IFR generated from Framework HII VFR // Specific GUIDed opcodes to support IFR generated from Framework HII VFR
// //
if ((((EFI_IFR_GUID_VAREQNAME *) OpCodeData)->ExtendOpCode) == EFI_IFR_EXTEND_OP_VAREQNAME) { if ((((EFI_IFR_GUID_VAREQNAME *) OpCodeData)->ExtendOpCode) == EFI_IFR_EXTEND_OP_VAREQNAME) {
return TRUE; return TRUE;
@ -329,19 +329,19 @@ InitializeConfigHdr (
) )
{ {
CHAR16 *Name; CHAR16 *Name;
if (Storage->Type == EFI_HII_VARSTORE_BUFFER) { if (Storage->Type == EFI_HII_VARSTORE_BUFFER) {
Name = Storage->Name; Name = Storage->Name;
} else { } else {
Name = NULL; Name = NULL;
} }
Storage->ConfigHdr = HiiConstructConfigHdr ( Storage->ConfigHdr = HiiConstructConfigHdr (
&Storage->Guid, &Storage->Guid,
Name, Name,
FormSet->DriverHandle FormSet->DriverHandle
); );
if (Storage->ConfigHdr == NULL) { if (Storage->ConfigHdr == NULL) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
@ -1188,7 +1188,7 @@ ParseOpCodes (
case EFI_IFR_SUBTITLE_OP: case EFI_IFR_SUBTITLE_OP:
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm); CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
ASSERT (CurrentStatement != NULL); ASSERT (CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_SUBTITLE *) OpCodeData)->Flags; CurrentStatement->Flags = ((EFI_IFR_SUBTITLE *) OpCodeData)->Flags;
if (Scope != 0) { if (Scope != 0) {
@ -1249,7 +1249,7 @@ ParseOpCodes (
case EFI_IFR_NUMERIC_OP: case EFI_IFR_NUMERIC_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm); CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
ASSERT(CurrentStatement != NULL); ASSERT(CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_ONE_OF *) OpCodeData)->Flags; CurrentStatement->Flags = ((EFI_IFR_ONE_OF *) OpCodeData)->Flags;
Value = &CurrentStatement->HiiValue; Value = &CurrentStatement->HiiValue;
@ -1300,7 +1300,7 @@ ParseOpCodes (
case EFI_IFR_ORDERED_LIST_OP: case EFI_IFR_ORDERED_LIST_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm); CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
ASSERT(CurrentStatement != NULL); ASSERT(CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_ORDERED_LIST *) OpCodeData)->Flags; CurrentStatement->Flags = ((EFI_IFR_ORDERED_LIST *) OpCodeData)->Flags;
CurrentStatement->MaxContainers = ((EFI_IFR_ORDERED_LIST *) OpCodeData)->MaxContainers; CurrentStatement->MaxContainers = ((EFI_IFR_ORDERED_LIST *) OpCodeData)->MaxContainers;
@ -1314,7 +1314,7 @@ ParseOpCodes (
case EFI_IFR_CHECKBOX_OP: case EFI_IFR_CHECKBOX_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm); CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
ASSERT(CurrentStatement != NULL); ASSERT(CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_CHECKBOX *) OpCodeData)->Flags; CurrentStatement->Flags = ((EFI_IFR_CHECKBOX *) OpCodeData)->Flags;
CurrentStatement->StorageWidth = sizeof (BOOLEAN); CurrentStatement->StorageWidth = sizeof (BOOLEAN);
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_BOOLEAN; CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_BOOLEAN;
@ -1363,7 +1363,7 @@ ParseOpCodes (
case EFI_IFR_DATE_OP: case EFI_IFR_DATE_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm); CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
ASSERT(CurrentStatement != NULL); ASSERT(CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_DATE *) OpCodeData)->Flags; CurrentStatement->Flags = ((EFI_IFR_DATE *) OpCodeData)->Flags;
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_DATE; CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_DATE;
@ -1383,7 +1383,7 @@ ParseOpCodes (
case EFI_IFR_TIME_OP: case EFI_IFR_TIME_OP:
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm); CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);
ASSERT(CurrentStatement != NULL); ASSERT(CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_TIME *) OpCodeData)->Flags; CurrentStatement->Flags = ((EFI_IFR_TIME *) OpCodeData)->Flags;
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_TIME; CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_TIME;

View File

@ -387,7 +387,7 @@ GetNumericInput (
InputText[0] = LEFT_NUMERIC_DELIMITER; InputText[0] = LEFT_NUMERIC_DELIMITER;
SetUnicodeMem (InputText + 1, InputWidth, L' '); SetUnicodeMem (InputText + 1, InputWidth, L' ');
ASSERT (InputWidth + 2 < MAX_NUMERIC_INPUT_WIDTH); ASSERT (InputWidth + 2 < MAX_NUMERIC_INPUT_WIDTH);
InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER; InputText[InputWidth + 1] = RIGHT_NUMERIC_DELIMITER;
InputText[InputWidth + 2] = L'\0'; InputText[InputWidth + 2] = L'\0';

View File

@ -31,11 +31,11 @@ UI_MENU_SELECTION *gCurrentSelection;
**/ **/
VOID VOID
ClearLines ( ClearLines (
UINTN LeftColumn, IN UINTN LeftColumn,
UINTN RightColumn, IN UINTN RightColumn,
UINTN TopRow, IN UINTN TopRow,
UINTN BottomRow, IN UINTN BottomRow,
UINTN TextAttribute IN UINTN TextAttribute
) )
{ {
CHAR16 *Buffer; CHAR16 *Buffer;
@ -80,8 +80,8 @@ ClearLines (
**/ **/
VOID VOID
NewStrCat ( NewStrCat (
CHAR16 *Destination, IN OUT CHAR16 *Destination,
CHAR16 *Source IN CHAR16 *Source
) )
{ {
UINTN Length; UINTN Length;
@ -117,7 +117,7 @@ NewStrCat (
**/ **/
UINTN UINTN
GetStringWidth ( GetStringWidth (
CHAR16 *String IN CHAR16 *String
) )
{ {
UINTN Index; UINTN Index;
@ -460,6 +460,7 @@ DisplayForm (
FORM_BROWSER_STATEMENT *Statement; FORM_BROWSER_STATEMENT *Statement;
UINT16 NumberOfLines; UINT16 NumberOfLines;
EFI_STATUS Status; EFI_STATUS Status;
UI_MENU_OPTION *MenuOption;
Handle = Selection->Handle; Handle = Selection->Handle;
MenuItemCount = 0; MenuItemCount = 0;
@ -494,6 +495,7 @@ DisplayForm (
return Status; return Status;
} }
Selection->FormEditable = FALSE;
Link = GetFirstNode (&Selection->Form->StatementListHead); Link = GetFirstNode (&Selection->Form->StatementListHead);
while (!IsNull (&Selection->Form->StatementListHead, Link)) { while (!IsNull (&Selection->Form->StatementListHead, Link)) {
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link); Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
@ -530,8 +532,15 @@ DisplayForm (
// We are NOT!! removing this StringPtr buffer via FreePool since it is being used in the menuoptions, we will do // We are NOT!! removing this StringPtr buffer via FreePool since it is being used in the menuoptions, we will do
// it in UiFreeMenu. // it in UiFreeMenu.
// //
UiAddMenuOption (StringPtr, Selection->Handle, Statement, NumberOfLines, MenuItemCount); MenuOption = UiAddMenuOption (StringPtr, Selection->Handle, Statement, NumberOfLines, MenuItemCount);
MenuItemCount++; MenuItemCount++;
if (MenuOption->IsQuestion && !MenuOption->ReadOnly) {
//
// At least one item is not readonly, this Form is considered as editable
//
Selection->FormEditable = TRUE;
}
} }
Link = GetNextNode (&Selection->Form->StatementListHead, Link); Link = GetNextNode (&Selection->Form->StatementListHead, Link);
@ -553,7 +562,6 @@ InitializeBrowserStrings (
VOID VOID
) )
{ {
gFunctionOneString = GetToken (STRING_TOKEN (FUNCTION_ONE_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);
@ -596,7 +604,6 @@ FreeBrowserStrings (
VOID VOID
) )
{ {
FreePool (gFunctionOneString);
FreePool (gFunctionNineString); FreePool (gFunctionNineString);
FreePool (gFunctionTenString); FreePool (gFunctionTenString);
FreePool (gEnterString); FreePool (gEnterString);
@ -632,12 +639,14 @@ FreeBrowserStrings (
/** /**
Update key's help imformation. Update key's help imformation.
@param Selection Tell setup browser the information about the Selection
@param MenuOption The Menu option @param MenuOption The Menu option
@param Selected Whether or not a tag be selected @param Selected Whether or not a tag be selected
**/ **/
VOID VOID
UpdateKeyHelp ( UpdateKeyHelp (
IN UI_MENU_SELECTION *Selection,
IN UI_MENU_OPTION *MenuOption, IN UI_MENU_OPTION *MenuOption,
IN BOOLEAN Selected IN BOOLEAN Selected
) )
@ -676,9 +685,10 @@ UpdateKeyHelp (
if (!Selected) { if (!Selected) {
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) { if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString); if (Selection->FormEditable) {
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString); PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString); PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
}
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString); PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
} }
@ -732,9 +742,10 @@ UpdateKeyHelp (
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND); ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) { if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString); if (Selection->FormEditable) {
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString); PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString); PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
}
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString); PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
} }
@ -752,9 +763,10 @@ UpdateKeyHelp (
if (!Selected) { if (!Selected) {
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) { if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString); if (Selection->FormEditable) {
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString); PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString); PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
}
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString); PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
} }

View File

@ -819,7 +819,7 @@ ProcessOptions (
TempString = AllocateCopyPool ((Maximum + 1) * sizeof (CHAR16), Question->BufferValue); TempString = AllocateCopyPool ((Maximum + 1) * sizeof (CHAR16), Question->BufferValue);
ASSERT (TempString != NULL); ASSERT (TempString != NULL);
TempString[Maximum] = L'\0'; TempString[Maximum] = L'\0';
if (StrCmp (StringPtr, TempString) != 0) { if (StrCmp (StringPtr, TempString) != 0) {
@ -965,7 +965,7 @@ ProcessHelpString (
UINTN *OldIndexArray; UINTN *OldIndexArray;
BlockWidth = (UINTN) gHelpBlockWidth - 1; BlockWidth = (UINTN) gHelpBlockWidth - 1;
// //
// every three elements of IndexArray form a screen-line of string:[ IndexArray[i*3], IndexArray[i*3+1] ) // every three elements of IndexArray form a screen-line of string:[ IndexArray[i*3], IndexArray[i*3+1] )
// IndexArray[i*3+2] stores the initial glyph width of single character. to save this is because we want // IndexArray[i*3+2] stores the initial glyph width of single character. to save this is because we want
@ -992,7 +992,7 @@ ProcessHelpString (
OldIndexArray = IndexArray; OldIndexArray = IndexArray;
IndexArray = AllocatePool (AllocateSize * sizeof (UINTN) * 3); IndexArray = AllocatePool (AllocateSize * sizeof (UINTN) * 3);
ASSERT (IndexArray != NULL); ASSERT (IndexArray != NULL);
CopyMem (IndexArray, OldIndexArray, LineCount * sizeof (UINTN) * 3); CopyMem (IndexArray, OldIndexArray, LineCount * sizeof (UINTN) * 3);
FreePool (OldIndexArray); FreePool (OldIndexArray);
} }

View File

@ -44,7 +44,6 @@ BOOLEAN gDownArrow;
// //
// Browser Global Strings // Browser Global Strings
// //
CHAR16 *gFunctionOneString;
CHAR16 *gFunctionNineString; CHAR16 *gFunctionNineString;
CHAR16 *gFunctionTenString; CHAR16 *gFunctionTenString;
CHAR16 *gEnterString; CHAR16 *gEnterString;
@ -2500,10 +2499,6 @@ InitializeFormSet (
// //
// Function key prompt can not be displayed if the function key has been disabled. // Function key prompt can not be displayed if the function key has been disabled.
// //
if ((gFunctionKeySetting & FUNCTION_ONE) != FUNCTION_ONE) {
gFunctionOneString = 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);
} }

View File

@ -71,9 +71,8 @@ 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_NINE | FUNCTION_TEN) #define DEFAULT_FUNCTION_KEY_SETTING (FUNCTION_NINE | FUNCTION_TEN)
#define FUNCTION_ONE (1 << 0)
#define FUNCTION_NINE (1 << 2) #define FUNCTION_NINE (1 << 2)
#define FUNCTION_TEN (1 << 3) #define FUNCTION_TEN (1 << 3)
@ -466,7 +465,6 @@ extern FORM_BROWSER_FORMSET *gOldFormSet;
// //
// Browser Global Strings // Browser Global Strings
// //
extern CHAR16 *gFunctionOneString;
extern CHAR16 *gFunctionNineString; extern CHAR16 *gFunctionNineString;
extern CHAR16 *gFunctionTenString; extern CHAR16 *gFunctionTenString;
extern CHAR16 *gEnterString; extern CHAR16 *gEnterString;

View File

@ -7,7 +7,7 @@
# 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
# http://opensource.org/licenses/bsd-license.php # http://opensource.org/licenses/bsd-license.php
# #
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# #

View File

@ -558,8 +558,10 @@ UiWaitForSingleEvent (
@param NumberOfLines Display lines for this Menu Option. @param NumberOfLines Display lines for this Menu Option.
@param MenuItemCount The index for this Option in the Menu. @param MenuItemCount The index for this Option in the Menu.
@retval Pointer Pointer to the added Menu Option.
**/ **/
VOID UI_MENU_OPTION *
UiAddMenuOption ( UiAddMenuOption (
IN CHAR16 *String, IN CHAR16 *String,
IN EFI_HII_HANDLE Handle, IN EFI_HII_HANDLE Handle,
@ -573,6 +575,7 @@ UiAddMenuOption (
UINTN Count; UINTN Count;
Count = 1; Count = 1;
MenuOption = NULL;
if (Statement->Operand == EFI_IFR_DATE_OP || Statement->Operand == EFI_IFR_TIME_OP) { if (Statement->Operand == EFI_IFR_DATE_OP || Statement->Operand == EFI_IFR_TIME_OP) {
// //
@ -617,6 +620,26 @@ UiAddMenuOption (
MenuOption->GrayOut = Statement->GrayOutExpression->Result.Value.b; MenuOption->GrayOut = Statement->GrayOutExpression->Result.Value.b;
} }
switch (Statement->Operand) {
case EFI_IFR_ORDERED_LIST_OP:
case EFI_IFR_ONE_OF_OP:
case EFI_IFR_NUMERIC_OP:
case EFI_IFR_TIME_OP:
case EFI_IFR_DATE_OP:
case EFI_IFR_CHECKBOX_OP:
case EFI_IFR_PASSWORD_OP:
case EFI_IFR_STRING_OP:
//
// User could change the value of these items
//
MenuOption->IsQuestion = TRUE;
break;
default:
MenuOption->IsQuestion = FALSE;
break;
}
if ((Statement->ValueExpression != NULL) || if ((Statement->ValueExpression != NULL) ||
((Statement->QuestionFlags & EFI_IFR_FLAG_READ_ONLY) != 0)) { ((Statement->QuestionFlags & EFI_IFR_FLAG_READ_ONLY) != 0)) {
MenuOption->ReadOnly = TRUE; MenuOption->ReadOnly = TRUE;
@ -624,6 +647,8 @@ UiAddMenuOption (
InsertTailList (&Menu, &MenuOption->Link); InsertTailList (&Menu, &MenuOption->Link);
} }
return MenuOption;
} }
@ -2245,7 +2270,7 @@ UiDisplayMenu (
} }
} }
UpdateKeyHelp (MenuOption, FALSE); UpdateKeyHelp (Selection, MenuOption, FALSE);
// //
// Clear reverse attribute // Clear reverse attribute
@ -2384,8 +2409,7 @@ UiDisplayMenu (
break; break;
case CHAR_NULL: case CHAR_NULL:
if (((Key.ScanCode == SCAN_F1) && ((gFunctionKeySetting & FUNCTION_ONE) != FUNCTION_ONE)) || if (((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))
) { ) {
// //
@ -2589,16 +2613,16 @@ UiDisplayMenu (
// //
// Editable Questions: oneof, ordered list, checkbox, numeric, string, password // Editable Questions: oneof, ordered list, checkbox, numeric, string, password
// //
UpdateKeyHelp (MenuOption, TRUE); UpdateKeyHelp (Selection, MenuOption, TRUE);
Status = ProcessOptions (Selection, MenuOption, TRUE, &OptionString); Status = ProcessOptions (Selection, MenuOption, TRUE, &OptionString);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
Repaint = TRUE; Repaint = TRUE;
NewLine = TRUE; NewLine = TRUE;
UpdateKeyHelp (MenuOption, FALSE); UpdateKeyHelp (Selection, MenuOption, FALSE);
} else { } else {
Selection->Action = UI_ACTION_REFRESH_FORM; Selection->Action = UI_ACTION_REFRESH_FORM;
} }
if (OptionString != NULL) { if (OptionString != NULL) {
FreePool (OptionString); FreePool (OptionString);
@ -3078,6 +3102,12 @@ UiDisplayMenu (
case CfUiDefault: case CfUiDefault:
ControlFlag = CfCheckSelection; ControlFlag = CfCheckSelection;
if (!Selection->FormEditable) {
//
// This Form is not editable, ignore the F9 (reset to default)
//
break;
}
Status = ExtractFormDefault (Selection->FormSet, Selection->Form, DefaultId); Status = ExtractFormDefault (Selection->FormSet, Selection->Form, DefaultId);

View File

@ -108,6 +108,11 @@ typedef struct {
FORM_BROWSER_FORMSET *FormSet; FORM_BROWSER_FORMSET *FormSet;
FORM_BROWSER_FORM *Form; FORM_BROWSER_FORM *Form;
FORM_BROWSER_STATEMENT *Statement; FORM_BROWSER_STATEMENT *Statement;
//
// Whether the Form is editable
//
BOOLEAN FormEditable;
} UI_MENU_SELECTION; } UI_MENU_SELECTION;
#define UI_MENU_OPTION_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'm') #define UI_MENU_OPTION_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'm')
@ -140,6 +145,11 @@ typedef struct {
BOOLEAN GrayOut; BOOLEAN GrayOut;
BOOLEAN ReadOnly; BOOLEAN ReadOnly;
//
// Whether user could change value of this item
//
BOOLEAN IsQuestion;
} UI_MENU_OPTION; } UI_MENU_OPTION;
#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)
@ -280,8 +290,10 @@ UiFreeRefreshList (
@param NumberOfLines Display lines for this Menu Option. @param NumberOfLines Display lines for this Menu Option.
@param MenuItemCount The index for this Option in the Menu. @param MenuItemCount The index for this Option in the Menu.
@retval Pointer Pointer to the added Menu Option.
**/ **/
VOID UI_MENU_OPTION *
UiAddMenuOption ( UiAddMenuOption (
IN CHAR16 *String, IN CHAR16 *String,
IN EFI_HII_HANDLE Handle, IN EFI_HII_HANDLE Handle,
@ -589,12 +601,14 @@ ProcessHelpString (
/** /**
Update key's help imformation. Update key's help imformation.
@param Selection Tell setup browser the information about the Selection
@param MenuOption The Menu option @param MenuOption The Menu option
@param Selected Whether or not a tag be selected @param Selected Whether or not a tag be selected
**/ **/
VOID VOID
UpdateKeyHelp ( UpdateKeyHelp (
IN UI_MENU_SELECTION *Selection,
IN UI_MENU_OPTION *MenuOption, IN UI_MENU_OPTION *MenuOption,
IN BOOLEAN Selected IN BOOLEAN Selected
); );
@ -611,11 +625,11 @@ UpdateKeyHelp (
**/ **/
VOID VOID
ClearLines ( ClearLines (
UINTN LeftColumn, IN UINTN LeftColumn,
UINTN RightColumn, IN UINTN RightColumn,
UINTN TopRow, IN UINTN TopRow,
UINTN BottomRow, IN UINTN BottomRow,
UINTN TextAttribute IN UINTN TextAttribute
); );
/** /**
@ -634,7 +648,7 @@ ClearLines (
**/ **/
UINTN UINTN
GetStringWidth ( GetStringWidth (
CHAR16 *String IN CHAR16 *String
); );
/** /**
@ -683,8 +697,8 @@ GetWidth (
**/ **/
VOID VOID
NewStrCat ( NewStrCat (
CHAR16 *Destination, IN OUT CHAR16 *Destination,
CHAR16 *Source IN CHAR16 *Source
); );
/** /**