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
IfrStrToUpper (
CHAR16 *String
IN CHAR16 *String
)
{
while (*String != 0) {

View File

@ -141,7 +141,7 @@ UpdateCheckBoxStringToken (
**/
BOOLEAN
IsNextOpCodeGuidedVarEqName (
UINT8 *OpCodeData
IN UINT8 *OpCodeData
)
{
//

View File

@ -31,11 +31,11 @@ UI_MENU_SELECTION *gCurrentSelection;
**/
VOID
ClearLines (
UINTN LeftColumn,
UINTN RightColumn,
UINTN TopRow,
UINTN BottomRow,
UINTN TextAttribute
IN UINTN LeftColumn,
IN UINTN RightColumn,
IN UINTN TopRow,
IN UINTN BottomRow,
IN UINTN TextAttribute
)
{
CHAR16 *Buffer;
@ -80,8 +80,8 @@ ClearLines (
**/
VOID
NewStrCat (
CHAR16 *Destination,
CHAR16 *Source
IN OUT CHAR16 *Destination,
IN CHAR16 *Source
)
{
UINTN Length;
@ -117,7 +117,7 @@ NewStrCat (
**/
UINTN
GetStringWidth (
CHAR16 *String
IN CHAR16 *String
)
{
UINTN Index;
@ -460,6 +460,7 @@ DisplayForm (
FORM_BROWSER_STATEMENT *Statement;
UINT16 NumberOfLines;
EFI_STATUS Status;
UI_MENU_OPTION *MenuOption;
Handle = Selection->Handle;
MenuItemCount = 0;
@ -494,6 +495,7 @@ DisplayForm (
return Status;
}
Selection->FormEditable = FALSE;
Link = GetFirstNode (&Selection->Form->StatementListHead);
while (!IsNull (&Selection->Form->StatementListHead, 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
// it in UiFreeMenu.
//
UiAddMenuOption (StringPtr, Selection->Handle, Statement, NumberOfLines, MenuItemCount);
MenuOption = UiAddMenuOption (StringPtr, Selection->Handle, Statement, NumberOfLines, 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);
@ -553,7 +562,6 @@ InitializeBrowserStrings (
VOID
)
{
gFunctionOneString = GetToken (STRING_TOKEN (FUNCTION_ONE_STRING), gHiiHandle);
gFunctionNineString = GetToken (STRING_TOKEN (FUNCTION_NINE_STRING), gHiiHandle);
gFunctionTenString = GetToken (STRING_TOKEN (FUNCTION_TEN_STRING), gHiiHandle);
gEnterString = GetToken (STRING_TOKEN (ENTER_STRING), gHiiHandle);
@ -596,7 +604,6 @@ FreeBrowserStrings (
VOID
)
{
FreePool (gFunctionOneString);
FreePool (gFunctionNineString);
FreePool (gFunctionTenString);
FreePool (gEnterString);
@ -632,12 +639,14 @@ FreeBrowserStrings (
/**
Update key's help imformation.
@param Selection Tell setup browser the information about the Selection
@param MenuOption The Menu option
@param Selected Whether or not a tag be selected
**/
VOID
UpdateKeyHelp (
IN UI_MENU_SELECTION *Selection,
IN UI_MENU_OPTION *MenuOption,
IN BOOLEAN Selected
)
@ -676,9 +685,10 @@ UpdateKeyHelp (
if (!Selected) {
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString);
if (Selection->FormEditable) {
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
}
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
}
@ -732,9 +742,10 @@ UpdateKeyHelp (
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString);
if (Selection->FormEditable) {
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
}
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
}
@ -752,9 +763,10 @@ UpdateKeyHelp (
if (!Selected) {
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString);
if (Selection->FormEditable) {
PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
}
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
}

View File

@ -44,7 +44,6 @@ BOOLEAN gDownArrow;
//
// Browser Global Strings
//
CHAR16 *gFunctionOneString;
CHAR16 *gFunctionNineString;
CHAR16 *gFunctionTenString;
CHAR16 *gEnterString;
@ -2500,10 +2499,6 @@ InitializeFormSet (
//
// 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) {
gFunctionNineString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
}

View File

@ -71,9 +71,8 @@ extern UINT8 SetupBrowserStrings[];
// Definition for function key setting
//
#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_TEN (1 << 3)
@ -466,7 +465,6 @@ extern FORM_BROWSER_FORMSET *gOldFormSet;
//
// Browser Global Strings
//
extern CHAR16 *gFunctionOneString;
extern CHAR16 *gFunctionNineString;
extern CHAR16 *gFunctionTenString;
extern CHAR16 *gEnterString;

View File

@ -558,8 +558,10 @@ UiWaitForSingleEvent (
@param NumberOfLines Display lines for this Menu Option.
@param MenuItemCount The index for this Option in the Menu.
@retval Pointer Pointer to the added Menu Option.
**/
VOID
UI_MENU_OPTION *
UiAddMenuOption (
IN CHAR16 *String,
IN EFI_HII_HANDLE Handle,
@ -573,6 +575,7 @@ UiAddMenuOption (
UINTN Count;
Count = 1;
MenuOption = NULL;
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;
}
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) ||
((Statement->QuestionFlags & EFI_IFR_FLAG_READ_ONLY) != 0)) {
MenuOption->ReadOnly = TRUE;
@ -624,6 +647,8 @@ UiAddMenuOption (
InsertTailList (&Menu, &MenuOption->Link);
}
return MenuOption;
}
@ -2245,7 +2270,7 @@ UiDisplayMenu (
}
}
UpdateKeyHelp (MenuOption, FALSE);
UpdateKeyHelp (Selection, MenuOption, FALSE);
//
// Clear reverse attribute
@ -2384,8 +2409,7 @@ UiDisplayMenu (
break;
case CHAR_NULL:
if (((Key.ScanCode == SCAN_F1) && ((gFunctionKeySetting & FUNCTION_ONE) != FUNCTION_ONE)) ||
((Key.ScanCode == SCAN_F9) && ((gFunctionKeySetting & FUNCTION_NINE) != FUNCTION_NINE)) ||
if (((Key.ScanCode == SCAN_F9) && ((gFunctionKeySetting & FUNCTION_NINE) != FUNCTION_NINE)) ||
((Key.ScanCode == SCAN_F10) && ((gFunctionKeySetting & FUNCTION_TEN) != FUNCTION_TEN))
) {
//
@ -2589,13 +2613,13 @@ UiDisplayMenu (
//
// Editable Questions: oneof, ordered list, checkbox, numeric, string, password
//
UpdateKeyHelp (MenuOption, TRUE);
UpdateKeyHelp (Selection, MenuOption, TRUE);
Status = ProcessOptions (Selection, MenuOption, TRUE, &OptionString);
if (EFI_ERROR (Status)) {
Repaint = TRUE;
NewLine = TRUE;
UpdateKeyHelp (MenuOption, FALSE);
UpdateKeyHelp (Selection, MenuOption, FALSE);
} else {
Selection->Action = UI_ACTION_REFRESH_FORM;
}
@ -3078,6 +3102,12 @@ UiDisplayMenu (
case CfUiDefault:
ControlFlag = CfCheckSelection;
if (!Selection->FormEditable) {
//
// This Form is not editable, ignore the F9 (reset to default)
//
break;
}
Status = ExtractFormDefault (Selection->FormSet, Selection->Form, DefaultId);

View File

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