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
This commit is contained in:
Eric Dong
2013-08-12 04:49:48 +00:00
committed by ydong10
parent 6b1ac44423
commit 5a9f73bf06
20 changed files with 218 additions and 8165 deletions

View File

@@ -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

View File

@@ -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,18 +3099,67 @@ 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.
@@ -3153,6 +3205,9 @@ InitializeDisplayEngine (
ASSERT_EFI_ERROR (Status);
InitializeDisplayStrings();
ZeroMem (&gHighligthMenuInfo, sizeof (gHighligthMenuInfo));
ZeroMem (&gOldFormEntry, sizeof (gOldFormEntry));
//
// Use BrowserEx2 protocol to register HotKey.

View File

@@ -553,6 +553,15 @@ FormDisplay (
OUT USER_INPUT *UserInputData
);
/**
Clear Screen to the initial state.
**/
VOID
EFIAPI
DriverClearDisplayPage (
VOID
);
/**
Exit Display and Clear Screen to the original state.

View File

@@ -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);

View File

@@ -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;
}
}