MdeModulePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
7c7184e201
commit
1436aea4d5
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifndef __FORM_DISPLAY_H__
|
||||
#define __FORM_DISPLAY_H__
|
||||
|
||||
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
@@ -29,84 +28,84 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
//
|
||||
// This is the generated header file which includes whatever needs to be exported (strings + IFR)
|
||||
//
|
||||
extern UINT8 DisplayEngineStrings[];
|
||||
extern EFI_SCREEN_DESCRIPTOR gStatementDimensions;
|
||||
extern USER_INPUT *gUserInput;
|
||||
extern FORM_DISPLAY_ENGINE_FORM *gFormData;
|
||||
extern EFI_HII_HANDLE gHiiHandle;
|
||||
extern UINT16 gDirection;
|
||||
extern LIST_ENTRY gMenuOption;
|
||||
extern CHAR16 *gConfirmOptYes;
|
||||
extern CHAR16 *gConfirmOptNo;
|
||||
extern CHAR16 *gConfirmOptOk;
|
||||
extern CHAR16 *gConfirmOptCancel;
|
||||
extern CHAR16 *gYesOption;
|
||||
extern CHAR16 *gNoOption;
|
||||
extern CHAR16 *gOkOption;
|
||||
extern CHAR16 *gCancelOption;
|
||||
extern CHAR16 *gErrorPopup;
|
||||
extern CHAR16 *gWarningPopup;
|
||||
extern CHAR16 *gInfoPopup;
|
||||
extern UINT8 DisplayEngineStrings[];
|
||||
extern EFI_SCREEN_DESCRIPTOR gStatementDimensions;
|
||||
extern USER_INPUT *gUserInput;
|
||||
extern FORM_DISPLAY_ENGINE_FORM *gFormData;
|
||||
extern EFI_HII_HANDLE gHiiHandle;
|
||||
extern UINT16 gDirection;
|
||||
extern LIST_ENTRY gMenuOption;
|
||||
extern CHAR16 *gConfirmOptYes;
|
||||
extern CHAR16 *gConfirmOptNo;
|
||||
extern CHAR16 *gConfirmOptOk;
|
||||
extern CHAR16 *gConfirmOptCancel;
|
||||
extern CHAR16 *gYesOption;
|
||||
extern CHAR16 *gNoOption;
|
||||
extern CHAR16 *gOkOption;
|
||||
extern CHAR16 *gCancelOption;
|
||||
extern CHAR16 *gErrorPopup;
|
||||
extern CHAR16 *gWarningPopup;
|
||||
extern CHAR16 *gInfoPopup;
|
||||
|
||||
//
|
||||
// Browser Global Strings
|
||||
//
|
||||
extern CHAR16 *gSaveFailed;
|
||||
extern CHAR16 *gPromptForData;
|
||||
extern CHAR16 *gPromptForPassword;
|
||||
extern CHAR16 *gPromptForNewPassword;
|
||||
extern CHAR16 *gConfirmPassword;
|
||||
extern CHAR16 *gConfirmError;
|
||||
extern CHAR16 *gPassowordInvalid;
|
||||
extern CHAR16 *gPressEnter;
|
||||
extern CHAR16 *gEmptyString;
|
||||
extern CHAR16 *gMiniString;
|
||||
extern CHAR16 *gOptionMismatch;
|
||||
extern CHAR16 *gFormSuppress;
|
||||
extern CHAR16 *gProtocolNotFound;
|
||||
extern CHAR16 *gPasswordUnsupported;
|
||||
extern CHAR16 *gSaveFailed;
|
||||
extern CHAR16 *gPromptForData;
|
||||
extern CHAR16 *gPromptForPassword;
|
||||
extern CHAR16 *gPromptForNewPassword;
|
||||
extern CHAR16 *gConfirmPassword;
|
||||
extern CHAR16 *gConfirmError;
|
||||
extern CHAR16 *gPassowordInvalid;
|
||||
extern CHAR16 *gPressEnter;
|
||||
extern CHAR16 *gEmptyString;
|
||||
extern CHAR16 *gMiniString;
|
||||
extern CHAR16 *gOptionMismatch;
|
||||
extern CHAR16 *gFormSuppress;
|
||||
extern CHAR16 *gProtocolNotFound;
|
||||
extern CHAR16 *gPasswordUnsupported;
|
||||
|
||||
extern CHAR16 gPromptBlockWidth;
|
||||
extern CHAR16 gOptionBlockWidth;
|
||||
extern CHAR16 gHelpBlockWidth;
|
||||
extern CHAR16 *mUnknownString;
|
||||
extern BOOLEAN gMisMatch;
|
||||
extern CHAR16 gPromptBlockWidth;
|
||||
extern CHAR16 gOptionBlockWidth;
|
||||
extern CHAR16 gHelpBlockWidth;
|
||||
extern CHAR16 *mUnknownString;
|
||||
extern BOOLEAN gMisMatch;
|
||||
|
||||
//
|
||||
// Screen definitions
|
||||
//
|
||||
|
||||
#define LEFT_SKIPPED_COLUMNS 3
|
||||
#define SCROLL_ARROW_HEIGHT 1
|
||||
#define POPUP_PAD_SPACE_COUNT 5
|
||||
#define POPUP_FRAME_WIDTH 2
|
||||
#define LEFT_SKIPPED_COLUMNS 3
|
||||
#define SCROLL_ARROW_HEIGHT 1
|
||||
#define POPUP_PAD_SPACE_COUNT 5
|
||||
#define POPUP_FRAME_WIDTH 2
|
||||
|
||||
#define UPPER_LOWER_CASE_OFFSET 0x20
|
||||
#define UPPER_LOWER_CASE_OFFSET 0x20
|
||||
|
||||
//
|
||||
// Display definitions
|
||||
//
|
||||
#define LEFT_ONEOF_DELIMITER L'<'
|
||||
#define RIGHT_ONEOF_DELIMITER L'>'
|
||||
#define LEFT_ONEOF_DELIMITER L'<'
|
||||
#define RIGHT_ONEOF_DELIMITER L'>'
|
||||
|
||||
#define LEFT_NUMERIC_DELIMITER L'['
|
||||
#define RIGHT_NUMERIC_DELIMITER L']'
|
||||
#define LEFT_NUMERIC_DELIMITER L'['
|
||||
#define RIGHT_NUMERIC_DELIMITER L']'
|
||||
|
||||
#define LEFT_CHECKBOX_DELIMITER L'['
|
||||
#define RIGHT_CHECKBOX_DELIMITER L']'
|
||||
|
||||
#define CHECK_ON L'X'
|
||||
#define CHECK_OFF L' '
|
||||
#define CHECK_ON L'X'
|
||||
#define CHECK_OFF L' '
|
||||
|
||||
#define TIME_SEPARATOR L':'
|
||||
#define DATE_SEPARATOR L'/'
|
||||
#define TIME_SEPARATOR L':'
|
||||
#define DATE_SEPARATOR L'/'
|
||||
|
||||
#define SUBTITLE_INDENT 2
|
||||
|
||||
//
|
||||
// This is the Input Error Message
|
||||
//
|
||||
#define INPUT_ERROR 1
|
||||
#define INPUT_ERROR 1
|
||||
|
||||
//
|
||||
// This is the NV RAM update required Message
|
||||
@@ -122,33 +121,32 @@ extern BOOLEAN gMisMatch;
|
||||
// pow(2, 64) = [18446744073709551616]
|
||||
// with extra '-' flat, set the width to 24.
|
||||
//
|
||||
#define MAX_NUMERIC_INPUT_WIDTH 24
|
||||
#define MAX_NUMERIC_INPUT_WIDTH 24
|
||||
|
||||
#define EFI_HII_EXPRESSION_INCONSISTENT_IF 0
|
||||
#define EFI_HII_EXPRESSION_NO_SUBMIT_IF 1
|
||||
#define EFI_HII_EXPRESSION_GRAY_OUT_IF 2
|
||||
#define EFI_HII_EXPRESSION_SUPPRESS_IF 3
|
||||
#define EFI_HII_EXPRESSION_DISABLE_IF 4
|
||||
#define EFI_HII_EXPRESSION_INCONSISTENT_IF 0
|
||||
#define EFI_HII_EXPRESSION_NO_SUBMIT_IF 1
|
||||
#define EFI_HII_EXPRESSION_GRAY_OUT_IF 2
|
||||
#define EFI_HII_EXPRESSION_SUPPRESS_IF 3
|
||||
#define EFI_HII_EXPRESSION_DISABLE_IF 4
|
||||
|
||||
//
|
||||
// Character definitions
|
||||
//
|
||||
#define CHAR_SPACE 0x0020
|
||||
#define CHAR_SPACE 0x0020
|
||||
|
||||
#define FORM_DISPLAY_DRIVER_SIGNATURE SIGNATURE_32 ('F', 'D', 'D', 'V')
|
||||
#define FORM_DISPLAY_DRIVER_SIGNATURE SIGNATURE_32 ('F', 'D', 'D', 'V')
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINT32 Signature;
|
||||
|
||||
EFI_HANDLE Handle;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
//
|
||||
// Produced protocol
|
||||
//
|
||||
EDKII_FORM_DISPLAY_ENGINE_PROTOCOL FromDisplayProt;
|
||||
EFI_HII_POPUP_PROTOCOL HiiPopup;
|
||||
EDKII_FORM_DISPLAY_ENGINE_PROTOCOL FromDisplayProt;
|
||||
EFI_HII_POPUP_PROTOCOL HiiPopup;
|
||||
} FORM_DISPLAY_DRIVER_PRIVATE_DATA;
|
||||
|
||||
|
||||
typedef enum {
|
||||
UiNoOperation,
|
||||
UiSelect,
|
||||
@@ -195,18 +193,18 @@ typedef enum {
|
||||
} UI_EVENT_TYPE;
|
||||
|
||||
typedef struct {
|
||||
UINT16 ScanCode;
|
||||
UI_SCREEN_OPERATION ScreenOperation;
|
||||
UINT16 ScanCode;
|
||||
UI_SCREEN_OPERATION ScreenOperation;
|
||||
} SCAN_CODE_TO_SCREEN_OPERATION;
|
||||
|
||||
typedef struct {
|
||||
UI_SCREEN_OPERATION ScreenOperation;
|
||||
UI_CONTROL_FLAG ControlFlag;
|
||||
UI_SCREEN_OPERATION ScreenOperation;
|
||||
UI_CONTROL_FLAG ControlFlag;
|
||||
} SCREEN_OPERATION_T0_CONTROL_FLAG;
|
||||
|
||||
typedef struct {
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
UINT16 FormId;
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
UINT16 FormId;
|
||||
|
||||
//
|
||||
// Info for the highlight question.
|
||||
@@ -218,43 +216,43 @@ typedef struct {
|
||||
// empty subtitle info may has more than one info one form), also use Index
|
||||
// info to find the statement.
|
||||
//
|
||||
EFI_QUESTION_ID HLTQuestionId;
|
||||
EFI_IFR_OP_HEADER *HLTOpCode;
|
||||
UINTN HLTIndex;
|
||||
UINTN HLTSequence;
|
||||
EFI_QUESTION_ID HLTQuestionId;
|
||||
EFI_IFR_OP_HEADER *HLTOpCode;
|
||||
UINTN HLTIndex;
|
||||
UINTN HLTSequence;
|
||||
|
||||
//
|
||||
// Info for the top of screen question.
|
||||
// TOS means Top Of Screen
|
||||
//
|
||||
EFI_QUESTION_ID TOSQuestionId;
|
||||
EFI_IFR_OP_HEADER *TOSOpCode;
|
||||
UINTN TOSIndex;
|
||||
EFI_QUESTION_ID TOSQuestionId;
|
||||
EFI_IFR_OP_HEADER *TOSOpCode;
|
||||
UINTN TOSIndex;
|
||||
|
||||
UINT16 SkipValue;
|
||||
UINT16 SkipValue;
|
||||
} DISPLAY_HIGHLIGHT_MENU_INFO;
|
||||
|
||||
typedef struct {
|
||||
EFI_EVENT SyncEvent;
|
||||
UINT8 *TimeOut;
|
||||
CHAR16 *ErrorInfo;
|
||||
EFI_EVENT SyncEvent;
|
||||
UINT8 *TimeOut;
|
||||
CHAR16 *ErrorInfo;
|
||||
} WARNING_IF_CONTEXT;
|
||||
|
||||
#define UI_MENU_OPTION_SIGNATURE SIGNATURE_32 ('u', 'i', 'm', 'm')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
EFI_HII_HANDLE Handle;
|
||||
FORM_DISPLAY_ENGINE_STATEMENT *ThisTag;
|
||||
UINT16 EntryNumber;
|
||||
EFI_HII_HANDLE Handle;
|
||||
FORM_DISPLAY_ENGINE_STATEMENT *ThisTag;
|
||||
UINT16 EntryNumber;
|
||||
|
||||
UINTN Row;
|
||||
UINTN Col;
|
||||
UINTN OptCol;
|
||||
CHAR16 *Description;
|
||||
UINTN Skip; // Number of lines
|
||||
UINTN Row;
|
||||
UINTN Col;
|
||||
UINTN OptCol;
|
||||
CHAR16 *Description;
|
||||
UINTN Skip; // Number of lines
|
||||
|
||||
//
|
||||
// Display item sequence for date/time
|
||||
@@ -265,24 +263,24 @@ typedef struct {
|
||||
// Sequence: 0 1 2
|
||||
//
|
||||
//
|
||||
UINTN Sequence;
|
||||
UINTN Sequence;
|
||||
|
||||
BOOLEAN GrayOut;
|
||||
BOOLEAN ReadOnly;
|
||||
BOOLEAN GrayOut;
|
||||
BOOLEAN ReadOnly;
|
||||
|
||||
//
|
||||
// Whether user could change value of this item
|
||||
//
|
||||
BOOLEAN IsQuestion;
|
||||
BOOLEAN NestInStatement;
|
||||
BOOLEAN IsQuestion;
|
||||
BOOLEAN NestInStatement;
|
||||
} UI_MENU_OPTION;
|
||||
|
||||
#define MENU_OPTION_FROM_LINK(a) CR (a, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE)
|
||||
|
||||
#define USER_SELECTABLE_OPTION_OK_WIDTH StrLen (gOkOption)
|
||||
#define USER_SELECTABLE_OPTION_OK_CAL_WIDTH (StrLen (gOkOption) + StrLen (gCancelOption))
|
||||
#define USER_SELECTABLE_OPTION_YES_NO_WIDTH (StrLen (gYesOption) + StrLen (gNoOption))
|
||||
#define USER_SELECTABLE_OPTION_YES_NO_CAL_WIDTH (StrLen (gYesOption) + StrLen (gNoOption) + StrLen (gCancelOption))
|
||||
#define USER_SELECTABLE_OPTION_OK_WIDTH StrLen (gOkOption)
|
||||
#define USER_SELECTABLE_OPTION_OK_CAL_WIDTH (StrLen (gOkOption) + StrLen (gCancelOption))
|
||||
#define USER_SELECTABLE_OPTION_YES_NO_WIDTH (StrLen (gYesOption) + StrLen (gNoOption))
|
||||
#define USER_SELECTABLE_OPTION_YES_NO_CAL_WIDTH (StrLen (gYesOption) + StrLen (gNoOption) + StrLen (gCancelOption))
|
||||
|
||||
#define USER_SELECTABLE_OPTION_SKIP_WIDTH 2
|
||||
|
||||
@@ -295,9 +293,9 @@ typedef struct {
|
||||
// | user selectable options | // POPUP_USER_SELECTABLE_OPTION_HEIGHT } POPUP_FOOTER_HEIGHT
|
||||
// +-------------------------------------------+ // POPUP_BORDER }
|
||||
//
|
||||
#define POPUP_BORDER 1
|
||||
#define POPUP_EMPTY_LINE_HEIGHT 1
|
||||
#define POPUP_STYLE_STRING_HEIGHT 1
|
||||
#define POPUP_BORDER 1
|
||||
#define POPUP_EMPTY_LINE_HEIGHT 1
|
||||
#define POPUP_STYLE_STRING_HEIGHT 1
|
||||
#define POPUP_USER_SELECTABLE_OPTION_HEIGHT 1
|
||||
|
||||
#define POPUP_HEADER_HEIGHT (POPUP_BORDER + POPUP_STYLE_STRING_HEIGHT + POPUP_EMPTY_LINE_HEIGHT)
|
||||
@@ -306,10 +304,10 @@ typedef struct {
|
||||
#define USER_SELECTABLE_OPTION_SIGNATURE SIGNATURE_32 ('u', 's', 's', 'o')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
EFI_HII_POPUP_SELECTION OptionType;
|
||||
CHAR16 *OptionString;
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
EFI_HII_POPUP_SELECTION OptionType;
|
||||
CHAR16 *OptionString;
|
||||
//
|
||||
// Display item sequence for user select options
|
||||
// Ok: Ok
|
||||
@@ -324,11 +322,11 @@ typedef struct {
|
||||
// Yes/No/Cancel: Yes : No: Cancel
|
||||
// Sequence: 0 1 2
|
||||
//
|
||||
UINTN Sequence;
|
||||
UINTN OptionRow;
|
||||
UINTN OptionCol;
|
||||
UINTN MaxSequence;
|
||||
UINTN MinSequence;
|
||||
UINTN Sequence;
|
||||
UINTN OptionRow;
|
||||
UINTN OptionCol;
|
||||
UINTN MaxSequence;
|
||||
UINTN MinSequence;
|
||||
} USER_SELECTABLE_OPTION;
|
||||
|
||||
#define SELECTABLE_OPTION_FROM_LINK(a) CR (a, USER_SELECTABLE_OPTION, Link, USER_SELECTABLE_OPTION_SIGNATURE)
|
||||
@@ -346,9 +344,9 @@ typedef struct {
|
||||
**/
|
||||
EFI_STATUS
|
||||
PrintFormattedNumber (
|
||||
IN FORM_DISPLAY_ENGINE_STATEMENT *Question,
|
||||
IN OUT CHAR16 *FormattedNumber,
|
||||
IN UINTN BufferSize
|
||||
IN FORM_DISPLAY_ENGINE_STATEMENT *Question,
|
||||
IN OUT CHAR16 *FormattedNumber,
|
||||
IN UINTN BufferSize
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -362,10 +360,10 @@ PrintFormattedNumber (
|
||||
**/
|
||||
VOID
|
||||
SetArrayData (
|
||||
IN VOID *Array,
|
||||
IN UINT8 Type,
|
||||
IN UINTN Index,
|
||||
IN UINT64 Value
|
||||
IN VOID *Array,
|
||||
IN UINT8 Type,
|
||||
IN UINTN Index,
|
||||
IN UINT64 Value
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -380,9 +378,9 @@ SetArrayData (
|
||||
**/
|
||||
UINT64
|
||||
GetArrayData (
|
||||
IN VOID *Array,
|
||||
IN UINT8 Type,
|
||||
IN UINTN Index
|
||||
IN VOID *Array,
|
||||
IN UINT8 Type,
|
||||
IN UINTN Index
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -397,8 +395,8 @@ GetArrayData (
|
||||
**/
|
||||
DISPLAY_QUESTION_OPTION *
|
||||
ValueToOption (
|
||||
IN FORM_DISPLAY_ENGINE_STATEMENT *Question,
|
||||
IN EFI_HII_VALUE *OptionValue
|
||||
IN FORM_DISPLAY_ENGINE_STATEMENT *Question,
|
||||
IN EFI_HII_VALUE *OptionValue
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -436,8 +434,8 @@ CompareHiiValue (
|
||||
VOID
|
||||
EFIAPI
|
||||
CreateMultiStringPopUp (
|
||||
IN UINTN RequestedWidth,
|
||||
IN UINTN NumberOfLines,
|
||||
IN UINTN RequestedWidth,
|
||||
IN UINTN NumberOfLines,
|
||||
...
|
||||
);
|
||||
|
||||
@@ -462,14 +460,13 @@ CreateMultiStringPopUp (
|
||||
**/
|
||||
UINT16
|
||||
GetLineByWidth (
|
||||
IN CHAR16 *InputString,
|
||||
IN UINT16 LineWidth,
|
||||
IN OUT UINT16 *GlyphWidth,
|
||||
IN OUT UINTN *Index,
|
||||
OUT CHAR16 **OutputString
|
||||
IN CHAR16 *InputString,
|
||||
IN UINT16 LineWidth,
|
||||
IN OUT UINT16 *GlyphWidth,
|
||||
IN OUT UINTN *Index,
|
||||
OUT CHAR16 **OutputString
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Get the string based on the StringId and HII Package List Handle.
|
||||
|
||||
@@ -481,8 +478,8 @@ GetLineByWidth (
|
||||
**/
|
||||
CHAR16 *
|
||||
GetToken (
|
||||
IN EFI_STRING_ID Token,
|
||||
IN EFI_HII_HANDLE HiiHandle
|
||||
IN EFI_STRING_ID Token,
|
||||
IN EFI_HII_HANDLE HiiHandle
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -503,7 +500,7 @@ GetToken (
|
||||
**/
|
||||
UINTN
|
||||
GetStringWidth (
|
||||
IN CHAR16 *String
|
||||
IN CHAR16 *String
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -517,7 +514,7 @@ GetStringWidth (
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetNumericInput (
|
||||
IN UI_MENU_OPTION *MenuOption
|
||||
IN UI_MENU_OPTION *MenuOption
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -533,9 +530,9 @@ GetNumericInput (
|
||||
**/
|
||||
EFI_STATUS
|
||||
ReadString (
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN CHAR16 *Prompt,
|
||||
IN OUT CHAR16 *StringPtr
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN CHAR16 *Prompt,
|
||||
IN OUT CHAR16 *StringPtr
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -549,9 +546,9 @@ ReadString (
|
||||
**/
|
||||
VOID
|
||||
CreateSharedPopUp (
|
||||
IN UINTN RequestedWidth,
|
||||
IN UINTN NumberOfLines,
|
||||
IN VA_LIST Marker
|
||||
IN UINTN RequestedWidth,
|
||||
IN UINTN NumberOfLines,
|
||||
IN VA_LIST Marker
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -564,7 +561,7 @@ CreateSharedPopUp (
|
||||
**/
|
||||
EFI_STATUS
|
||||
WaitForKeyStroke (
|
||||
OUT EFI_INPUT_KEY *Key
|
||||
OUT EFI_INPUT_KEY *Key
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -578,7 +575,7 @@ WaitForKeyStroke (
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetSelectionInputPopUp (
|
||||
IN UI_MENU_OPTION *MenuOption
|
||||
IN UI_MENU_OPTION *MenuOption
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -613,10 +610,10 @@ ProcessHelpString (
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessOptions (
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN BOOLEAN Selected,
|
||||
OUT CHAR16 **OptionString,
|
||||
IN BOOLEAN SkipErrorValue
|
||||
IN UI_MENU_OPTION *MenuOption,
|
||||
IN BOOLEAN Selected,
|
||||
OUT CHAR16 **OptionString,
|
||||
IN BOOLEAN SkipErrorValue
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -629,9 +626,9 @@ ProcessOptions (
|
||||
**/
|
||||
VOID
|
||||
SetUnicodeMem (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN CHAR16 Value
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN CHAR16 Value
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -678,8 +675,8 @@ ExitDisplay (
|
||||
VOID
|
||||
EFIAPI
|
||||
EmptyEventProcess (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -692,8 +689,8 @@ EmptyEventProcess (
|
||||
VOID
|
||||
EFIAPI
|
||||
RefreshTimeOutProcess (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -706,9 +703,9 @@ RefreshTimeOutProcess (
|
||||
**/
|
||||
VOID
|
||||
UpdateHighlightMenuInfo (
|
||||
IN LIST_ENTRY *Highlight,
|
||||
IN LIST_ENTRY *TopOfScreen,
|
||||
IN UINTN SkipValue
|
||||
IN LIST_ENTRY *Highlight,
|
||||
IN LIST_ENTRY *TopOfScreen,
|
||||
IN UINTN SkipValue
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -730,12 +727,12 @@ UpdateHighlightMenuInfo (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CreatePopup (
|
||||
IN EFI_HII_POPUP_PROTOCOL *This,
|
||||
IN EFI_HII_POPUP_STYLE PopupStyle,
|
||||
IN EFI_HII_POPUP_TYPE PopupType,
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_STRING_ID Message,
|
||||
OUT EFI_HII_POPUP_SELECTION *UserSelection OPTIONAL
|
||||
IN EFI_HII_POPUP_PROTOCOL *This,
|
||||
IN EFI_HII_POPUP_STYLE PopupStyle,
|
||||
IN EFI_HII_POPUP_TYPE PopupType,
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_STRING_ID Message,
|
||||
OUT EFI_HII_POPUP_SELECTION *UserSelection OPTIONAL
|
||||
);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -21,15 +21,15 @@ UINTN gMaxRowWidth;
|
||||
|
||||
**/
|
||||
VOID
|
||||
FreeSelectableOptions(
|
||||
LIST_ENTRY *OptionList
|
||||
FreeSelectableOptions (
|
||||
LIST_ENTRY *OptionList
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
USER_SELECTABLE_OPTION *SelectableOption;
|
||||
|
||||
while (!IsListEmpty (OptionList)) {
|
||||
Link = GetFirstNode (OptionList);
|
||||
Link = GetFirstNode (OptionList);
|
||||
SelectableOption = SELECTABLE_OPTION_FROM_LINK (Link);
|
||||
RemoveEntryList (&SelectableOption->Link);
|
||||
FreePool (SelectableOption);
|
||||
@@ -44,14 +44,15 @@ FreeSelectableOptions(
|
||||
|
||||
**/
|
||||
VOID
|
||||
DisplayOneSelectableOption(
|
||||
IN USER_SELECTABLE_OPTION *SelectableOption,
|
||||
IN BOOLEAN Highlight
|
||||
DisplayOneSelectableOption (
|
||||
IN USER_SELECTABLE_OPTION *SelectableOption,
|
||||
IN BOOLEAN Highlight
|
||||
)
|
||||
{
|
||||
if (Highlight) {
|
||||
gST->ConOut->SetAttribute (gST->ConOut, GetHighlightTextColor ());
|
||||
}
|
||||
|
||||
PrintStringAt (SelectableOption->OptionCol, SelectableOption->OptionRow, SelectableOption->OptionString);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, GetPopupColor ());
|
||||
}
|
||||
@@ -71,11 +72,11 @@ DisplayOneSelectableOption(
|
||||
**/
|
||||
EFI_STATUS
|
||||
AddOneSelectableOption (
|
||||
IN EFI_HII_POPUP_TYPE PopupType,
|
||||
IN EFI_HII_POPUP_SELECTION OptionType,
|
||||
IN CHAR16 *OptionString,
|
||||
IN UINTN OptionCol,
|
||||
IN UINTN OptionRow
|
||||
IN EFI_HII_POPUP_TYPE PopupType,
|
||||
IN EFI_HII_POPUP_SELECTION OptionType,
|
||||
IN CHAR16 *OptionString,
|
||||
IN UINTN OptionCol,
|
||||
IN UINTN OptionRow
|
||||
)
|
||||
{
|
||||
USER_SELECTABLE_OPTION *UserSelectableOption;
|
||||
@@ -84,51 +85,56 @@ AddOneSelectableOption (
|
||||
if (UserSelectableOption == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize the user selectable option based on the PopupType and OptionType.
|
||||
// And then add the option to the option list gUserSelectableOptions.
|
||||
//
|
||||
UserSelectableOption->Signature = USER_SELECTABLE_OPTION_SIGNATURE;
|
||||
UserSelectableOption->Signature = USER_SELECTABLE_OPTION_SIGNATURE;
|
||||
UserSelectableOption->OptionString = OptionString;
|
||||
UserSelectableOption->OptionType = OptionType;
|
||||
UserSelectableOption->OptionCol = OptionCol;
|
||||
UserSelectableOption->OptionRow = OptionRow;
|
||||
UserSelectableOption->MinSequence = 0;
|
||||
UserSelectableOption->OptionType = OptionType;
|
||||
UserSelectableOption->OptionCol = OptionCol;
|
||||
UserSelectableOption->OptionRow = OptionRow;
|
||||
UserSelectableOption->MinSequence = 0;
|
||||
|
||||
switch (PopupType) {
|
||||
case EfiHiiPopupTypeOk:
|
||||
UserSelectableOption->MaxSequence = 0;
|
||||
UserSelectableOption->Sequence= 0;
|
||||
break;
|
||||
case EfiHiiPopupTypeOkCancel:
|
||||
UserSelectableOption->MaxSequence = 1;
|
||||
if (OptionType == EfiHiiPopupSelectionOk) {
|
||||
UserSelectableOption->Sequence= 0;
|
||||
} else {
|
||||
UserSelectableOption->Sequence= 1;
|
||||
}
|
||||
break;
|
||||
case EfiHiiPopupTypeYesNo:
|
||||
UserSelectableOption->MaxSequence = 1;
|
||||
if (OptionType == EfiHiiPopupSelectionYes) {
|
||||
UserSelectableOption->Sequence = 0;
|
||||
} else {
|
||||
UserSelectableOption->Sequence = 1;
|
||||
}
|
||||
break;
|
||||
case EfiHiiPopupTypeYesNoCancel:
|
||||
UserSelectableOption->MaxSequence = 2;
|
||||
if (OptionType == EfiHiiPopupSelectionYes) {
|
||||
UserSelectableOption->Sequence = 0;
|
||||
} else if (OptionType == EfiHiiPopupSelectionNo){
|
||||
UserSelectableOption->Sequence = 1;
|
||||
} else {
|
||||
UserSelectableOption->Sequence = 2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case EfiHiiPopupTypeOk:
|
||||
UserSelectableOption->MaxSequence = 0;
|
||||
UserSelectableOption->Sequence = 0;
|
||||
break;
|
||||
case EfiHiiPopupTypeOkCancel:
|
||||
UserSelectableOption->MaxSequence = 1;
|
||||
if (OptionType == EfiHiiPopupSelectionOk) {
|
||||
UserSelectableOption->Sequence = 0;
|
||||
} else {
|
||||
UserSelectableOption->Sequence = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
case EfiHiiPopupTypeYesNo:
|
||||
UserSelectableOption->MaxSequence = 1;
|
||||
if (OptionType == EfiHiiPopupSelectionYes) {
|
||||
UserSelectableOption->Sequence = 0;
|
||||
} else {
|
||||
UserSelectableOption->Sequence = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
case EfiHiiPopupTypeYesNoCancel:
|
||||
UserSelectableOption->MaxSequence = 2;
|
||||
if (OptionType == EfiHiiPopupSelectionYes) {
|
||||
UserSelectableOption->Sequence = 0;
|
||||
} else if (OptionType == EfiHiiPopupSelectionNo) {
|
||||
UserSelectableOption->Sequence = 1;
|
||||
} else {
|
||||
UserSelectableOption->Sequence = 2;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
InsertTailList (&gUserSelectableOptions, &UserSelectableOption->Link);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -148,61 +154,62 @@ AddUserSelectableOptions (
|
||||
IN EFI_HII_POPUP_TYPE PopupType
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN EndCol;
|
||||
UINTN StartCol;
|
||||
UINTN OptionCol;
|
||||
UINTN OptionRow;
|
||||
UINTN ColDimension;
|
||||
EFI_STATUS Status;
|
||||
UINTN EndCol;
|
||||
UINTN StartCol;
|
||||
UINTN OptionCol;
|
||||
UINTN OptionRow;
|
||||
UINTN ColDimension;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
EndCol = gPopupDimensions.RightColumn;
|
||||
StartCol = gPopupDimensions.LeftColumn;
|
||||
OptionRow = gPopupDimensions.BottomRow - POPUP_BORDER;
|
||||
Status = EFI_SUCCESS;
|
||||
EndCol = gPopupDimensions.RightColumn;
|
||||
StartCol = gPopupDimensions.LeftColumn;
|
||||
OptionRow = gPopupDimensions.BottomRow - POPUP_BORDER;
|
||||
ColDimension = EndCol - StartCol + 1;
|
||||
|
||||
InitializeListHead (&gUserSelectableOptions);
|
||||
|
||||
switch (PopupType) {
|
||||
case EfiHiiPopupTypeOk:
|
||||
//
|
||||
// Add [Ok] option to the option list.
|
||||
//
|
||||
OptionCol = StartCol + (ColDimension - USER_SELECTABLE_OPTION_OK_WIDTH) / 2;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionOk, gOkOption, OptionCol, OptionRow);
|
||||
break;
|
||||
case EfiHiiPopupTypeOkCancel:
|
||||
//
|
||||
// Add [Ok] and [Cancel] options to the option list.
|
||||
//
|
||||
OptionCol = StartCol + (ColDimension - USER_SELECTABLE_OPTION_OK_CAL_WIDTH) / 3;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionOk, gOkOption, OptionCol, OptionRow);
|
||||
OptionCol = EndCol - (ColDimension - USER_SELECTABLE_OPTION_OK_CAL_WIDTH) / 3 - (GetStringWidth (gCancelOption) -2) / 2 + 1;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionCancel, gCancelOption, OptionCol, OptionRow);
|
||||
break;
|
||||
case EfiHiiPopupTypeYesNo:
|
||||
//
|
||||
// Add [Yes] and [No] options to the option list.
|
||||
//
|
||||
OptionCol = StartCol + (ColDimension - USER_SELECTABLE_OPTION_YES_NO_WIDTH) / 3;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionYes, gYesOption, OptionCol, OptionRow);
|
||||
OptionCol = EndCol - (ColDimension - USER_SELECTABLE_OPTION_YES_NO_WIDTH) / 3 - (GetStringWidth (gNoOption)- 2) / 2 + 1;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionNo, gNoOption, OptionCol, OptionRow);
|
||||
break;
|
||||
case EfiHiiPopupTypeYesNoCancel:
|
||||
//
|
||||
// Add [Yes], [No] and [Cancel] options to the option list.
|
||||
//
|
||||
OptionCol = StartCol + (ColDimension - USER_SELECTABLE_OPTION_YES_NO_CAL_WIDTH) / 4;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionYes, gYesOption, OptionCol, OptionRow);
|
||||
OptionCol = StartCol + (ColDimension - (GetStringWidth (gNoOption) -2) / 2) / 2;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionNo, gNoOption, OptionCol, OptionRow);
|
||||
OptionCol = EndCol - (ColDimension - USER_SELECTABLE_OPTION_YES_NO_CAL_WIDTH) / 4 - (GetStringWidth (gCancelOption) - 2) / 2 + 1;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionCancel, gCancelOption, OptionCol, OptionRow);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case EfiHiiPopupTypeOk:
|
||||
//
|
||||
// Add [Ok] option to the option list.
|
||||
//
|
||||
OptionCol = StartCol + (ColDimension - USER_SELECTABLE_OPTION_OK_WIDTH) / 2;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionOk, gOkOption, OptionCol, OptionRow);
|
||||
break;
|
||||
case EfiHiiPopupTypeOkCancel:
|
||||
//
|
||||
// Add [Ok] and [Cancel] options to the option list.
|
||||
//
|
||||
OptionCol = StartCol + (ColDimension - USER_SELECTABLE_OPTION_OK_CAL_WIDTH) / 3;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionOk, gOkOption, OptionCol, OptionRow);
|
||||
OptionCol = EndCol - (ColDimension - USER_SELECTABLE_OPTION_OK_CAL_WIDTH) / 3 - (GetStringWidth (gCancelOption) -2) / 2 + 1;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionCancel, gCancelOption, OptionCol, OptionRow);
|
||||
break;
|
||||
case EfiHiiPopupTypeYesNo:
|
||||
//
|
||||
// Add [Yes] and [No] options to the option list.
|
||||
//
|
||||
OptionCol = StartCol + (ColDimension - USER_SELECTABLE_OPTION_YES_NO_WIDTH) / 3;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionYes, gYesOption, OptionCol, OptionRow);
|
||||
OptionCol = EndCol - (ColDimension - USER_SELECTABLE_OPTION_YES_NO_WIDTH) / 3 - (GetStringWidth (gNoOption)- 2) / 2 + 1;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionNo, gNoOption, OptionCol, OptionRow);
|
||||
break;
|
||||
case EfiHiiPopupTypeYesNoCancel:
|
||||
//
|
||||
// Add [Yes], [No] and [Cancel] options to the option list.
|
||||
//
|
||||
OptionCol = StartCol + (ColDimension - USER_SELECTABLE_OPTION_YES_NO_CAL_WIDTH) / 4;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionYes, gYesOption, OptionCol, OptionRow);
|
||||
OptionCol = StartCol + (ColDimension - (GetStringWidth (gNoOption) -2) / 2) / 2;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionNo, gNoOption, OptionCol, OptionRow);
|
||||
OptionCol = EndCol - (ColDimension - USER_SELECTABLE_OPTION_YES_NO_CAL_WIDTH) / 4 - (GetStringWidth (gCancelOption) - 2) / 2 + 1;
|
||||
Status = AddOneSelectableOption (PopupType, EfiHiiPopupSelectionCancel, gCancelOption, OptionCol, OptionRow);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -219,12 +226,12 @@ GetUserSelection (
|
||||
OUT EFI_HII_POPUP_SELECTION *UserSelection
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *HighlightPos;
|
||||
LIST_ENTRY *Link;
|
||||
USER_SELECTABLE_OPTION *SelectableOption;
|
||||
USER_SELECTABLE_OPTION *HighlightOption;
|
||||
EFI_INPUT_KEY KeyValue;
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *HighlightPos;
|
||||
LIST_ENTRY *Link;
|
||||
USER_SELECTABLE_OPTION *SelectableOption;
|
||||
USER_SELECTABLE_OPTION *HighlightOption;
|
||||
EFI_INPUT_KEY KeyValue;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Display user selectable options in gUserSelectableOptions and get the option which user selects.
|
||||
@@ -232,11 +239,12 @@ GetUserSelection (
|
||||
HighlightPos = gUserSelectableOptions.ForwardLink;
|
||||
do {
|
||||
for (Link = gUserSelectableOptions.ForwardLink; Link != &gUserSelectableOptions; Link = Link->ForwardLink) {
|
||||
SelectableOption = SELECTABLE_OPTION_FROM_LINK (Link);
|
||||
SelectableOption = SELECTABLE_OPTION_FROM_LINK (Link);
|
||||
DisplayOneSelectableOption (SelectableOption, (BOOLEAN)(Link == HighlightPos));
|
||||
}
|
||||
|
||||
//
|
||||
//If UserSelection is NULL, there is no need to handle the key user input, just return.
|
||||
// If UserSelection is NULL, there is no need to handle the key user input, just return.
|
||||
//
|
||||
if (UserSelection == NULL) {
|
||||
return;
|
||||
@@ -247,49 +255,57 @@ GetUserSelection (
|
||||
|
||||
HighlightOption = SELECTABLE_OPTION_FROM_LINK (HighlightPos);
|
||||
switch (KeyValue.UnicodeChar) {
|
||||
case CHAR_NULL:
|
||||
switch (KeyValue.ScanCode) {
|
||||
case SCAN_RIGHT:
|
||||
if (HighlightOption->Sequence < HighlightOption->MaxSequence) {
|
||||
HighlightPos = HighlightPos->ForwardLink;
|
||||
} else {
|
||||
HighlightPos = gUserSelectableOptions.ForwardLink;
|
||||
}
|
||||
break;
|
||||
case SCAN_LEFT:
|
||||
if (HighlightOption->Sequence > HighlightOption->MinSequence) {
|
||||
HighlightPos = HighlightPos->BackLink;
|
||||
} else {
|
||||
HighlightPos = gUserSelectableOptions.BackLink;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CHAR_NULL:
|
||||
switch (KeyValue.ScanCode) {
|
||||
case SCAN_RIGHT:
|
||||
if (HighlightOption->Sequence < HighlightOption->MaxSequence) {
|
||||
HighlightPos = HighlightPos->ForwardLink;
|
||||
} else {
|
||||
HighlightPos = gUserSelectableOptions.ForwardLink;
|
||||
}
|
||||
|
||||
case CHAR_CARRIAGE_RETURN:
|
||||
*UserSelection = HighlightOption->OptionType;
|
||||
return;
|
||||
default:
|
||||
if (((KeyValue.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (*gConfirmOptYes | UPPER_LOWER_CASE_OFFSET)) &&
|
||||
(PopupType == EfiHiiPopupTypeYesNo || PopupType == EfiHiiPopupTypeYesNoCancel)) {
|
||||
*UserSelection = EfiHiiPopupSelectionYes;
|
||||
break;
|
||||
case SCAN_LEFT:
|
||||
if (HighlightOption->Sequence > HighlightOption->MinSequence) {
|
||||
HighlightPos = HighlightPos->BackLink;
|
||||
} else {
|
||||
HighlightPos = gUserSelectableOptions.BackLink;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case CHAR_CARRIAGE_RETURN:
|
||||
*UserSelection = HighlightOption->OptionType;
|
||||
return;
|
||||
} else if ((KeyValue.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (*gConfirmOptNo| UPPER_LOWER_CASE_OFFSET) &&
|
||||
(PopupType == EfiHiiPopupTypeYesNo || PopupType == EfiHiiPopupTypeYesNoCancel)){
|
||||
*UserSelection = EfiHiiPopupSelectionNo;
|
||||
return;
|
||||
} else if ((KeyValue.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (*gConfirmOptOk | UPPER_LOWER_CASE_OFFSET) &&
|
||||
(PopupType == EfiHiiPopupTypeOk || PopupType == EfiHiiPopupTypeOkCancel)){
|
||||
*UserSelection = EfiHiiPopupSelectionOk;
|
||||
return;
|
||||
} else if ((KeyValue.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (*gConfirmOptCancel| UPPER_LOWER_CASE_OFFSET) &&
|
||||
(PopupType == EfiHiiPopupTypeOkCancel || PopupType == EfiHiiPopupTypeYesNoCancel)){
|
||||
*UserSelection = EfiHiiPopupSelectionCancel;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (((KeyValue.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (*gConfirmOptYes | UPPER_LOWER_CASE_OFFSET)) &&
|
||||
((PopupType == EfiHiiPopupTypeYesNo) || (PopupType == EfiHiiPopupTypeYesNoCancel)))
|
||||
{
|
||||
*UserSelection = EfiHiiPopupSelectionYes;
|
||||
return;
|
||||
} else if (((KeyValue.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (*gConfirmOptNo| UPPER_LOWER_CASE_OFFSET)) &&
|
||||
((PopupType == EfiHiiPopupTypeYesNo) || (PopupType == EfiHiiPopupTypeYesNoCancel)))
|
||||
{
|
||||
*UserSelection = EfiHiiPopupSelectionNo;
|
||||
return;
|
||||
} else if (((KeyValue.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (*gConfirmOptOk | UPPER_LOWER_CASE_OFFSET)) &&
|
||||
((PopupType == EfiHiiPopupTypeOk) || (PopupType == EfiHiiPopupTypeOkCancel)))
|
||||
{
|
||||
*UserSelection = EfiHiiPopupSelectionOk;
|
||||
return;
|
||||
} else if (((KeyValue.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (*gConfirmOptCancel| UPPER_LOWER_CASE_OFFSET)) &&
|
||||
((PopupType == EfiHiiPopupTypeOkCancel) || (PopupType == EfiHiiPopupTypeYesNoCancel)))
|
||||
{
|
||||
*UserSelection = EfiHiiPopupSelectionCancel;
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
} while (TRUE);
|
||||
}
|
||||
@@ -307,34 +323,35 @@ GetUserSelection (
|
||||
**/
|
||||
VOID
|
||||
GetStringOffsetWithWidth (
|
||||
IN CHAR16 *String,
|
||||
IN UINTN MaxWidth,
|
||||
OUT UINTN *Offset
|
||||
IN CHAR16 *String,
|
||||
IN UINTN MaxWidth,
|
||||
OUT UINTN *Offset
|
||||
)
|
||||
{
|
||||
UINTN StringWidth;
|
||||
UINTN CharWidth;
|
||||
UINTN StrOffset;
|
||||
UINTN StringWidth;
|
||||
UINTN CharWidth;
|
||||
UINTN StrOffset;
|
||||
|
||||
StringWidth = 0;
|
||||
CharWidth = 1;
|
||||
|
||||
for (StrOffset = 0; String[StrOffset] != CHAR_NULL; StrOffset++) {
|
||||
switch (String[StrOffset]) {
|
||||
case NARROW_CHAR:
|
||||
CharWidth = 1;
|
||||
break;
|
||||
case WIDE_CHAR:
|
||||
CharWidth = 2;
|
||||
break;
|
||||
default:
|
||||
StringWidth += CharWidth;
|
||||
if (StringWidth >= MaxWidth) {
|
||||
*Offset = StrOffset;
|
||||
return;
|
||||
}
|
||||
case NARROW_CHAR:
|
||||
CharWidth = 1;
|
||||
break;
|
||||
case WIDE_CHAR:
|
||||
CharWidth = 2;
|
||||
break;
|
||||
default:
|
||||
StringWidth += CharWidth;
|
||||
if (StringWidth >= MaxWidth) {
|
||||
*Offset = StrOffset;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*Offset = StrOffset;
|
||||
}
|
||||
|
||||
@@ -355,43 +372,46 @@ GetStringOffsetWithWidth (
|
||||
**/
|
||||
UINTN
|
||||
ParseMessageString (
|
||||
IN CHAR16 *InputString,
|
||||
OUT CHAR16 **OutputString,
|
||||
OUT UINTN *OutputStrWidth,
|
||||
IN OUT UINTN *Index
|
||||
IN CHAR16 *InputString,
|
||||
OUT CHAR16 **OutputString,
|
||||
OUT UINTN *OutputStrWidth,
|
||||
IN OUT UINTN *Index
|
||||
)
|
||||
{
|
||||
UINTN StrOffset;
|
||||
UINTN StrOffset;
|
||||
|
||||
if (InputString == NULL || Index == NULL || OutputString == NULL) {
|
||||
if ((InputString == NULL) || (Index == NULL) || (OutputString == NULL)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*OutputStrWidth = 0;
|
||||
|
||||
//
|
||||
//Check the string to see if there are line break characters in the string
|
||||
// Check the string to see if there are line break characters in the string
|
||||
//
|
||||
for (StrOffset = 0;
|
||||
InputString[*Index + StrOffset] != CHAR_CARRIAGE_RETURN && InputString[*Index + StrOffset] != CHAR_LINEFEED && InputString[*Index + StrOffset] != CHAR_NULL;
|
||||
StrOffset++
|
||||
);
|
||||
InputString[*Index + StrOffset] != CHAR_CARRIAGE_RETURN && InputString[*Index + StrOffset] != CHAR_LINEFEED && InputString[*Index + StrOffset] != CHAR_NULL;
|
||||
StrOffset++
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// The CHAR_NULL has process last time, this time just return 0 to stand for finishing parsing the InputString.
|
||||
//
|
||||
if (StrOffset == 0 && (InputString[*Index + StrOffset] == CHAR_NULL)) {
|
||||
if ((StrOffset == 0) && (InputString[*Index + StrOffset] == CHAR_NULL)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Copy the string to OutputString buffer and calculate the width of OutputString.
|
||||
//
|
||||
*OutputString = AllocateZeroPool ((StrOffset + 1) * sizeof(CHAR16));
|
||||
*OutputString = AllocateZeroPool ((StrOffset + 1) * sizeof (CHAR16));
|
||||
if (*OutputString == NULL) {
|
||||
return 0;
|
||||
}
|
||||
CopyMem ((*OutputString), &InputString[*Index], StrOffset * sizeof(CHAR16));
|
||||
|
||||
CopyMem ((*OutputString), &InputString[*Index], StrOffset * sizeof (CHAR16));
|
||||
*OutputStrWidth = (GetStringWidth (*OutputString) -2) / 2;
|
||||
|
||||
//
|
||||
@@ -435,12 +455,12 @@ CalculatePopupPosition (
|
||||
OUT EFI_SCREEN_DESCRIPTOR *ScreenForPopup
|
||||
)
|
||||
{
|
||||
CHAR16 *OutputString;
|
||||
UINTN StringIndex;
|
||||
UINTN OutputStrWidth;
|
||||
UINTN OptionRowWidth;
|
||||
UINTN Columns;
|
||||
UINTN Rows;
|
||||
CHAR16 *OutputString;
|
||||
UINTN StringIndex;
|
||||
UINTN OutputStrWidth;
|
||||
UINTN OptionRowWidth;
|
||||
UINTN Columns;
|
||||
UINTN Rows;
|
||||
|
||||
OptionRowWidth = 0;
|
||||
|
||||
@@ -448,10 +468,11 @@ CalculatePopupPosition (
|
||||
// Calculate the row number which is needed to show the message string and the max width of the string in one row.
|
||||
//
|
||||
for (StringIndex = 0; ParseMessageString (gMessageString, &OutputString, &OutputStrWidth, &StringIndex) != 0;) {
|
||||
gMesStrLineNum ++;
|
||||
gMesStrLineNum++;
|
||||
if (gMaxRowWidth < OutputStrWidth) {
|
||||
gMaxRowWidth = OutputStrWidth;
|
||||
}
|
||||
|
||||
FreePool (OutputString);
|
||||
}
|
||||
|
||||
@@ -467,6 +488,7 @@ CalculatePopupPosition (
|
||||
} else if (PopupType == EfiHiiPopupTypeYesNoCancel) {
|
||||
OptionRowWidth = USER_SELECTABLE_OPTION_SKIP_WIDTH *4 + USER_SELECTABLE_OPTION_YES_NO_CAL_WIDTH;
|
||||
}
|
||||
|
||||
if (OptionRowWidth > gMaxRowWidth) {
|
||||
gMaxRowWidth = OptionRowWidth;
|
||||
}
|
||||
@@ -480,16 +502,16 @@ CalculatePopupPosition (
|
||||
// Select the smaller one between actual dimension of message string and the avialble dimension for message string.
|
||||
//
|
||||
gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &Columns, &Rows);
|
||||
gMaxRowWidth = MIN (gMaxRowWidth, Columns - 2 * POPUP_BORDER);
|
||||
gMaxRowWidth = MIN (gMaxRowWidth, Columns - 2 * POPUP_BORDER);
|
||||
gMesStrLineNum = MIN (gMesStrLineNum, Rows -1 - POPUP_FOOTER_HEIGHT - POPUP_HEADER_HEIGHT);
|
||||
|
||||
//
|
||||
// Calculate the start column, end column, top row and bottom row for the popup.
|
||||
//
|
||||
ScreenForPopup->LeftColumn = (Columns -2 * POPUP_BORDER - gMaxRowWidth) / 2;
|
||||
ScreenForPopup->LeftColumn = (Columns -2 * POPUP_BORDER - gMaxRowWidth) / 2;
|
||||
ScreenForPopup->RightColumn = ScreenForPopup->LeftColumn + gMaxRowWidth + 2 * POPUP_BORDER - 1;
|
||||
ScreenForPopup->TopRow = (Rows - 1 - POPUP_FOOTER_HEIGHT - POPUP_HEADER_HEIGHT - gMesStrLineNum) / 2;
|
||||
ScreenForPopup->BottomRow = ScreenForPopup->TopRow + gMesStrLineNum + POPUP_FOOTER_HEIGHT + POPUP_HEADER_HEIGHT - 1;
|
||||
ScreenForPopup->TopRow = (Rows - 1 - POPUP_FOOTER_HEIGHT - POPUP_HEADER_HEIGHT - gMesStrLineNum) / 2;
|
||||
ScreenForPopup->BottomRow = ScreenForPopup->TopRow + gMesStrLineNum + POPUP_FOOTER_HEIGHT + POPUP_HEADER_HEIGHT - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -507,29 +529,29 @@ CalculatePopupPosition (
|
||||
**/
|
||||
EFI_STATUS
|
||||
DrawMessageBox (
|
||||
IN EFI_HII_POPUP_STYLE PopupStyle
|
||||
IN EFI_HII_POPUP_STYLE PopupStyle
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Length;
|
||||
UINTN EndCol;
|
||||
UINTN TopRow;
|
||||
UINTN StartCol;
|
||||
UINTN BottomRow;
|
||||
CHAR16 Character;
|
||||
UINTN DisplayRow;
|
||||
UINTN StringIndex;
|
||||
CHAR16 *TempString;
|
||||
CHAR16 *OutputString;
|
||||
UINTN ColDimension;
|
||||
UINTN OutputStrWidth;
|
||||
UINTN DrawMesStrRowNum;
|
||||
UINTN Index;
|
||||
UINTN Length;
|
||||
UINTN EndCol;
|
||||
UINTN TopRow;
|
||||
UINTN StartCol;
|
||||
UINTN BottomRow;
|
||||
CHAR16 Character;
|
||||
UINTN DisplayRow;
|
||||
UINTN StringIndex;
|
||||
CHAR16 *TempString;
|
||||
CHAR16 *OutputString;
|
||||
UINTN ColDimension;
|
||||
UINTN OutputStrWidth;
|
||||
UINTN DrawMesStrRowNum;
|
||||
|
||||
EndCol = gPopupDimensions.RightColumn;
|
||||
TopRow = gPopupDimensions.TopRow;
|
||||
StartCol = gPopupDimensions.LeftColumn;
|
||||
BottomRow = gPopupDimensions.BottomRow;
|
||||
ColDimension = EndCol - StartCol + 1;
|
||||
EndCol = gPopupDimensions.RightColumn;
|
||||
TopRow = gPopupDimensions.TopRow;
|
||||
StartCol = gPopupDimensions.LeftColumn;
|
||||
BottomRow = gPopupDimensions.BottomRow;
|
||||
ColDimension = EndCol - StartCol + 1;
|
||||
DrawMesStrRowNum = 0;
|
||||
|
||||
//
|
||||
@@ -541,15 +563,16 @@ DrawMessageBox (
|
||||
for (Index = StartCol; Index + 1 < EndCol; Index++) {
|
||||
PrintCharAt ((UINTN)-1, (UINTN)-1, Character);
|
||||
}
|
||||
|
||||
Character = BOXDRAW_DOWN_LEFT;
|
||||
PrintCharAt ((UINTN)-1, (UINTN)-1, Character);
|
||||
|
||||
//
|
||||
// 2. Draw the prompt string for different popup styles.
|
||||
//
|
||||
Character = BOXDRAW_VERTICAL;
|
||||
Character = BOXDRAW_VERTICAL;
|
||||
DisplayRow = TopRow + POPUP_BORDER;
|
||||
ClearLines (StartCol, EndCol, DisplayRow, DisplayRow, GetPopupColor ());
|
||||
ClearLines (StartCol, EndCol, DisplayRow, DisplayRow, GetPopupColor ());
|
||||
PrintCharAt (StartCol, DisplayRow, Character);
|
||||
PrintCharAt (EndCol, DisplayRow, Character);
|
||||
if (PopupStyle == EfiHiiPopupStyleError) {
|
||||
@@ -564,11 +587,12 @@ DrawMessageBox (
|
||||
// 3. Draw the horizontal line below the prompt string for different popup styles.
|
||||
//
|
||||
DisplayRow = TopRow + POPUP_BORDER + POPUP_STYLE_STRING_HEIGHT;
|
||||
ClearLines (StartCol, EndCol, DisplayRow, DisplayRow, GetPopupColor ());
|
||||
ClearLines (StartCol, EndCol, DisplayRow, DisplayRow, GetPopupColor ());
|
||||
Character = BOXDRAW_HORIZONTAL;
|
||||
for (Index = StartCol + 1; Index < EndCol; Index++) {
|
||||
PrintCharAt (Index, DisplayRow, Character);
|
||||
}
|
||||
|
||||
Character = BOXDRAW_VERTICAL;
|
||||
PrintCharAt (StartCol, DisplayRow, Character);
|
||||
PrintCharAt (EndCol, DisplayRow, Character);
|
||||
@@ -577,13 +601,13 @@ DrawMessageBox (
|
||||
// 4. Draw the mesage string.
|
||||
//
|
||||
DisplayRow = TopRow + POPUP_HEADER_HEIGHT;
|
||||
for (Index = DisplayRow ,StringIndex = 0; ParseMessageString (gMessageString, &OutputString, &OutputStrWidth, &StringIndex) != 0 && DrawMesStrRowNum < gMesStrLineNum;) {
|
||||
ClearLines (StartCol, EndCol, Index, Index, GetPopupColor ());
|
||||
for (Index = DisplayRow, StringIndex = 0; ParseMessageString (gMessageString, &OutputString, &OutputStrWidth, &StringIndex) != 0 && DrawMesStrRowNum < gMesStrLineNum;) {
|
||||
ClearLines (StartCol, EndCol, Index, Index, GetPopupColor ());
|
||||
PrintCharAt (StartCol, Index, Character);
|
||||
PrintCharAt (EndCol, Index, Character);
|
||||
if (OutputStrWidth > gMaxRowWidth) {
|
||||
//
|
||||
//OutputStrWidth > MaxMesStrWidth, cut off the string and print print ... instead.
|
||||
// OutputStrWidth > MaxMesStrWidth, cut off the string and print print ... instead.
|
||||
//
|
||||
GetStringOffsetWithWidth (OutputString, gMaxRowWidth, &Length);
|
||||
TempString = AllocateZeroPool ((Length + 1) * sizeof (CHAR16));
|
||||
@@ -591,6 +615,7 @@ DrawMessageBox (
|
||||
FreePool (OutputString);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
StrnCpyS (TempString, Length + 1, OutputString, Length - 3);
|
||||
StrCatS (TempString, Length + 1, L"...");
|
||||
PrintStringAt ((ColDimension - gMaxRowWidth) / 2 + StartCol, Index, TempString);
|
||||
@@ -598,30 +623,31 @@ DrawMessageBox (
|
||||
} else {
|
||||
PrintStringAt ((ColDimension - OutputStrWidth) / 2 + StartCol, Index, OutputString);
|
||||
}
|
||||
Index ++;
|
||||
DrawMesStrRowNum ++;
|
||||
|
||||
Index++;
|
||||
DrawMesStrRowNum++;
|
||||
FreePool (OutputString);
|
||||
}
|
||||
|
||||
//
|
||||
// 5. Draw an empty line after message string.
|
||||
//
|
||||
ClearLines (StartCol, EndCol, Index, Index, GetPopupColor ());
|
||||
ClearLines (StartCol, EndCol, Index, Index, GetPopupColor ());
|
||||
PrintCharAt (StartCol, Index, Character);
|
||||
PrintCharAt (EndCol, Index, Character);
|
||||
//
|
||||
// Check whether the actual string row number beyond the MesStrRowNum, if yes, print the ...... in the row.
|
||||
//
|
||||
if (OutputStrWidth > 0 && DrawMesStrRowNum >= gMesStrLineNum) {
|
||||
if ((OutputStrWidth > 0) && (DrawMesStrRowNum >= gMesStrLineNum)) {
|
||||
PrintStringAt ((ColDimension - StrLen (L"......")) / 2 + StartCol, Index, L"......");
|
||||
}
|
||||
|
||||
//
|
||||
// 6. Draw an empty line which is used to show user selectable options, will draw concrete option strings in function GetUserSelection().
|
||||
//
|
||||
Character = BOXDRAW_VERTICAL;
|
||||
Character = BOXDRAW_VERTICAL;
|
||||
DisplayRow = BottomRow - POPUP_BORDER;
|
||||
ClearLines (StartCol, EndCol, DisplayRow, DisplayRow, GetPopupColor ());
|
||||
ClearLines (StartCol, EndCol, DisplayRow, DisplayRow, GetPopupColor ());
|
||||
PrintCharAt (StartCol, DisplayRow, Character);
|
||||
PrintCharAt (EndCol, DisplayRow, Character);
|
||||
|
||||
@@ -632,10 +658,11 @@ DrawMessageBox (
|
||||
PrintCharAt (StartCol, BottomRow, Character);
|
||||
Character = BOXDRAW_HORIZONTAL;
|
||||
for (Index = StartCol; Index + 1 < EndCol; Index++) {
|
||||
PrintCharAt ((UINTN)-1, (UINTN) -1, Character);
|
||||
PrintCharAt ((UINTN)-1, (UINTN)-1, Character);
|
||||
}
|
||||
|
||||
Character = BOXDRAW_UP_LEFT;
|
||||
PrintCharAt ((UINTN)-1, (UINTN) -1, Character);
|
||||
PrintCharAt ((UINTN)-1, (UINTN)-1, Character);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -659,12 +686,12 @@ DrawMessageBox (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CreatePopup (
|
||||
IN EFI_HII_POPUP_PROTOCOL *This,
|
||||
IN EFI_HII_POPUP_STYLE PopupStyle,
|
||||
IN EFI_HII_POPUP_TYPE PopupType,
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_STRING_ID Message,
|
||||
OUT EFI_HII_POPUP_SELECTION *UserSelection OPTIONAL
|
||||
IN EFI_HII_POPUP_PROTOCOL *This,
|
||||
IN EFI_HII_POPUP_STYLE PopupStyle,
|
||||
IN EFI_HII_POPUP_TYPE PopupType,
|
||||
IN EFI_HII_HANDLE HiiHandle,
|
||||
IN EFI_STRING_ID Message,
|
||||
OUT EFI_HII_POPUP_SELECTION *UserSelection OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
|
||||
@@ -675,17 +702,17 @@ CreatePopup (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if((HiiHandle == NULL) || (Message == 0)) {
|
||||
if ((HiiHandle == NULL) || (Message == 0)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
gMessageString = HiiGetString (HiiHandle, Message, NULL);
|
||||
if(gMessageString == NULL) {
|
||||
if (gMessageString == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ConOut = gST->ConOut;
|
||||
gMaxRowWidth = 0;
|
||||
ConOut = gST->ConOut;
|
||||
gMaxRowWidth = 0;
|
||||
gMesStrLineNum = 0;
|
||||
|
||||
CopyMem (&SavedConsoleMode, ConOut->Mode, sizeof (SavedConsoleMode));
|
||||
@@ -721,4 +748,3 @@ Done:
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user