From 4f33c8384d80b419e2ed0f4ddd25b3e3cb643fb3 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Tue, 28 Jun 2011 05:01:49 +0000 Subject: [PATCH] Restore the whole form set to default value when user enter F9, old logical only for form level. Signed-off-by:ydong10 Reviewed-by:lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11911 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/SetupBrowserDxe/Setup.c | 79 ++++++++++--------- .../Universal/SetupBrowserDxe/Setup.h | 6 +- MdeModulePkg/Universal/SetupBrowserDxe/Ui.c | 12 +-- 3 files changed, 48 insertions(+), 49 deletions(-) diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c index fa721f6d16..c65fd03a0e 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c @@ -2538,56 +2538,65 @@ GetQuestionDefault ( /** - Reset Questions in a Form to their default value. + Reset Questions in a Formset to their default value. @param FormSet FormSet data structure. - @param Form The Form which to be reset. @param DefaultId The Class of the default. @retval EFI_SUCCESS The function completed successfully. **/ EFI_STATUS -ExtractFormDefault ( +ExtractFormSetDefault ( IN FORM_BROWSER_FORMSET *FormSet, - IN FORM_BROWSER_FORM *Form, IN UINT16 DefaultId ) { EFI_STATUS Status; - LIST_ENTRY *Link; + LIST_ENTRY *FormLink; + LIST_ENTRY *StatementLink; FORM_BROWSER_STATEMENT *Question; + FORM_BROWSER_FORM *Form; - Link = GetFirstNode (&Form->StatementListHead); - while (!IsNull (&Form->StatementListHead, Link)) { - Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link); - Link = GetNextNode (&Form->StatementListHead, Link); + FormLink = GetFirstNode (&FormSet->FormListHead); + while (!IsNull (&FormSet->FormListHead, FormLink)) { + Form = FORM_BROWSER_FORM_FROM_LINK (FormLink); + + // + // Extract Form default + // + StatementLink = GetFirstNode (&Form->StatementListHead); + while (!IsNull (&Form->StatementListHead, StatementLink)) { + Question = FORM_BROWSER_STATEMENT_FROM_LINK (StatementLink); + StatementLink = GetNextNode (&Form->StatementListHead, StatementLink); - // - // If Question is disabled, don't reset it to default - // - if (Question->DisableExpression != NULL) { - Status = EvaluateExpression (FormSet, Form, Question->DisableExpression); - if (!EFI_ERROR (Status) && Question->DisableExpression->Result.Value.b) { + // + // If Question is disabled, don't reset it to default + // + if (Question->DisableExpression != NULL) { + Status = EvaluateExpression (FormSet, Form, Question->DisableExpression); + if (!EFI_ERROR (Status) && Question->DisableExpression->Result.Value.b) { + continue; + } + } + + // + // Reset Question to its default value + // + Status = GetQuestionDefault (FormSet, Form, Question, DefaultId); + if (EFI_ERROR (Status)) { continue; } - } - // - // Reset Question to its default value - // - Status = GetQuestionDefault (FormSet, Form, Question, DefaultId); - if (EFI_ERROR (Status)) { - continue; - } - - // - // Synchronize Buffer storage's Edit buffer - // - if ((Question->Storage != NULL) && - (Question->Storage->Type != EFI_HII_VARSTORE_EFI_VARIABLE)) { - SetQuestionValue (FormSet, Form, Question, TRUE); + // + // Synchronize Buffer storage's Edit buffer + // + if ((Question->Storage != NULL) && + (Question->Storage->Type != EFI_HII_VARSTORE_EFI_VARIABLE)) { + SetQuestionValue (FormSet, Form, Question, TRUE); + } } + FormLink = GetNextNode (&FormSet->FormListHead, FormLink); } return EFI_SUCCESS; @@ -2848,13 +2857,9 @@ InitializeCurrentSetting ( // // Extract default from IFR binary // - Link = GetFirstNode (&FormSet->FormListHead); - while (!IsNull (&FormSet->FormListHead, Link)) { - Form = FORM_BROWSER_FORM_FROM_LINK (Link); - - Status = ExtractFormDefault (FormSet, Form, EFI_HII_DEFAULT_CLASS_STANDARD); - - Link = GetNextNode (&FormSet->FormListHead, Link); + Status = ExtractFormSetDefault (FormSet, EFI_HII_DEFAULT_CLASS_STANDARD); + if (EFI_ERROR (Status)) { + return Status; } // diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h index 40d18de690..d83940e979 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h @@ -1014,19 +1014,17 @@ InitializeFormSet ( ); /** - Reset Questions in a Form to their default value. + Reset Questions in a Formset to their default value. @param FormSet FormSet data structure. - @param Form The Form which to be reset. @param DefaultId The Class of the default. @retval EFI_SUCCESS The function completed successfully. **/ EFI_STATUS -ExtractFormDefault ( +ExtractFormSetDefault ( IN FORM_BROWSER_FORMSET *FormSet, - IN FORM_BROWSER_FORM *Form, IN UINT16 DefaultId ); diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c index 4609bab86c..755fb3b2bc 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c @@ -3234,14 +3234,10 @@ 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); + // + // Reset to default values for the whole formset + // + Status = ExtractFormSetDefault (Selection->FormSet, DefaultId); if (!EFI_ERROR (Status)) { Selection->Action = UI_ACTION_REFRESH_FORM;