diff options
author | Eric Dong <eric.dong@intel.com> | 2013-08-12 04:49:48 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-08-12 04:49:48 +0000 |
commit | 5a9f73bf065eda6b830445dc907e778f4a13d8d7 (patch) | |
tree | 7fb5573ec7e6840bc285d4b6ac82568a8c73e6b8 /MdeModulePkg/Universal/DisplayEngineDxe | |
parent | 6b1ac44423a02a03e084215e148c577f0244304b (diff) | |
download | edk2-platforms-5a9f73bf065eda6b830445dc907e778f4a13d8d7.tar.xz |
Refine the code logic for browser and display engine.
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@14543 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/DisplayEngineDxe')
5 files changed, 76 insertions, 70 deletions
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf b/MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf index 2170369d9e..323fcadb85 100644 --- a/MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf +++ b/MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf @@ -32,7 +32,6 @@ FormDisplayStr.uni
FormDisplay.c
FormDisplay.h
- Print.c
ProcessOptions.c
InputHandler.c
@@ -65,6 +64,3 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserGrayOutTextStatement ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdBrowerGrayOutReadOnlyMenu ## CONSUMES
-[BuildOptions]
- MSFT:*_*_*_CC_FLAGS = /Od
-
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c index f6322293fc..a07cc75a47 100644 --- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c +++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c @@ -97,9 +97,9 @@ EFI_GUID gDisplayEngineGuid = { 0xE38C1029, 0xE38F, 0x45b9, {0x8F, 0x0D, 0xE2, 0xE6, 0x0B, 0xC9, 0xB2, 0x62}
};
+FORM_ENTRY_INFO gFormEntryInfo;
UINTN gSequence;
EFI_SCREEN_DESCRIPTOR gStatementDimensions;
-EFI_SCREEN_DESCRIPTOR gOldStatementDimensions = {0};
BOOLEAN mStatementLayoutIsChanged = TRUE;
USER_INPUT *gUserInput;
FORM_DISPLAY_ENGINE_FORM *gFormData;
@@ -107,6 +107,8 @@ EFI_HII_HANDLE gHiiHandle; UINT16 gDirection;
LIST_ENTRY gMenuOption;
DISPLAY_HIGHLIGHT_MENU_INFO gHighligthMenuInfo = {0};
+BOOLEAN mIsFirstForm = TRUE;
+FORM_ENTRY_INFO gOldFormEntry = {0};
//
// Browser Global Strings
@@ -138,7 +140,7 @@ FORM_DISPLAY_DRIVER_PRIVATE_DATA mPrivateData = { NULL,
{
FormDisplay,
- ClearDisplayPage,
+ DriverClearDisplayPage,
ConfirmDataChange
}
};
@@ -2978,6 +2980,7 @@ UiDisplayMenu ( break;
case CfExit:
+ gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
if (HelpString != NULL) {
FreePool (HelpString);
}
@@ -3096,19 +3099,68 @@ FormDisplay ( return Status;
}
- if (CompareMem (&gOldStatementDimensions, &gStatementDimensions, sizeof (gStatementDimensions)) == 0) {
- mStatementLayoutIsChanged = FALSE;
- } else {
+ //
+ // Check whether layout is changed.
+ //
+ if (mIsFirstForm
+ || (gOldFormEntry.HiiHandle != FormData->HiiHandle)
+ || (!CompareGuid (&gOldFormEntry.FormSetGuid, &FormData->FormSetGuid))
+ || (gOldFormEntry.FormId != FormData->FormId)) {
mStatementLayoutIsChanged = TRUE;
- CopyMem (&gOldStatementDimensions, &gStatementDimensions, sizeof (gStatementDimensions));
+ } else {
+ mStatementLayoutIsChanged = FALSE;
}
Status = UiDisplayMenu(FormData);
+
+ //
+ // Backup last form info.
+ //
+ mIsFirstForm = FALSE;
+ gOldFormEntry.HiiHandle = FormData->HiiHandle;
+ CopyGuid (&gOldFormEntry.FormSetGuid, &FormData->FormSetGuid);
+ gOldFormEntry.FormId = FormData->FormId;
return Status;
}
/**
+ Clear Screen to the initial state.
+**/
+VOID
+EFIAPI
+DriverClearDisplayPage (
+ VOID
+ )
+{
+ ClearDisplayPage ();
+ mIsFirstForm = TRUE;
+}
+
+/**
+ Set Buffer to Value for Size bytes.
+
+ @param Buffer Memory to set.
+ @param Size Number of bytes to set
+ @param Value Value of the set operation.
+
+**/
+VOID
+SetUnicodeMem (
+ IN VOID *Buffer,
+ IN UINTN Size,
+ IN CHAR16 Value
+ )
+{
+ CHAR16 *Ptr;
+
+ Ptr = Buffer;
+ while ((Size--) != 0) {
+ *(Ptr++) = Value;
+ }
+}
+
+/**
Initialize Setup Browser driver.
@param ImageHandle The image handle.
@@ -3153,6 +3205,9 @@ InitializeDisplayEngine ( ASSERT_EFI_ERROR (Status);
InitializeDisplayStrings();
+
+ ZeroMem (&gHighligthMenuInfo, sizeof (gHighligthMenuInfo));
+ ZeroMem (&gOldFormEntry, sizeof (gOldFormEntry));
//
// Use BrowserEx2 protocol to register HotKey.
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h index ad4684efc3..45bcadc7e6 100644 --- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h +++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h @@ -554,6 +554,15 @@ FormDisplay ( );
/**
+ Clear Screen to the initial state.
+**/
+VOID
+EFIAPI
+DriverClearDisplayPage (
+ VOID
+ );
+
+/**
Exit Display and Clear Screen to the original state.
**/
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c index 607f0df83c..a58e12f12c 100644 --- a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c +++ b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c @@ -1045,16 +1045,16 @@ IsValuesEqual ( switch (Type) {
case EFI_IFR_TYPE_BOOLEAN:
case EFI_IFR_TYPE_NUM_SIZE_8:
- return Value1->u8 == Value2->u8;
+ return (BOOLEAN) (Value1->u8 == Value2->u8);
case EFI_IFR_TYPE_NUM_SIZE_16:
- return Value1->u16 == Value2->u16;
-
+ return (BOOLEAN) (Value1->u16 == Value2->u16);
+
case EFI_IFR_TYPE_NUM_SIZE_32:
- return Value1->u32 == Value2->u32;
-
+ return (BOOLEAN) (Value1->u32 == Value2->u32);
+
case EFI_IFR_TYPE_NUM_SIZE_64:
- return Value1->u64 == Value2->u64;
+ return (BOOLEAN) (Value1->u64 == Value2->u64);
default:
ASSERT (FALSE);
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/Print.c b/MdeModulePkg/Universal/DisplayEngineDxe/Print.c deleted file mode 100644 index f5a95c4ab1..0000000000 --- a/MdeModulePkg/Universal/DisplayEngineDxe/Print.c +++ /dev/null @@ -1,54 +0,0 @@ -/** @file
-Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
-simple implemenation of SPrint() and Print() to support debug.
-
-You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
-time. This makes the implementation very simple.
-
-VSPrint, Print, SPrint format specification has the follwoing form
-
-%type
-
-type:
- 'S','s' - argument is an Unicode string
- 'c' - argument is an ascii character
- '%' - Print a %
-
-
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "FormDisplay.h"
-
-
-/**
- Set Buffer to Value for Size bytes.
-
- @param Buffer Memory to set.
- @param Size Number of bytes to set
- @param Value Value of the set operation.
-
-**/
-VOID
-SetUnicodeMem (
- IN VOID *Buffer,
- IN UINTN Size,
- IN CHAR16 Value
- )
-{
- CHAR16 *Ptr;
-
- Ptr = Buffer;
- while ((Size--) != 0) {
- *(Ptr++) = Value;
- }
-}
-
|