MdeModluePkg: Enable refresh opcode to refresh the entire form.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17334 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Eric Dong 2015-05-06 09:29:39 +00:00 committed by ydong10
parent e2a5feb9d6
commit 790447b2a5
3 changed files with 83 additions and 6 deletions

View File

@ -2479,8 +2479,24 @@ ParseOpCodes (
// Refresh guid.
//
case EFI_IFR_REFRESH_ID_OP:
ASSERT (ParentStatement != NULL);
CopyMem (&ParentStatement->RefreshGuid, &((EFI_IFR_REFRESH_ID *) OpCodeData)->RefreshEventGroupId, sizeof (EFI_GUID));
//
// Get ScopeOpcode from top of stack
//
PopScope (&ScopeOpCode);
PushScope (ScopeOpCode);
switch (ScopeOpCode) {
case EFI_IFR_FORM_OP:
case EFI_IFR_FORM_MAP_OP:
ASSERT (CurrentForm != NULL);
CopyMem (&CurrentForm->RefreshGuid, &((EFI_IFR_REFRESH_ID *) OpCodeData)->RefreshEventGroupId, sizeof (EFI_GUID));
break;
default:
ASSERT (ParentStatement != NULL);
CopyMem (&ParentStatement->RefreshGuid, &((EFI_IFR_REFRESH_ID *) OpCodeData)->RefreshEventGroupId, sizeof (EFI_GUID));
break;
}
break;
//

View File

@ -178,7 +178,7 @@ UpdateStatement (
**/
VOID
EFIAPI
RefreshEventNotify(
RefreshEventNotifyForStatement(
IN EFI_EVENT Event,
IN VOID *Context
)
@ -190,6 +190,23 @@ RefreshEventNotify(
gBS->SignalEvent (mValueChangedEvent);
}
/**
Refresh the questions within this form.
@param Event The event which has this function related.
@param Context The input context info related to this event or the status code return to the caller.
**/
VOID
EFIAPI
RefreshEventNotifyForForm(
IN EFI_EVENT Event,
IN VOID *Context
)
{
gCurrentSelection->Action = UI_ACTION_REFRESH_FORMSET;
gBS->SignalEvent (mValueChangedEvent);
}
/**
Create refresh hook event for statement which has refresh event or interval.
@ -198,7 +215,7 @@ RefreshEventNotify(
**/
VOID
CreateRefreshEvent (
CreateRefreshEventForStatement (
IN FORM_BROWSER_STATEMENT *Statement
)
{
@ -212,7 +229,7 @@ CreateRefreshEvent (
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
RefreshEventNotify,
RefreshEventNotifyForStatement,
Statement,
&Statement->RefreshGuid,
&RefreshEvent);
@ -224,6 +241,39 @@ CreateRefreshEvent (
InsertTailList(&mRefreshEventList, &EventNode->Link);
}
/**
Create refresh hook event for statement which has refresh event or interval.
@param Statement The statement need to check.
**/
VOID
CreateRefreshEventForForm (
IN FORM_BROWSER_FORM *Form
)
{
EFI_STATUS Status;
EFI_EVENT RefreshEvent;
FORM_BROWSER_REFRESH_EVENT_NODE *EventNode;
//
// If question has refresh guid, create the notify function.
//
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
RefreshEventNotifyForForm,
Form,
&Form->RefreshGuid,
&RefreshEvent);
ASSERT_EFI_ERROR (Status);
EventNode = AllocateZeroPool (sizeof (FORM_BROWSER_REFRESH_EVENT_NODE));
ASSERT (EventNode != NULL);
EventNode->RefreshEvent = RefreshEvent;
InsertTailList(&mRefreshEventList, &EventNode->Link);
}
/**
Initialize the Display statement structure data.
@ -308,7 +358,7 @@ InitializeDisplayStatement (
// Create the refresh event process function.
//
if (!CompareGuid (&Statement->RefreshGuid, &gZeroGuid)) {
CreateRefreshEvent (Statement);
CreateRefreshEventForStatement (Statement);
}
//
@ -559,6 +609,16 @@ AddStatementToDisplayForm (
InsertTailList(&mRefreshEventList, &EventNode->Link);
}
//
// Create the refresh event process function for Form.
//
if (!CompareGuid (&gCurrentSelection->Form->RefreshGuid, &gZeroGuid)) {
CreateRefreshEventForForm (gCurrentSelection->Form);
if (gDisplayFormData.FormRefreshEvent == NULL) {
gDisplayFormData.FormRefreshEvent = mValueChangedEvent;
}
}
//
// Update hotkey list field.
//

View File

@ -406,6 +406,7 @@ typedef struct {
BOOLEAN ModalForm; // Whether this is a modal form.
BOOLEAN Locked; // Whether this form is locked.
EFI_GUID RefreshGuid; // Form refresh event guid.
LIST_ENTRY FormViewListHead; // List of type FORMID_INFO is Browser View Form History List.
LIST_ENTRY ExpressionListHead; // List of Expressions (FORM_EXPRESSION)