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:
@@ -1,44 +0,0 @@
|
||||
/** @file
|
||||
MACRO definitions for color used in Setup Browser.
|
||||
|
||||
Copyright (c) 2004 - 2011, 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.
|
||||
|
||||
**/
|
||||
//
|
||||
// Unicode collation protocol in
|
||||
|
||||
#ifndef _COLORS_H_
|
||||
#define _COLORS_H_
|
||||
|
||||
//
|
||||
// Screen Color Settings
|
||||
//
|
||||
#define PICKLIST_HIGHLIGHT_TEXT EFI_WHITE
|
||||
#define PICKLIST_HIGHLIGHT_BACKGROUND EFI_BACKGROUND_CYAN
|
||||
#define TITLE_TEXT EFI_WHITE
|
||||
#define TITLE_BACKGROUND EFI_BACKGROUND_BLUE
|
||||
#define KEYHELP_TEXT EFI_LIGHTGRAY
|
||||
#define KEYHELP_BACKGROUND EFI_BACKGROUND_BLACK
|
||||
#define SUBTITLE_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
|
||||
#define BANNER_TEXT EFI_BLUE
|
||||
#define BANNER_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
|
||||
#define FIELD_TEXT_GRAYED EFI_DARKGRAY
|
||||
#define FIELD_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
|
||||
#define POPUP_TEXT EFI_LIGHTGRAY
|
||||
#define POPUP_BACKGROUND EFI_BACKGROUND_BLUE
|
||||
#define POPUP_INVERSE_TEXT EFI_LIGHTGRAY
|
||||
#define POPUP_INVERSE_BACKGROUND EFI_BACKGROUND_BLACK
|
||||
#define HELP_TEXT EFI_BLUE
|
||||
#define ERROR_TEXT EFI_RED | EFI_BRIGHT
|
||||
#define INFO_TEXT EFI_YELLOW | EFI_BRIGHT
|
||||
#define ARROW_TEXT EFI_RED | EFI_BRIGHT
|
||||
#define ARROW_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@@ -1,272 +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 "Setup.h"
|
||||
|
||||
/**
|
||||
The internal function prints to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
|
||||
protocol instance.
|
||||
|
||||
@param Column The position of the output string.
|
||||
@param Row The position of the output string.
|
||||
@param Out The EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.
|
||||
@param Fmt The format string.
|
||||
@param Args The additional argument for the variables in the format string.
|
||||
|
||||
@return Number of Unicode character printed.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
PrintInternal (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Out,
|
||||
IN CHAR16 *Fmt,
|
||||
IN VA_LIST Args
|
||||
)
|
||||
{
|
||||
CHAR16 *Buffer;
|
||||
CHAR16 *BackupBuffer;
|
||||
UINTN Index;
|
||||
UINTN PreviousIndex;
|
||||
UINTN Count;
|
||||
|
||||
//
|
||||
// For now, allocate an arbitrarily long buffer
|
||||
//
|
||||
Buffer = AllocateZeroPool (0x10000);
|
||||
BackupBuffer = AllocateZeroPool (0x10000);
|
||||
ASSERT (Buffer);
|
||||
ASSERT (BackupBuffer);
|
||||
|
||||
if (Column != (UINTN) -1) {
|
||||
Out->SetCursorPosition (Out, Column, Row);
|
||||
}
|
||||
|
||||
UnicodeVSPrint (Buffer, 0x10000, Fmt, Args);
|
||||
|
||||
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
|
||||
|
||||
Out->SetAttribute (Out, Out->Mode->Attribute);
|
||||
|
||||
Index = 0;
|
||||
PreviousIndex = 0;
|
||||
Count = 0;
|
||||
|
||||
do {
|
||||
for (; (Buffer[Index] != NARROW_CHAR) && (Buffer[Index] != WIDE_CHAR) && (Buffer[Index] != 0); Index++) {
|
||||
BackupBuffer[Index] = Buffer[Index];
|
||||
}
|
||||
|
||||
if (Buffer[Index] == 0) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Null-terminate the temporary string
|
||||
//
|
||||
BackupBuffer[Index] = 0;
|
||||
|
||||
//
|
||||
// Print this out, we are about to switch widths
|
||||
//
|
||||
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
|
||||
Count += StrLen (&BackupBuffer[PreviousIndex]);
|
||||
|
||||
//
|
||||
// Preserve the current index + 1, since this is where we will start printing from next
|
||||
//
|
||||
PreviousIndex = Index + 1;
|
||||
|
||||
//
|
||||
// We are at a narrow or wide character directive. Set attributes and strip it and print it
|
||||
//
|
||||
if (Buffer[Index] == NARROW_CHAR) {
|
||||
//
|
||||
// Preserve bits 0 - 6 and zero out the rest
|
||||
//
|
||||
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
|
||||
Out->SetAttribute (Out, Out->Mode->Attribute);
|
||||
} else {
|
||||
//
|
||||
// Must be wide, set bit 7 ON
|
||||
//
|
||||
Out->Mode->Attribute = Out->Mode->Attribute | EFI_WIDE_ATTRIBUTE;
|
||||
Out->SetAttribute (Out, Out->Mode->Attribute);
|
||||
}
|
||||
|
||||
Index++;
|
||||
|
||||
} while (Buffer[Index] != 0);
|
||||
|
||||
//
|
||||
// We hit the end of the string - print it
|
||||
//
|
||||
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
|
||||
Count += StrLen (&BackupBuffer[PreviousIndex]);
|
||||
|
||||
FreePool (Buffer);
|
||||
FreePool (BackupBuffer);
|
||||
return Count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a formatted unicode string to the default console.
|
||||
|
||||
@param Fmt Format string
|
||||
@param ... Variable argument list for format string.
|
||||
|
||||
@return Length of string printed to the console.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
ConsolePrint (
|
||||
IN CHAR16 *Fmt,
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST Args;
|
||||
UINTN LengthOfPrinted;
|
||||
|
||||
VA_START (Args, Fmt);
|
||||
LengthOfPrinted = PrintInternal ((UINTN) -1, (UINTN) -1, gST->ConOut, Fmt, Args);
|
||||
VA_END (Args);
|
||||
return LengthOfPrinted;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a unicode string to the default console,
|
||||
using L"%s" format.
|
||||
|
||||
@param String String pointer.
|
||||
|
||||
@return Length of string printed to the console
|
||||
|
||||
**/
|
||||
UINTN
|
||||
PrintString (
|
||||
IN CHAR16 *String
|
||||
)
|
||||
{
|
||||
return ConsolePrint (L"%s", String);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a chracter to the default console,
|
||||
using L"%c" format.
|
||||
|
||||
@param Character Character to print.
|
||||
|
||||
@return Length of string printed to the console.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
PrintChar (
|
||||
CHAR16 Character
|
||||
)
|
||||
{
|
||||
return ConsolePrint (L"%c", Character);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a formatted unicode string to the default console, at
|
||||
the supplied cursor position.
|
||||
|
||||
@param Column The cursor position to print the string at.
|
||||
@param Row The cursor position to print the string at.
|
||||
@param Fmt Format string.
|
||||
@param ... Variable argument list for format string.
|
||||
|
||||
@return Length of string printed to the console
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
PrintAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN CHAR16 *Fmt,
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST Args;
|
||||
UINTN LengthOfPrinted;
|
||||
|
||||
VA_START (Args, Fmt);
|
||||
LengthOfPrinted = PrintInternal (Column, Row, gST->ConOut, Fmt, Args);
|
||||
VA_END (Args);
|
||||
return LengthOfPrinted;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a unicode string to the default console, at
|
||||
the supplied cursor position, using L"%s" format.
|
||||
|
||||
@param Column The cursor position to print the string at.
|
||||
@param Row The cursor position to print the string at
|
||||
@param String String pointer.
|
||||
|
||||
@return Length of string printed to the console
|
||||
|
||||
**/
|
||||
UINTN
|
||||
PrintStringAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN CHAR16 *String
|
||||
)
|
||||
{
|
||||
return PrintAt (Column, Row, L"%s", String);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a chracter to the default console, at
|
||||
the supplied cursor position, using L"%c" format.
|
||||
|
||||
@param Column The cursor position to print the string at.
|
||||
@param Row The cursor position to print the string at.
|
||||
@param Character Character to print.
|
||||
|
||||
@return Length of string printed to the console.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
PrintCharAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
CHAR16 Character
|
||||
)
|
||||
{
|
||||
return PrintAt (Column, Row, L"%c", Character);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,7 @@ UINTN gBrowserContextCount = 0;
|
||||
LIST_ENTRY gBrowserContextList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserContextList);
|
||||
LIST_ENTRY gBrowserFormSetList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserFormSetList);
|
||||
LIST_ENTRY gBrowserHotKeyList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserHotKeyList);
|
||||
LIST_ENTRY gBrowserStorageList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserStorageList);
|
||||
LIST_ENTRY gBrowserStorageList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserStorageList);
|
||||
|
||||
BOOLEAN gResetRequired;
|
||||
BOOLEAN gExitRequired;
|
||||
@@ -58,17 +58,15 @@ EXIT_HANDLER ExitHandlerFunction = NULL;
|
||||
// Browser Global Strings
|
||||
//
|
||||
CHAR16 *gEmptyString;
|
||||
|
||||
CHAR16 *mUnknownString = L"!";
|
||||
|
||||
EFI_GUID gZeroGuid = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
|
||||
EFI_GUID gSetupBrowserGuid = {
|
||||
0xab368524, 0xb60c, 0x495b, {0xa0, 0x9, 0x12, 0xe8, 0x5b, 0x1a, 0xea, 0x32}
|
||||
};
|
||||
|
||||
FORM_BROWSER_FORMSET *gOldFormSet = NULL;
|
||||
extern UINT32 gBrowserStatus;
|
||||
extern CHAR16 *gErrorInfo;
|
||||
extern UINT32 gBrowserStatus;
|
||||
extern CHAR16 *gErrorInfo;
|
||||
extern EFI_GUID mCurrentFormSetGuid;
|
||||
extern EFI_HII_HANDLE mCurrentHiiHandle;
|
||||
extern UINT16 mCurrentFormId;
|
||||
extern FORM_DISPLAY_ENGINE_FORM gDisplayFormData;
|
||||
|
||||
/**
|
||||
@@ -4612,11 +4610,6 @@ SaveBrowserContext (
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Not support SendForm nest in another SendForm, assert here.
|
||||
//
|
||||
ASSERT (FALSE);
|
||||
|
||||
Context = AllocatePool (sizeof (BROWSER_CONTEXT));
|
||||
ASSERT (Context != NULL);
|
||||
|
||||
@@ -4625,9 +4618,12 @@ SaveBrowserContext (
|
||||
//
|
||||
// Save FormBrowser context
|
||||
//
|
||||
Context->Selection = gCurrentSelection;
|
||||
Context->ResetRequired = gResetRequired;
|
||||
Context->ExitRequired = gExitRequired;
|
||||
Context->HiiHandle = mCurrentHiiHandle;
|
||||
Context->FormId = mCurrentFormId;
|
||||
CopyGuid (&Context->FormSetGuid, &mCurrentFormSetGuid);
|
||||
|
||||
//
|
||||
// Save the menu history data.
|
||||
@@ -4677,9 +4673,12 @@ RestoreBrowserContext (
|
||||
//
|
||||
// Restore FormBrowser context
|
||||
//
|
||||
gCurrentSelection = Context->Selection;
|
||||
gResetRequired = Context->ResetRequired;
|
||||
gExitRequired = Context->ExitRequired;
|
||||
mCurrentHiiHandle = Context->HiiHandle;
|
||||
mCurrentFormId = Context->FormId;
|
||||
CopyGuid (&mCurrentFormSetGuid, &Context->FormSetGuid);
|
||||
|
||||
//
|
||||
// Restore the menu history data.
|
||||
|
@@ -449,23 +449,6 @@ typedef struct {
|
||||
|
||||
#define FORM_BROWSER_REFRESH_EVENT_FROM_LINK(a) BASE_CR (a, FORM_BROWSER_REFRESH_EVENT_NODE, Link)
|
||||
|
||||
#define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
//
|
||||
// Globals defined in Setup.c
|
||||
//
|
||||
BOOLEAN ResetRequired;
|
||||
BOOLEAN ExitRequired;
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
|
||||
LIST_ENTRY FormHistoryList;
|
||||
} BROWSER_CONTEXT;
|
||||
|
||||
#define BROWSER_CONTEXT_FROM_LINK(a) CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)
|
||||
|
||||
typedef struct {
|
||||
EFI_HII_HANDLE Handle;
|
||||
@@ -507,6 +490,27 @@ typedef struct {
|
||||
FORM_ENTRY_INFO *CurrentMenu;
|
||||
} UI_MENU_SELECTION;
|
||||
|
||||
#define BROWSER_CONTEXT_SIGNATURE SIGNATURE_32 ('B', 'C', 'T', 'X')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
//
|
||||
// Globals defined in Setup.c
|
||||
//
|
||||
BOOLEAN ResetRequired;
|
||||
BOOLEAN ExitRequired;
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
EFI_GUID FormSetGuid;
|
||||
EFI_FORM_ID FormId;
|
||||
UI_MENU_SELECTION *Selection;
|
||||
|
||||
LIST_ENTRY FormHistoryList;
|
||||
} BROWSER_CONTEXT;
|
||||
|
||||
#define BROWSER_CONTEXT_FROM_LINK(a) CR (a, BROWSER_CONTEXT, Link, BROWSER_CONTEXT_SIGNATURE)
|
||||
|
||||
//
|
||||
// Scope for get defaut value. It may be GetDefaultForNoStorage, GetDefaultForStorage or GetDefaultForAll.
|
||||
//
|
||||
@@ -535,7 +539,6 @@ extern EDKII_FORM_DISPLAY_ENGINE_PROTOCOL *mFormDisplay;
|
||||
extern BOOLEAN gResetRequired;
|
||||
extern BOOLEAN gExitRequired;
|
||||
|
||||
extern FORM_BROWSER_FORMSET *gOldFormSet;
|
||||
extern LIST_ENTRY gBrowserFormSetList;
|
||||
extern LIST_ENTRY gBrowserHotKeyList;
|
||||
extern BROWSER_SETTING_SCOPE gBrowserSettingScope;
|
||||
|
@@ -77,6 +77,4 @@
|
||||
[Depex]
|
||||
gEfiHiiDatabaseProtocolGuid AND gEfiHiiConfigRoutingProtocolGuid
|
||||
|
||||
[BuildOptions]
|
||||
MSFT:*_*_*_CC_FLAGS = /Od
|
||||
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user