summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/DisplayEngineDxe
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:02 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commit1436aea4d5707e672672a11bda72be2c63c936c3 (patch)
tree370c9d5bd8823aa8ea7bce71a0f29bff71feff67 /MdeModulePkg/Universal/DisplayEngineDxe
parent7c7184e201a90a1d2376e615e55e3f4074731468 (diff)
downloadedk2-1436aea4d5707e672672a11bda72be2c63c936c3.tar.gz
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>
Diffstat (limited to 'MdeModulePkg/Universal/DisplayEngineDxe')
-rw-r--r--MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c3300
-rw-r--r--MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h329
-rw-r--r--MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c1736
-rw-r--r--MdeModulePkg/Universal/DisplayEngineDxe/Popup.c490
-rw-r--r--MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c1321
5 files changed, 3664 insertions, 3512 deletions
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
index a3898dc2ec..a7b7dc743a 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -12,7 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Search table for UiDisplayMenu()
//
-SCAN_CODE_TO_SCREEN_OPERATION gScanCodeToOperation[] = {
+SCAN_CODE_TO_SCREEN_OPERATION gScanCodeToOperation[] = {
{
SCAN_UP,
UiUp,
@@ -43,7 +43,7 @@ SCAN_CODE_TO_SCREEN_OPERATION gScanCodeToOperation[] = {
}
};
-UINTN mScanCodeNumber = ARRAY_SIZE (gScanCodeToOperation);
+UINTN mScanCodeNumber = ARRAY_SIZE (gScanCodeToOperation);
SCREEN_OPERATION_T0_CONTROL_FLAG gScreenOperationToControlFlag[] = {
{
@@ -89,79 +89,79 @@ SCREEN_OPERATION_T0_CONTROL_FLAG gScreenOperationToControlFlag[] = {
};
EFI_GUID gDisplayEngineGuid = {
- 0xE38C1029, 0xE38F, 0x45b9, {0x8F, 0x0D, 0xE2, 0xE6, 0x0B, 0xC9, 0xB2, 0x62}
+ 0xE38C1029, 0xE38F, 0x45b9, { 0x8F, 0x0D, 0xE2, 0xE6, 0x0B, 0xC9, 0xB2, 0x62 }
};
-BOOLEAN gMisMatch;
-EFI_SCREEN_DESCRIPTOR gStatementDimensions;
-BOOLEAN mStatementLayoutIsChanged = TRUE;
-USER_INPUT *gUserInput;
-FORM_DISPLAY_ENGINE_FORM *gFormData;
-EFI_HII_HANDLE gHiiHandle;
-UINT16 gDirection;
-LIST_ENTRY gMenuOption;
-DISPLAY_HIGHLIGHT_MENU_INFO gHighligthMenuInfo = {0};
-BOOLEAN mIsFirstForm = TRUE;
-FORM_ENTRY_INFO gOldFormEntry = {0};
+BOOLEAN gMisMatch;
+EFI_SCREEN_DESCRIPTOR gStatementDimensions;
+BOOLEAN mStatementLayoutIsChanged = TRUE;
+USER_INPUT *gUserInput;
+FORM_DISPLAY_ENGINE_FORM *gFormData;
+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
//
-CHAR16 *gReconnectConfirmChanges;
-CHAR16 *gReconnectFail;
-CHAR16 *gReconnectRequired;
-CHAR16 *gChangesOpt;
-CHAR16 *gFormNotFound;
-CHAR16 *gNoSubmitIf;
-CHAR16 *gBrowserError;
-CHAR16 *gSaveFailed;
-CHAR16 *gNoSubmitIfFailed;
-CHAR16 *gSaveProcess;
-CHAR16 *gSaveNoSubmitProcess;
-CHAR16 *gDiscardChange;
-CHAR16 *gJumpToFormSet;
-CHAR16 *gCheckError;
-CHAR16 *gPromptForData;
-CHAR16 *gPromptForPassword;
-CHAR16 *gPromptForNewPassword;
-CHAR16 *gConfirmPassword;
-CHAR16 *gConfirmError;
-CHAR16 *gPassowordInvalid;
-CHAR16 *gPressEnter;
-CHAR16 *gEmptyString;
-CHAR16 *gMiniString;
-CHAR16 *gOptionMismatch;
-CHAR16 *gFormSuppress;
-CHAR16 *gProtocolNotFound;
-CHAR16 *gConfirmDefaultMsg;
-CHAR16 *gConfirmSubmitMsg;
-CHAR16 *gConfirmDiscardMsg;
-CHAR16 *gConfirmResetMsg;
-CHAR16 *gConfirmExitMsg;
-CHAR16 *gConfirmSubmitMsg2nd;
-CHAR16 *gConfirmDefaultMsg2nd;
-CHAR16 *gConfirmResetMsg2nd;
-CHAR16 *gConfirmExitMsg2nd;
-CHAR16 *gConfirmOpt;
-CHAR16 *gConfirmOptYes;
-CHAR16 *gConfirmOptNo;
-CHAR16 *gConfirmOptOk;
-CHAR16 *gConfirmOptCancel;
-CHAR16 *gYesOption;
-CHAR16 *gNoOption;
-CHAR16 *gOkOption;
-CHAR16 *gCancelOption;
-CHAR16 *gErrorPopup;
-CHAR16 *gWarningPopup;
-CHAR16 *gInfoPopup;
-CHAR16 *gConfirmMsgConnect;
-CHAR16 *gConfirmMsgEnd;
-CHAR16 *gPasswordUnsupported;
-CHAR16 gModalSkipColumn;
-CHAR16 gPromptBlockWidth;
-CHAR16 gOptionBlockWidth;
-CHAR16 gHelpBlockWidth;
-CHAR16 *mUnknownString;
+CHAR16 *gReconnectConfirmChanges;
+CHAR16 *gReconnectFail;
+CHAR16 *gReconnectRequired;
+CHAR16 *gChangesOpt;
+CHAR16 *gFormNotFound;
+CHAR16 *gNoSubmitIf;
+CHAR16 *gBrowserError;
+CHAR16 *gSaveFailed;
+CHAR16 *gNoSubmitIfFailed;
+CHAR16 *gSaveProcess;
+CHAR16 *gSaveNoSubmitProcess;
+CHAR16 *gDiscardChange;
+CHAR16 *gJumpToFormSet;
+CHAR16 *gCheckError;
+CHAR16 *gPromptForData;
+CHAR16 *gPromptForPassword;
+CHAR16 *gPromptForNewPassword;
+CHAR16 *gConfirmPassword;
+CHAR16 *gConfirmError;
+CHAR16 *gPassowordInvalid;
+CHAR16 *gPressEnter;
+CHAR16 *gEmptyString;
+CHAR16 *gMiniString;
+CHAR16 *gOptionMismatch;
+CHAR16 *gFormSuppress;
+CHAR16 *gProtocolNotFound;
+CHAR16 *gConfirmDefaultMsg;
+CHAR16 *gConfirmSubmitMsg;
+CHAR16 *gConfirmDiscardMsg;
+CHAR16 *gConfirmResetMsg;
+CHAR16 *gConfirmExitMsg;
+CHAR16 *gConfirmSubmitMsg2nd;
+CHAR16 *gConfirmDefaultMsg2nd;
+CHAR16 *gConfirmResetMsg2nd;
+CHAR16 *gConfirmExitMsg2nd;
+CHAR16 *gConfirmOpt;
+CHAR16 *gConfirmOptYes;
+CHAR16 *gConfirmOptNo;
+CHAR16 *gConfirmOptOk;
+CHAR16 *gConfirmOptCancel;
+CHAR16 *gYesOption;
+CHAR16 *gNoOption;
+CHAR16 *gOkOption;
+CHAR16 *gCancelOption;
+CHAR16 *gErrorPopup;
+CHAR16 *gWarningPopup;
+CHAR16 *gInfoPopup;
+CHAR16 *gConfirmMsgConnect;
+CHAR16 *gConfirmMsgEnd;
+CHAR16 *gPasswordUnsupported;
+CHAR16 gModalSkipColumn;
+CHAR16 gPromptBlockWidth;
+CHAR16 gOptionBlockWidth;
+CHAR16 gHelpBlockWidth;
+CHAR16 *mUnknownString;
FORM_DISPLAY_DRIVER_PRIVATE_DATA mPrivateData = {
FORM_DISPLAY_DRIVER_SIGNATURE,
@@ -177,7 +177,6 @@ FORM_DISPLAY_DRIVER_PRIVATE_DATA mPrivateData = {
}
};
-
/**
Get the string based on the StringId and HII Package List Handle.
@@ -190,8 +189,8 @@ FORM_DISPLAY_DRIVER_PRIVATE_DATA mPrivateData = {
**/
CHAR16 *
GetToken (
- IN EFI_STRING_ID Token,
- IN EFI_HII_HANDLE HiiHandle
+ IN EFI_STRING_ID Token,
+ IN EFI_HII_HANDLE HiiHandle
)
{
EFI_STRING String;
@@ -202,10 +201,9 @@ GetToken (
ASSERT (String != NULL);
}
- return (CHAR16 *) String;
+ return (CHAR16 *)String;
}
-
/**
Initialize the HII String Token to the correct values.
@@ -216,56 +214,56 @@ InitializeDisplayStrings (
)
{
gReconnectConfirmChanges = GetToken (STRING_TOKEN (RECONNECT_CONFIRM_CHANGES), gHiiHandle);
- mUnknownString = GetToken (STRING_TOKEN (UNKNOWN_STRING), gHiiHandle);
- gSaveFailed = GetToken (STRING_TOKEN (SAVE_FAILED), gHiiHandle);
- gNoSubmitIfFailed = GetToken (STRING_TOKEN (NO_SUBMIT_IF_CHECK_FAILED), gHiiHandle);
- gReconnectFail = GetToken (STRING_TOKEN (RECONNECT_FAILED), gHiiHandle);
- gReconnectRequired = GetToken (STRING_TOKEN (RECONNECT_REQUIRED), gHiiHandle);
- gChangesOpt = GetToken (STRING_TOKEN (RECONNECT_CHANGES_OPTIONS), gHiiHandle);
- gSaveProcess = GetToken (STRING_TOKEN (DISCARD_OR_JUMP), gHiiHandle);
- gSaveNoSubmitProcess = GetToken (STRING_TOKEN (DISCARD_OR_CHECK), gHiiHandle);
- gDiscardChange = GetToken (STRING_TOKEN (DISCARD_OR_JUMP_DISCARD), gHiiHandle);
- gJumpToFormSet = GetToken (STRING_TOKEN (DISCARD_OR_JUMP_JUMP), gHiiHandle);
- gCheckError = GetToken (STRING_TOKEN (DISCARD_OR_CHECK_CHECK), gHiiHandle);
- gPromptForData = GetToken (STRING_TOKEN (PROMPT_FOR_DATA), gHiiHandle);
- gPromptForPassword = GetToken (STRING_TOKEN (PROMPT_FOR_PASSWORD), gHiiHandle);
- gPromptForNewPassword = GetToken (STRING_TOKEN (PROMPT_FOR_NEW_PASSWORD), gHiiHandle);
- gConfirmPassword = GetToken (STRING_TOKEN (CONFIRM_PASSWORD), gHiiHandle);
- gConfirmError = GetToken (STRING_TOKEN (CONFIRM_ERROR), gHiiHandle);
- gPassowordInvalid = GetToken (STRING_TOKEN (PASSWORD_INVALID), gHiiHandle);
- gPressEnter = GetToken (STRING_TOKEN (PRESS_ENTER), gHiiHandle);
- gEmptyString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
- gMiniString = GetToken (STRING_TOKEN (MINI_STRING), gHiiHandle);
- gOptionMismatch = GetToken (STRING_TOKEN (OPTION_MISMATCH), gHiiHandle);
- gFormSuppress = GetToken (STRING_TOKEN (FORM_SUPPRESSED), gHiiHandle);
- gProtocolNotFound = GetToken (STRING_TOKEN (PROTOCOL_NOT_FOUND), gHiiHandle);
- gFormNotFound = GetToken (STRING_TOKEN (STATUS_BROWSER_FORM_NOT_FOUND), gHiiHandle);
- gNoSubmitIf = GetToken (STRING_TOKEN (STATUS_BROWSER_NO_SUBMIT_IF), gHiiHandle);
- gBrowserError = GetToken (STRING_TOKEN (STATUS_BROWSER_ERROR), gHiiHandle);
- gConfirmDefaultMsg = GetToken (STRING_TOKEN (CONFIRM_DEFAULT_MESSAGE), gHiiHandle);
- gConfirmDiscardMsg = GetToken (STRING_TOKEN (CONFIRM_DISCARD_MESSAGE), gHiiHandle);
- gConfirmSubmitMsg = GetToken (STRING_TOKEN (CONFIRM_SUBMIT_MESSAGE), gHiiHandle);
- gConfirmResetMsg = GetToken (STRING_TOKEN (CONFIRM_RESET_MESSAGE), gHiiHandle);
- gConfirmExitMsg = GetToken (STRING_TOKEN (CONFIRM_EXIT_MESSAGE), gHiiHandle);
- gConfirmDefaultMsg2nd = GetToken (STRING_TOKEN (CONFIRM_DEFAULT_MESSAGE_2ND), gHiiHandle);
- gConfirmSubmitMsg2nd = GetToken (STRING_TOKEN (CONFIRM_SUBMIT_MESSAGE_2ND), gHiiHandle);
- gConfirmResetMsg2nd = GetToken (STRING_TOKEN (CONFIRM_RESET_MESSAGE_2ND), gHiiHandle);
- gConfirmExitMsg2nd = GetToken (STRING_TOKEN (CONFIRM_EXIT_MESSAGE_2ND), gHiiHandle);
- gConfirmOpt = GetToken (STRING_TOKEN (CONFIRM_OPTION), gHiiHandle);
- gConfirmOptYes = GetToken (STRING_TOKEN (CONFIRM_OPTION_YES), gHiiHandle);
- gConfirmOptNo = GetToken (STRING_TOKEN (CONFIRM_OPTION_NO), gHiiHandle);
- gConfirmOptOk = GetToken (STRING_TOKEN (CONFIRM_OPTION_OK), gHiiHandle);
- gConfirmOptCancel = GetToken (STRING_TOKEN (CONFIRM_OPTION_CANCEL), gHiiHandle);
- gYesOption = GetToken (STRING_TOKEN (YES_SELECTABLE_OPTION), gHiiHandle);
- gNoOption = GetToken (STRING_TOKEN (NO_SELECTABLE_OPTION), gHiiHandle);
- gOkOption = GetToken (STRING_TOKEN (OK_SELECTABLE_OPTION), gHiiHandle);
- gCancelOption = GetToken (STRING_TOKEN (CANCEL_SELECTABLE_OPTION), gHiiHandle);
- gErrorPopup = GetToken (STRING_TOKEN (ERROR_POPUP_STRING), gHiiHandle);
- gWarningPopup = GetToken (STRING_TOKEN (WARNING_POPUP_STRING), gHiiHandle);
- gInfoPopup = GetToken (STRING_TOKEN (INFO_POPUP_STRING), gHiiHandle);
- gConfirmMsgConnect = GetToken (STRING_TOKEN (CONFIRM_OPTION_CONNECT), gHiiHandle);
- gConfirmMsgEnd = GetToken (STRING_TOKEN (CONFIRM_OPTION_END), gHiiHandle);
- gPasswordUnsupported = GetToken (STRING_TOKEN (PASSWORD_NOT_SUPPORTED ), gHiiHandle);
+ mUnknownString = GetToken (STRING_TOKEN (UNKNOWN_STRING), gHiiHandle);
+ gSaveFailed = GetToken (STRING_TOKEN (SAVE_FAILED), gHiiHandle);
+ gNoSubmitIfFailed = GetToken (STRING_TOKEN (NO_SUBMIT_IF_CHECK_FAILED), gHiiHandle);
+ gReconnectFail = GetToken (STRING_TOKEN (RECONNECT_FAILED), gHiiHandle);
+ gReconnectRequired = GetToken (STRING_TOKEN (RECONNECT_REQUIRED), gHiiHandle);
+ gChangesOpt = GetToken (STRING_TOKEN (RECONNECT_CHANGES_OPTIONS), gHiiHandle);
+ gSaveProcess = GetToken (STRING_TOKEN (DISCARD_OR_JUMP), gHiiHandle);
+ gSaveNoSubmitProcess = GetToken (STRING_TOKEN (DISCARD_OR_CHECK), gHiiHandle);
+ gDiscardChange = GetToken (STRING_TOKEN (DISCARD_OR_JUMP_DISCARD), gHiiHandle);
+ gJumpToFormSet = GetToken (STRING_TOKEN (DISCARD_OR_JUMP_JUMP), gHiiHandle);
+ gCheckError = GetToken (STRING_TOKEN (DISCARD_OR_CHECK_CHECK), gHiiHandle);
+ gPromptForData = GetToken (STRING_TOKEN (PROMPT_FOR_DATA), gHiiHandle);
+ gPromptForPassword = GetToken (STRING_TOKEN (PROMPT_FOR_PASSWORD), gHiiHandle);
+ gPromptForNewPassword = GetToken (STRING_TOKEN (PROMPT_FOR_NEW_PASSWORD), gHiiHandle);
+ gConfirmPassword = GetToken (STRING_TOKEN (CONFIRM_PASSWORD), gHiiHandle);
+ gConfirmError = GetToken (STRING_TOKEN (CONFIRM_ERROR), gHiiHandle);
+ gPassowordInvalid = GetToken (STRING_TOKEN (PASSWORD_INVALID), gHiiHandle);
+ gPressEnter = GetToken (STRING_TOKEN (PRESS_ENTER), gHiiHandle);
+ gEmptyString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
+ gMiniString = GetToken (STRING_TOKEN (MINI_STRING), gHiiHandle);
+ gOptionMismatch = GetToken (STRING_TOKEN (OPTION_MISMATCH), gHiiHandle);
+ gFormSuppress = GetToken (STRING_TOKEN (FORM_SUPPRESSED), gHiiHandle);
+ gProtocolNotFound = GetToken (STRING_TOKEN (PROTOCOL_NOT_FOUND), gHiiHandle);
+ gFormNotFound = GetToken (STRING_TOKEN (STATUS_BROWSER_FORM_NOT_FOUND), gHiiHandle);
+ gNoSubmitIf = GetToken (STRING_TOKEN (STATUS_BROWSER_NO_SUBMIT_IF), gHiiHandle);
+ gBrowserError = GetToken (STRING_TOKEN (STATUS_BROWSER_ERROR), gHiiHandle);
+ gConfirmDefaultMsg = GetToken (STRING_TOKEN (CONFIRM_DEFAULT_MESSAGE), gHiiHandle);
+ gConfirmDiscardMsg = GetToken (STRING_TOKEN (CONFIRM_DISCARD_MESSAGE), gHiiHandle);
+ gConfirmSubmitMsg = GetToken (STRING_TOKEN (CONFIRM_SUBMIT_MESSAGE), gHiiHandle);
+ gConfirmResetMsg = GetToken (STRING_TOKEN (CONFIRM_RESET_MESSAGE), gHiiHandle);
+ gConfirmExitMsg = GetToken (STRING_TOKEN (CONFIRM_EXIT_MESSAGE), gHiiHandle);
+ gConfirmDefaultMsg2nd = GetToken (STRING_TOKEN (CONFIRM_DEFAULT_MESSAGE_2ND), gHiiHandle);
+ gConfirmSubmitMsg2nd = GetToken (STRING_TOKEN (CONFIRM_SUBMIT_MESSAGE_2ND), gHiiHandle);
+ gConfirmResetMsg2nd = GetToken (STRING_TOKEN (CONFIRM_RESET_MESSAGE_2ND), gHiiHandle);
+ gConfirmExitMsg2nd = GetToken (STRING_TOKEN (CONFIRM_EXIT_MESSAGE_2ND), gHiiHandle);
+ gConfirmOpt = GetToken (STRING_TOKEN (CONFIRM_OPTION), gHiiHandle);
+ gConfirmOptYes = GetToken (STRING_TOKEN (CONFIRM_OPTION_YES), gHiiHandle);
+ gConfirmOptNo = GetToken (STRING_TOKEN (CONFIRM_OPTION_NO), gHiiHandle);
+ gConfirmOptOk = GetToken (STRING_TOKEN (CONFIRM_OPTION_OK), gHiiHandle);
+ gConfirmOptCancel = GetToken (STRING_TOKEN (CONFIRM_OPTION_CANCEL), gHiiHandle);
+ gYesOption = GetToken (STRING_TOKEN (YES_SELECTABLE_OPTION), gHiiHandle);
+ gNoOption = GetToken (STRING_TOKEN (NO_SELECTABLE_OPTION), gHiiHandle);
+ gOkOption = GetToken (STRING_TOKEN (OK_SELECTABLE_OPTION), gHiiHandle);
+ gCancelOption = GetToken (STRING_TOKEN (CANCEL_SELECTABLE_OPTION), gHiiHandle);
+ gErrorPopup = GetToken (STRING_TOKEN (ERROR_POPUP_STRING), gHiiHandle);
+ gWarningPopup = GetToken (STRING_TOKEN (WARNING_POPUP_STRING), gHiiHandle);
+ gInfoPopup = GetToken (STRING_TOKEN (INFO_POPUP_STRING), gHiiHandle);
+ gConfirmMsgConnect = GetToken (STRING_TOKEN (CONFIRM_OPTION_CONNECT), gHiiHandle);
+ gConfirmMsgEnd = GetToken (STRING_TOKEN (CONFIRM_OPTION_END), gHiiHandle);
+ gPasswordUnsupported = GetToken (STRING_TOKEN (PASSWORD_NOT_SUPPORTED), gHiiHandle);
}
/**
@@ -341,7 +339,7 @@ FreeDisplayStrings (
**/
EFI_STRING_ID
GetPrompt (
- IN EFI_IFR_OP_HEADER *OpCode
+ IN EFI_IFR_OP_HEADER *OpCode
)
{
EFI_IFR_STATEMENT_HEADER *Header;
@@ -350,7 +348,7 @@ GetPrompt (
return 0;
}
- Header = (EFI_IFR_STATEMENT_HEADER *) (OpCode + 1);
+ Header = (EFI_IFR_STATEMENT_HEADER *)(OpCode + 1);
return Header->Prompt;
}
@@ -366,15 +364,15 @@ GetPrompt (
**/
UINT16
GetWidth (
- IN UI_MENU_OPTION *MenuOption,
- OUT UINT16 *AdjustWidth
+ IN UI_MENU_OPTION *MenuOption,
+ OUT UINT16 *AdjustWidth
)
{
- CHAR16 *String;
- UINTN Size;
- EFI_IFR_TEXT *TextOp;
- UINT16 ReturnWidth;
- FORM_DISPLAY_ENGINE_STATEMENT *Statement;
+ CHAR16 *String;
+ UINTN Size;
+ EFI_IFR_TEXT *TextOp;
+ UINT16 ReturnWidth;
+ FORM_DISPLAY_ENGINE_STATEMENT *Statement;
Statement = MenuOption->ThisTag;
@@ -385,6 +383,7 @@ GetWidth (
if (AdjustWidth != NULL) {
*AdjustWidth = LEFT_SKIPPED_COLUMNS;
}
+
return (UINT16)(gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - 2 * (gModalSkipColumn + LEFT_SKIPPED_COLUMNS));
}
@@ -394,7 +393,7 @@ GetWidth (
// See if the second text parameter is really NULL
//
if (Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) {
- TextOp = (EFI_IFR_TEXT *) Statement->OpCode;
+ TextOp = (EFI_IFR_TEXT *)Statement->OpCode;
if (TextOp->TextTwo != 0) {
String = GetToken (TextOp->TextTwo, gFormData->HiiHandle);
Size = StrLen (String);
@@ -411,24 +410,25 @@ GetWidth (
// Allow a wide display if text op-code and no secondary text op-code
//
((Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) && (Size == 0))
- ) {
-
+ )
+ {
//
// Return the space width.
//
if (AdjustWidth != NULL) {
*AdjustWidth = 2;
}
+
//
// Keep consistent with current behavior.
//
- ReturnWidth = (UINT16) (gPromptBlockWidth + gOptionBlockWidth - 2);
+ ReturnWidth = (UINT16)(gPromptBlockWidth + gOptionBlockWidth - 2);
} else {
if (AdjustWidth != NULL) {
*AdjustWidth = 1;
}
- ReturnWidth = (UINT16) (gPromptBlockWidth - 1);
+ ReturnWidth = (UINT16)(gPromptBlockWidth - 1);
}
//
@@ -462,25 +462,25 @@ GetWidth (
**/
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
)
{
- UINT16 StrOffset;
- UINT16 GlyphOffset;
- UINT16 OriginalGlyphWidth;
- BOOLEAN ReturnFlag;
- UINT16 LastSpaceOffset;
- UINT16 LastGlyphWidth;
-
- if (InputString == NULL || Index == NULL || OutputString == NULL) {
+ UINT16 StrOffset;
+ UINT16 GlyphOffset;
+ UINT16 OriginalGlyphWidth;
+ BOOLEAN ReturnFlag;
+ UINT16 LastSpaceOffset;
+ UINT16 LastGlyphWidth;
+
+ if ((InputString == NULL) || (Index == NULL) || (OutputString == NULL)) {
return 0;
}
- if (LineWidth == 0 || *GlyphWidth == 0) {
+ if ((LineWidth == 0) || (*GlyphWidth == 0)) {
return 0;
}
@@ -529,6 +529,7 @@ GetLineByWidth (
LastSpaceOffset = StrOffset;
LastGlyphWidth = *GlyphWidth;
}
+
break;
}
@@ -558,14 +559,14 @@ GetLineByWidth (
//
// The CHAR_NULL has process last time, this time just return 0 to stand for the end.
//
- if (StrOffset == 0 && (InputString[*Index + StrOffset] == CHAR_NULL)) {
+ if ((StrOffset == 0) && (InputString[*Index + StrOffset] == CHAR_NULL)) {
return 0;
}
//
// Need extra glyph info and '\0' info, so +2.
//
- *OutputString = AllocateZeroPool ((StrOffset + 2) * sizeof(CHAR16));
+ *OutputString = AllocateZeroPool ((StrOffset + 2) * sizeof (CHAR16));
if (*OutputString == NULL) {
return 0;
}
@@ -575,37 +576,37 @@ GetLineByWidth (
//
if (OriginalGlyphWidth == 1) {
*(*OutputString) = NARROW_CHAR;
- } else {
+ } else {
*(*OutputString) = WIDE_CHAR;
}
- CopyMem ((*OutputString) + 1, &InputString[*Index], StrOffset * sizeof(CHAR16));
+ CopyMem ((*OutputString) + 1, &InputString[*Index], StrOffset * sizeof (CHAR16));
if (InputString[*Index + StrOffset] == CHAR_SPACE) {
//
// Skip the space info at the begin of next line.
//
- *Index = (UINT16) (*Index + StrOffset + 1);
+ *Index = (UINT16)(*Index + StrOffset + 1);
} else if (InputString[*Index + StrOffset] == CHAR_LINEFEED) {
//
// Skip the /n or /n/r info.
//
if (InputString[*Index + StrOffset + 1] == CHAR_CARRIAGE_RETURN) {
- *Index = (UINT16) (*Index + StrOffset + 2);
+ *Index = (UINT16)(*Index + StrOffset + 2);
} else {
- *Index = (UINT16) (*Index + StrOffset + 1);
+ *Index = (UINT16)(*Index + StrOffset + 1);
}
} else if (InputString[*Index + StrOffset] == CHAR_CARRIAGE_RETURN) {
//
// Skip the /r or /r/n info.
//
if (InputString[*Index + StrOffset + 1] == CHAR_LINEFEED) {
- *Index = (UINT16) (*Index + StrOffset + 2);
+ *Index = (UINT16)(*Index + StrOffset + 2);
} else {
- *Index = (UINT16) (*Index + StrOffset + 1);
+ *Index = (UINT16)(*Index + StrOffset + 1);
}
} else {
- *Index = (UINT16) (*Index + StrOffset);
+ *Index = (UINT16)(*Index + StrOffset);
}
//
@@ -624,20 +625,20 @@ GetLineByWidth (
**/
VOID
UiAddMenuOption (
- IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
- IN UINT16 *MenuItemCount,
- IN BOOLEAN NestIn
+ IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
+ IN UINT16 *MenuItemCount,
+ IN BOOLEAN NestIn
)
{
- UI_MENU_OPTION *MenuOption;
- UINTN Index;
- UINTN Count;
- UINT16 NumberOfLines;
- UINT16 GlyphWidth;
- UINT16 Width;
- UINTN ArrayEntry;
- CHAR16 *OutputString;
- EFI_STRING_ID PromptId;
+ UI_MENU_OPTION *MenuOption;
+ UINTN Index;
+ UINTN Count;
+ UINT16 NumberOfLines;
+ UINT16 GlyphWidth;
+ UINT16 Width;
+ UINTN ArrayEntry;
+ CHAR16 *OutputString;
+ EFI_STRING_ID PromptId;
NumberOfLines = 1;
ArrayEntry = 0;
@@ -648,7 +649,7 @@ UiAddMenuOption (
PromptId = GetPrompt (Statement->OpCode);
ASSERT (PromptId != 0);
- if (Statement->OpCode->OpCode == EFI_IFR_DATE_OP || Statement->OpCode->OpCode == EFI_IFR_TIME_OP) {
+ if ((Statement->OpCode->OpCode == EFI_IFR_DATE_OP) || (Statement->OpCode->OpCode == EFI_IFR_TIME_OP)) {
Count = 3;
}
@@ -656,12 +657,12 @@ UiAddMenuOption (
MenuOption = AllocateZeroPool (sizeof (UI_MENU_OPTION));
ASSERT (MenuOption);
- MenuOption->Signature = UI_MENU_OPTION_SIGNATURE;
- MenuOption->Description = GetToken (PromptId, gFormData->HiiHandle);
- MenuOption->Handle = gFormData->HiiHandle;
- MenuOption->ThisTag = Statement;
+ MenuOption->Signature = UI_MENU_OPTION_SIGNATURE;
+ MenuOption->Description = GetToken (PromptId, gFormData->HiiHandle);
+ MenuOption->Handle = gFormData->HiiHandle;
+ MenuOption->ThisTag = Statement;
MenuOption->NestInStatement = NestIn;
- MenuOption->EntryNumber = *MenuItemCount;
+ MenuOption->EntryNumber = *MenuItemCount;
MenuOption->Sequence = Index;
@@ -671,43 +672,44 @@ UiAddMenuOption (
MenuOption->GrayOut = FALSE;
}
- if ((Statement->Attribute & HII_DISPLAY_LOCK) != 0 || (gFormData->Attribute & HII_DISPLAY_LOCK) != 0) {
+ if (((Statement->Attribute & HII_DISPLAY_LOCK) != 0) || ((gFormData->Attribute & HII_DISPLAY_LOCK) != 0)) {
MenuOption->GrayOut = TRUE;
}
//
// If the form or the question has the lock attribute, deal same as grayout.
//
- if ((gFormData->Attribute & HII_DISPLAY_LOCK) != 0 || (Statement->Attribute & HII_DISPLAY_LOCK) != 0) {
+ if (((gFormData->Attribute & HII_DISPLAY_LOCK) != 0) || ((Statement->Attribute & HII_DISPLAY_LOCK) != 0)) {
MenuOption->GrayOut = TRUE;
}
switch (Statement->OpCode->OpCode) {
- case EFI_IFR_ORDERED_LIST_OP:
- case EFI_IFR_ONE_OF_OP:
- case EFI_IFR_NUMERIC_OP:
- case EFI_IFR_TIME_OP:
- case EFI_IFR_DATE_OP:
- case EFI_IFR_CHECKBOX_OP:
- case EFI_IFR_PASSWORD_OP:
- case EFI_IFR_STRING_OP:
- //
- // User could change the value of these items
- //
- MenuOption->IsQuestion = TRUE;
- break;
- case EFI_IFR_TEXT_OP:
- if (FeaturePcdGet (PcdBrowserGrayOutTextStatement)) {
+ case EFI_IFR_ORDERED_LIST_OP:
+ case EFI_IFR_ONE_OF_OP:
+ case EFI_IFR_NUMERIC_OP:
+ case EFI_IFR_TIME_OP:
+ case EFI_IFR_DATE_OP:
+ case EFI_IFR_CHECKBOX_OP:
+ case EFI_IFR_PASSWORD_OP:
+ case EFI_IFR_STRING_OP:
//
- // Initializing GrayOut option as TRUE for Text setup options
- // so that those options will be Gray in colour and un selectable.
+ // User could change the value of these items
//
- MenuOption->GrayOut = TRUE;
- }
- break;
- default:
- MenuOption->IsQuestion = FALSE;
- break;
+ MenuOption->IsQuestion = TRUE;
+ break;
+ case EFI_IFR_TEXT_OP:
+ if (FeaturePcdGet (PcdBrowserGrayOutTextStatement)) {
+ //
+ // Initializing GrayOut option as TRUE for Text setup options
+ // so that those options will be Gray in colour and un selectable.
+ //
+ MenuOption->GrayOut = TRUE;
+ }
+
+ break;
+ default:
+ MenuOption->IsQuestion = FALSE;
+ break;
}
if ((Statement->Attribute & HII_DISPLAY_READONLY) != 0) {
@@ -717,17 +719,19 @@ UiAddMenuOption (
}
}
- if (Index == 0 &&
- (Statement->OpCode->OpCode != EFI_IFR_DATE_OP) &&
- (Statement->OpCode->OpCode != EFI_IFR_TIME_OP)) {
- Width = GetWidth (MenuOption, NULL);
- for (; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth,&ArrayEntry, &OutputString) != 0x0000;) {
+ if ((Index == 0) &&
+ (Statement->OpCode->OpCode != EFI_IFR_DATE_OP) &&
+ (Statement->OpCode->OpCode != EFI_IFR_TIME_OP))
+ {
+ Width = GetWidth (MenuOption, NULL);
+ for ( ; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &ArrayEntry, &OutputString) != 0x0000;) {
//
// If there is more string to process print on the next row and increment the Skip value
//
if (StrLen (&MenuOption->Description[ArrayEntry]) != 0) {
NumberOfLines++;
}
+
FreePool (OutputString);
}
} else {
@@ -763,11 +767,11 @@ ConvertStatementToMenu (
VOID
)
{
- UINT16 MenuItemCount;
- LIST_ENTRY *Link;
- LIST_ENTRY *NestLink;
- FORM_DISPLAY_ENGINE_STATEMENT *Statement;
- FORM_DISPLAY_ENGINE_STATEMENT *NestStatement;
+ UINT16 MenuItemCount;
+ LIST_ENTRY *Link;
+ LIST_ENTRY *NestLink;
+ FORM_DISPLAY_ENGINE_STATEMENT *Statement;
+ FORM_DISPLAY_ENGINE_STATEMENT *NestStatement;
MenuItemCount = 0;
InitializeListHead (&gMenuOption);
@@ -775,7 +779,7 @@ ConvertStatementToMenu (
Link = GetFirstNode (&gFormData->StatementListHead);
while (!IsNull (&gFormData->StatementListHead, Link)) {
Statement = FORM_DISPLAY_ENGINE_STATEMENT_FROM_LINK (Link);
- Link = GetNextNode (&gFormData->StatementListHead, Link);
+ Link = GetNextNode (&gFormData->StatementListHead, Link);
//
// Skip the opcode not recognized by Display core.
@@ -792,7 +796,7 @@ ConvertStatementToMenu (
NestLink = GetFirstNode (&Statement->NestStatementList);
while (!IsNull (&Statement->NestStatementList, NestLink)) {
NestStatement = FORM_DISPLAY_ENGINE_STATEMENT_FROM_LINK (NestLink);
- NestLink = GetNextNode (&Statement->NestStatementList, NestLink);
+ NestLink = GetNextNode (&Statement->NestStatementList, NestLink);
//
// Skip the opcode not recognized by Display core.
@@ -824,31 +828,32 @@ ConvertStatementToMenu (
**/
UINTN
GetStringWidth (
- IN CHAR16 *String
+ IN CHAR16 *String
)
{
- UINTN Index;
- UINTN Count;
- UINTN IncrementValue;
+ UINTN Index;
+ UINTN Count;
+ UINTN IncrementValue;
ASSERT (String != NULL);
if (String == NULL) {
return 0;
}
- Index = 0;
- Count = 0;
- IncrementValue = 1;
+ Index = 0;
+ Count = 0;
+ IncrementValue = 1;
do {
//
// Advance to the null-terminator or to the first width directive
//
- for (;
- (String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0);
- Index++, Count = Count + IncrementValue
- )
- ;
+ for ( ;
+ (String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0);
+ Index++, Count = Count + IncrementValue
+ )
+ {
+ }
//
// We hit the null-terminator, we now have a count
@@ -856,6 +861,7 @@ GetStringWidth (
if (String[Index] == 0) {
break;
}
+
//
// We encountered a narrow directive - strip it from the size calculation since it doesn't get printed
// and also set the flag that determines what we increment by.(if narrow, increment by 1, if wide increment by 2)
@@ -892,8 +898,8 @@ GetStringWidth (
**/
VOID
UpdateSkipInfoForMenu (
- IN UI_MENU_OPTION *MenuOption,
- IN CHAR16 *OptionString
+ IN UI_MENU_OPTION *MenuOption,
+ IN CHAR16 *OptionString
)
{
UINTN Index;
@@ -902,9 +908,9 @@ UpdateSkipInfoForMenu (
CHAR16 *OutputString;
UINT16 GlyphWidth;
- Width = (UINT16) gOptionBlockWidth - 1;
- GlyphWidth = 1;
- Row = 1;
+ Width = (UINT16)gOptionBlockWidth - 1;
+ GlyphWidth = 1;
+ Row = 1;
for (Index = 0; GetLineByWidth (OptionString, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
if (StrLen (&OptionString[Index]) != 0) {
@@ -916,7 +922,8 @@ UpdateSkipInfoForMenu (
if ((Row > MenuOption->Skip) &&
(MenuOption->ThisTag->OpCode->OpCode != EFI_IFR_DATE_OP) &&
- (MenuOption->ThisTag->OpCode->OpCode != EFI_IFR_TIME_OP)) {
+ (MenuOption->ThisTag->OpCode->OpCode != EFI_IFR_TIME_OP))
+ {
MenuOption->Skip = Row;
}
}
@@ -929,12 +936,12 @@ UpdateSkipInfoForMenu (
**/
VOID
UpdateOptionSkipLines (
- IN UI_MENU_OPTION *MenuOption
+ IN UI_MENU_OPTION *MenuOption
)
{
CHAR16 *OptionString;
- OptionString = NULL;
+ OptionString = NULL;
ProcessOptions (MenuOption, FALSE, &OptionString, TRUE);
if (OptionString != NULL) {
@@ -943,8 +950,8 @@ UpdateOptionSkipLines (
FreePool (OptionString);
}
- if ((MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TEXT_OP) && (((EFI_IFR_TEXT*)MenuOption->ThisTag->OpCode)->TextTwo != 0)) {
- OptionString = GetToken (((EFI_IFR_TEXT*)MenuOption->ThisTag->OpCode)->TextTwo, gFormData->HiiHandle);
+ if ((MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TEXT_OP) && (((EFI_IFR_TEXT *)MenuOption->ThisTag->OpCode)->TextTwo != 0)) {
+ OptionString = GetToken (((EFI_IFR_TEXT *)MenuOption->ThisTag->OpCode)->TextTwo, gFormData->HiiHandle);
if (OptionString != NULL) {
UpdateSkipInfoForMenu (MenuOption, OptionString);
@@ -969,11 +976,11 @@ UpdateOptionSkipLines (
**/
BOOLEAN
PrintableMenu (
- UI_MENU_OPTION *MenuOption
+ UI_MENU_OPTION *MenuOption
)
{
- EFI_STATUS Status;
- EFI_STRING OptionString;
+ EFI_STATUS Status;
+ EFI_STRING OptionString;
OptionString = NULL;
@@ -985,15 +992,16 @@ PrintableMenu (
if (EFI_ERROR (Status)) {
return FALSE;
}
- if (OptionString != NULL && OptionString[0] != '\0') {
+
+ if ((OptionString != NULL) && (OptionString[0] != '\0')) {
FreePool (OptionString);
return TRUE;
}
- if ((MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TEXT_OP) && (((EFI_IFR_TEXT*)MenuOption->ThisTag->OpCode)->TextTwo != 0)) {
- OptionString = GetToken (((EFI_IFR_TEXT*)MenuOption->ThisTag->OpCode)->TextTwo, gFormData->HiiHandle);
+ if ((MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TEXT_OP) && (((EFI_IFR_TEXT *)MenuOption->ThisTag->OpCode)->TextTwo != 0)) {
+ OptionString = GetToken (((EFI_IFR_TEXT *)MenuOption->ThisTag->OpCode)->TextTwo, gFormData->HiiHandle);
ASSERT (OptionString != NULL);
- if (OptionString[0] != '\0'){
+ if (OptionString[0] != '\0') {
FreePool (OptionString);
return TRUE;
}
@@ -1015,11 +1023,12 @@ PrintableMenu (
**/
BOOLEAN
IsSelectable (
- UI_MENU_OPTION *MenuOption
+ UI_MENU_OPTION *MenuOption
)
{
if ((MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_SUBTITLE_OP) ||
- MenuOption->GrayOut || MenuOption->ReadOnly || !PrintableMenu (MenuOption)) {
+ MenuOption->GrayOut || MenuOption->ReadOnly || !PrintableMenu (MenuOption))
+ {
return FALSE;
} else {
return TRUE;
@@ -1048,19 +1057,19 @@ IsSelectable (
**/
INTN
MoveToNextStatement (
- IN BOOLEAN GoUp,
- IN OUT LIST_ENTRY **CurrentPosition,
- IN UINTN GapToTop,
- IN BOOLEAN FindInForm
+ IN BOOLEAN GoUp,
+ IN OUT LIST_ENTRY **CurrentPosition,
+ IN UINTN GapToTop,
+ IN BOOLEAN FindInForm
)
{
- INTN Distance;
- LIST_ENTRY *Pos;
- UI_MENU_OPTION *NextMenuOption;
- UI_MENU_OPTION *PreMenuOption;
+ INTN Distance;
+ LIST_ENTRY *Pos;
+ UI_MENU_OPTION *NextMenuOption;
+ UI_MENU_OPTION *PreMenuOption;
- Distance = 0;
- Pos = *CurrentPosition;
+ Distance = 0;
+ Pos = *CurrentPosition;
if (Pos == &gMenuOption) {
return -1;
@@ -1082,10 +1091,11 @@ MoveToNextStatement (
// Check whether the menu is beyond current showing form,
// return the first one beyond the showing form.
//
- if ((UINTN) Distance + NextMenuOption->Skip > GapToTop) {
+ if ((UINTN)Distance + NextMenuOption->Skip > GapToTop) {
if (FindInForm) {
NextMenuOption = PreMenuOption;
}
+
break;
}
@@ -1106,7 +1116,7 @@ MoveToNextStatement (
break;
}
- Pos = (GoUp ? Pos->BackLink : Pos->ForwardLink);
+ Pos = (GoUp ? Pos->BackLink : Pos->ForwardLink);
PreMenuOption = NextMenuOption;
}
@@ -1114,7 +1124,6 @@ MoveToNextStatement (
return Distance;
}
-
/**
Process option string for date/time opcode.
@@ -1125,16 +1134,16 @@ MoveToNextStatement (
**/
VOID
ProcessStringForDateTime (
- UI_MENU_OPTION *MenuOption,
- CHAR16 *OptionString,
- BOOLEAN AddOptCol
+ UI_MENU_OPTION *MenuOption,
+ CHAR16 *OptionString,
+ BOOLEAN AddOptCol
)
{
- UINTN Index;
- UINTN Count;
- FORM_DISPLAY_ENGINE_STATEMENT *Statement;
- EFI_IFR_DATE *Date;
- EFI_IFR_TIME *Time;
+ UINTN Index;
+ UINTN Count;
+ FORM_DISPLAY_ENGINE_STATEMENT *Statement;
+ EFI_IFR_DATE *Date;
+ EFI_IFR_TIME *Time;
ASSERT (MenuOption != NULL && OptionString != NULL);
@@ -1142,9 +1151,9 @@ ProcessStringForDateTime (
Date = NULL;
Time = NULL;
if (Statement->OpCode->OpCode == EFI_IFR_DATE_OP) {
- Date = (EFI_IFR_DATE *) Statement->OpCode;
+ Date = (EFI_IFR_DATE *)Statement->OpCode;
} else if (Statement->OpCode->OpCode == EFI_IFR_TIME_OP) {
- Time = (EFI_IFR_TIME *) Statement->OpCode;
+ Time = (EFI_IFR_TIME *)Statement->OpCode;
}
//
@@ -1163,6 +1172,7 @@ ProcessStringForDateTime (
OptionString[Count] = OptionString[Index];
Count++;
}
+
OptionString[Count] = CHAR_NULL;
//
@@ -1221,7 +1231,6 @@ ProcessStringForDateTime (
}
}
-
/**
Adjust Data and Time position accordingly.
Data format : [01/02/2004] [11:22:33]
@@ -1241,8 +1250,8 @@ ProcessStringForDateTime (
**/
UINTN
AdjustDateAndTimePosition (
- IN BOOLEAN DirectionUp,
- IN OUT LIST_ENTRY **CurrentPosition
+ IN BOOLEAN DirectionUp,
+ IN OUT LIST_ENTRY **CurrentPosition
)
{
UINTN Count;
@@ -1255,7 +1264,8 @@ AdjustDateAndTimePosition (
MenuOption = MENU_OPTION_FROM_LINK (NewPosition);
if ((MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_DATE_OP) ||
- (MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TIME_OP)) {
+ (MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TIME_OP))
+ {
//
// Calculate the distance from current position to the last Date/Time MenuOption
//
@@ -1305,34 +1315,34 @@ AdjustDateAndTimePosition (
**/
UINT64
GetFieldFromNum (
- IN EFI_IFR_OP_HEADER *OpCode
+ IN EFI_IFR_OP_HEADER *OpCode
)
{
- EFI_IFR_NUMERIC *NumericOp;
- UINT64 Step;
+ EFI_IFR_NUMERIC *NumericOp;
+ UINT64 Step;
- NumericOp = (EFI_IFR_NUMERIC *) OpCode;
+ NumericOp = (EFI_IFR_NUMERIC *)OpCode;
switch (NumericOp->Flags & EFI_IFR_NUMERIC_SIZE) {
- case EFI_IFR_NUMERIC_SIZE_1:
- Step = NumericOp->data.u8.Step;
- break;
+ case EFI_IFR_NUMERIC_SIZE_1:
+ Step = NumericOp->data.u8.Step;
+ break;
- case EFI_IFR_NUMERIC_SIZE_2:
- Step = NumericOp->data.u16.Step;
- break;
+ case EFI_IFR_NUMERIC_SIZE_2:
+ Step = NumericOp->data.u16.Step;
+ break;
- case EFI_IFR_NUMERIC_SIZE_4:
- Step = NumericOp->data.u32.Step;
- break;
+ case EFI_IFR_NUMERIC_SIZE_4:
+ Step = NumericOp->data.u32.Step;
+ break;
- case EFI_IFR_NUMERIC_SIZE_8:
- Step = NumericOp->data.u64.Step;
- break;
+ case EFI_IFR_NUMERIC_SIZE_8:
+ Step = NumericOp->data.u64.Step;
+ break;
- default:
- Step = 0;
- break;
+ default:
+ Step = 0;
+ break;
}
return Step;
@@ -1348,7 +1358,7 @@ GetFieldFromNum (
**/
BROWSER_HOT_KEY *
GetHotKeyFromRegisterList (
- IN EFI_INPUT_KEY *KeyData
+ IN EFI_INPUT_KEY *KeyData
)
{
LIST_ENTRY *Link;
@@ -1368,7 +1378,6 @@ GetHotKeyFromRegisterList (
return NULL;
}
-
/**
Determine if the menu is the last menu that can be selected.
@@ -1383,11 +1392,11 @@ GetHotKeyFromRegisterList (
**/
BOOLEAN
ValueIsScroll (
- IN BOOLEAN Direction,
- IN LIST_ENTRY *CurrentPos
+ IN BOOLEAN Direction,
+ IN LIST_ENTRY *CurrentPos
)
{
- LIST_ENTRY *Temp;
+ LIST_ENTRY *Temp;
Temp = Direction ? CurrentPos->BackLink : CurrentPos->ForwardLink;
@@ -1408,19 +1417,19 @@ ValueIsScroll (
**/
UI_EVENT_TYPE
UiWaitForEvent (
- IN EFI_EVENT Event
+ IN EFI_EVENT Event
)
{
- EFI_STATUS Status;
- UINTN Index;
- UINTN EventNum;
- UINT64 Timeout;
- EFI_EVENT TimerEvent;
- EFI_EVENT WaitList[3];
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN EventNum;
+ UINT64 Timeout;
+ EFI_EVENT TimerEvent;
+ EFI_EVENT WaitList[3];
UI_EVENT_TYPE EventType;
TimerEvent = NULL;
- Timeout = FormExitTimeout(gFormData);
+ Timeout = FormExitTimeout (gFormData);
if (Timeout != 0) {
Status = gBS->CreateEvent (EVT_TIMER, 0, NULL, NULL, &TimerEvent);
@@ -1429,45 +1438,46 @@ UiWaitForEvent (
// Set the timer event
//
gBS->SetTimer (
- TimerEvent,
- TimerRelative,
- Timeout
- );
+ TimerEvent,
+ TimerRelative,
+ Timeout
+ );
}
WaitList[0] = Event;
EventNum = 1;
if (gFormData->FormRefreshEvent != NULL) {
WaitList[EventNum] = gFormData->FormRefreshEvent;
- EventNum ++;
+ EventNum++;
}
if (Timeout != 0) {
WaitList[EventNum] = TimerEvent;
- EventNum ++;
+ EventNum++;
}
Status = gBS->WaitForEvent (EventNum, WaitList, &Index);
ASSERT_EFI_ERROR (Status);
switch (Index) {
- case 0:
- EventType = UIEventKey;
- break;
+ case 0:
+ EventType = UIEventKey;
+ break;
- case 1:
- if (gFormData->FormRefreshEvent != NULL) {
- EventType = UIEventDriver;
- } else {
- ASSERT (Timeout != 0 && EventNum == 2);
- EventType = UIEventTimeOut;
- }
- break;
+ case 1:
+ if (gFormData->FormRefreshEvent != NULL) {
+ EventType = UIEventDriver;
+ } else {
+ ASSERT (Timeout != 0 && EventNum == 2);
+ EventType = UIEventTimeOut;
+ }
+
+ break;
- default:
- ASSERT (Index == 2 && EventNum == 3);
- EventType = UIEventTimeOut;
- break;
+ default:
+ ASSERT (Index == 2 && EventNum == 3);
+ EventType = UIEventTimeOut;
+ break;
}
if (Timeout != 0) {
@@ -1487,21 +1497,20 @@ UiWaitForEvent (
**/
EFI_QUESTION_ID
GetQuestionIdInfo (
- IN EFI_IFR_OP_HEADER *OpCode
+ IN EFI_IFR_OP_HEADER *OpCode
)
{
- EFI_IFR_QUESTION_HEADER *QuestionHeader;
+ EFI_IFR_QUESTION_HEADER *QuestionHeader;
if (OpCode->Length < sizeof (EFI_IFR_OP_HEADER) + sizeof (EFI_IFR_QUESTION_HEADER)) {
return 0;
}
- QuestionHeader = (EFI_IFR_QUESTION_HEADER *)((UINT8 *) OpCode + sizeof(EFI_IFR_OP_HEADER));
+ QuestionHeader = (EFI_IFR_QUESTION_HEADER *)((UINT8 *)OpCode + sizeof (EFI_IFR_OP_HEADER));
return QuestionHeader->QuestionId;
}
-
/**
Find the top of screen menu base on the current menu.
@@ -1514,40 +1523,42 @@ GetQuestionIdInfo (
**/
LIST_ENTRY *
FindTopOfScreenMenu (
- IN LIST_ENTRY *CurPos,
- IN UINTN Rows,
- OUT UINTN *SkipValue
+ IN LIST_ENTRY *CurPos,
+ IN UINTN Rows,
+ OUT UINTN *SkipValue
)
{
- LIST_ENTRY *Link;
- LIST_ENTRY *TopOfScreen;
- UI_MENU_OPTION *PreviousMenuOption;
+ LIST_ENTRY *Link;
+ LIST_ENTRY *TopOfScreen;
+ UI_MENU_OPTION *PreviousMenuOption;
- Link = CurPos;
+ Link = CurPos;
PreviousMenuOption = NULL;
while (Link->BackLink != &gMenuOption) {
- Link = Link->BackLink;
+ Link = Link->BackLink;
PreviousMenuOption = MENU_OPTION_FROM_LINK (Link);
if (PreviousMenuOption->Row == 0) {
UpdateOptionSkipLines (PreviousMenuOption);
}
+
if (Rows <= PreviousMenuOption->Skip) {
break;
}
+
Rows = Rows - PreviousMenuOption->Skip;
}
if (Link->BackLink == &gMenuOption) {
TopOfScreen = gMenuOption.ForwardLink;
- if (PreviousMenuOption != NULL && Rows < PreviousMenuOption->Skip) {
+ if ((PreviousMenuOption != NULL) && (Rows < PreviousMenuOption->Skip)) {
*SkipValue = PreviousMenuOption->Skip - Rows;
} else {
*SkipValue = 0;
}
} else {
TopOfScreen = Link;
- *SkipValue = PreviousMenuOption->Skip - Rows;
+ *SkipValue = PreviousMenuOption->Skip - Rows;
}
return TopOfScreen;
@@ -1566,14 +1577,14 @@ GetIndexInfoForOpcode (
IN EFI_IFR_OP_HEADER *OpCode
)
{
- LIST_ENTRY *NewPos;
- UI_MENU_OPTION *MenuOption;
- UINTN Index;
+ LIST_ENTRY *NewPos;
+ UI_MENU_OPTION *MenuOption;
+ UINTN Index;
NewPos = gMenuOption.ForwardLink;
Index = 0;
- for (NewPos = gMenuOption.ForwardLink; NewPos != &gMenuOption; NewPos = NewPos->ForwardLink){
+ for (NewPos = gMenuOption.ForwardLink; NewPos != &gMenuOption; NewPos = NewPos->ForwardLink) {
MenuOption = MENU_OPTION_FROM_LINK (NewPos);
if (CompareMem (MenuOption->ThisTag->OpCode, OpCode, OpCode->Length) == 0) {
@@ -1581,7 +1592,7 @@ GetIndexInfoForOpcode (
return Index;
}
- Index ++;
+ Index++;
}
}
@@ -1603,12 +1614,13 @@ IsSavedHighlightStatement (
)
{
if ((gFormData->HiiHandle == gHighligthMenuInfo.HiiHandle) &&
- (gFormData->FormId == gHighligthMenuInfo.FormId)) {
+ (gFormData->FormId == gHighligthMenuInfo.FormId))
+ {
if (gHighligthMenuInfo.HLTQuestionId != 0) {
- return (BOOLEAN) (gHighligthMenuInfo.HLTQuestionId == GetQuestionIdInfo (HighLightedStatement->OpCode));
+ return (BOOLEAN)(gHighligthMenuInfo.HLTQuestionId == GetQuestionIdInfo (HighLightedStatement->OpCode));
} else {
if (CompareMem (gHighligthMenuInfo.HLTOpCode, HighLightedStatement->OpCode, gHighligthMenuInfo.HLTOpCode->Length) == 0) {
- if (gHighligthMenuInfo.HLTIndex == 0 || gHighligthMenuInfo.HLTIndex == GetIndexInfoForOpcode(HighLightedStatement->OpCode)) {
+ if ((gHighligthMenuInfo.HLTIndex == 0) || (gHighligthMenuInfo.HLTIndex == GetIndexInfoForOpcode (HighLightedStatement->OpCode))) {
return TRUE;
} else {
return FALSE;
@@ -1631,17 +1643,17 @@ IsSavedHighlightStatement (
**/
BOOLEAN
IsHighLightMenuOption (
- IN UI_MENU_OPTION *MenuOption
+ IN UI_MENU_OPTION *MenuOption
)
{
if (gHighligthMenuInfo.HLTQuestionId != 0) {
- if (GetQuestionIdInfo(MenuOption->ThisTag->OpCode) == gHighligthMenuInfo.HLTQuestionId) {
- return (BOOLEAN) (MenuOption->Sequence == gHighligthMenuInfo.HLTSequence);
+ if (GetQuestionIdInfo (MenuOption->ThisTag->OpCode) == gHighligthMenuInfo.HLTQuestionId) {
+ return (BOOLEAN)(MenuOption->Sequence == gHighligthMenuInfo.HLTSequence);
}
} else {
- if(CompareMem (gHighligthMenuInfo.HLTOpCode, MenuOption->ThisTag->OpCode, gHighligthMenuInfo.HLTOpCode->Length) == 0) {
- if (gHighligthMenuInfo.HLTIndex == 0 || gHighligthMenuInfo.HLTIndex == GetIndexInfoForOpcode(MenuOption->ThisTag->OpCode)) {
- return (BOOLEAN) (MenuOption->Sequence == gHighligthMenuInfo.HLTSequence);
+ if (CompareMem (gHighligthMenuInfo.HLTOpCode, MenuOption->ThisTag->OpCode, gHighligthMenuInfo.HLTOpCode->Length) == 0) {
+ if ((gHighligthMenuInfo.HLTIndex == 0) || (gHighligthMenuInfo.HLTIndex == GetIndexInfoForOpcode (MenuOption->ThisTag->OpCode))) {
+ return (BOOLEAN)(MenuOption->Sequence == gHighligthMenuInfo.HLTSequence);
} else {
return FALSE;
}
@@ -1664,24 +1676,25 @@ IsHighLightMenuOption (
**/
LIST_ENTRY *
FindHighLightMenuOption (
- IN FORM_DISPLAY_ENGINE_STATEMENT *HighLightedStatement
- )
+ IN FORM_DISPLAY_ENGINE_STATEMENT *HighLightedStatement
+ )
{
- LIST_ENTRY *NewPos;
- UI_MENU_OPTION *MenuOption;
+ LIST_ENTRY *NewPos;
+ UI_MENU_OPTION *MenuOption;
- NewPos = gMenuOption.ForwardLink;
+ NewPos = gMenuOption.ForwardLink;
MenuOption = MENU_OPTION_FROM_LINK (NewPos);
if (HighLightedStatement != NULL) {
while (MenuOption->ThisTag != HighLightedStatement) {
- NewPos = NewPos->ForwardLink;
+ NewPos = NewPos->ForwardLink;
if (NewPos == &gMenuOption) {
//
// Not Found it, break
//
break;
}
+
MenuOption = MENU_OPTION_FROM_LINK (NewPos);
}
@@ -1689,16 +1702,16 @@ FindHighLightMenuOption (
// Must find the highlight statement.
//
ASSERT (NewPos != &gMenuOption);
-
} else {
while (!IsHighLightMenuOption (MenuOption)) {
- NewPos = NewPos->ForwardLink;
+ NewPos = NewPos->ForwardLink;
if (NewPos == &gMenuOption) {
//
// Not Found it, break
//
break;
}
+
MenuOption = MENU_OPTION_FROM_LINK (NewPos);
}
@@ -1724,15 +1737,15 @@ FindHighLightMenuOption (
**/
BOOLEAN
IsTopOfScreeMenuOption (
- IN UI_MENU_OPTION *MenuOption
+ IN UI_MENU_OPTION *MenuOption
)
{
if (gHighligthMenuInfo.TOSQuestionId != 0) {
- return (BOOLEAN) (GetQuestionIdInfo(MenuOption->ThisTag->OpCode) == gHighligthMenuInfo.TOSQuestionId);
+ return (BOOLEAN)(GetQuestionIdInfo (MenuOption->ThisTag->OpCode) == gHighligthMenuInfo.TOSQuestionId);
}
- if(CompareMem (gHighligthMenuInfo.TOSOpCode, MenuOption->ThisTag->OpCode, gHighligthMenuInfo.TOSOpCode->Length) == 0) {
- if (gHighligthMenuInfo.TOSIndex == 0 || gHighligthMenuInfo.TOSIndex == GetIndexInfoForOpcode(MenuOption->ThisTag->OpCode)) {
+ if (CompareMem (gHighligthMenuInfo.TOSOpCode, MenuOption->ThisTag->OpCode, gHighligthMenuInfo.TOSOpCode->Length) == 0) {
+ if ((gHighligthMenuInfo.TOSIndex == 0) || (gHighligthMenuInfo.TOSIndex == GetIndexInfoForOpcode (MenuOption->ThisTag->OpCode))) {
return TRUE;
} else {
return FALSE;
@@ -1750,14 +1763,14 @@ IsTopOfScreeMenuOption (
**/
UINTN
-GetDistanceBetweenMenus(
+GetDistanceBetweenMenus (
IN LIST_ENTRY *StartMenu,
IN LIST_ENTRY *EndMenu
-)
+ )
{
- LIST_ENTRY *Link;
- UI_MENU_OPTION *MenuOption;
- UINTN Distance;
+ LIST_ENTRY *Link;
+ UI_MENU_OPTION *MenuOption;
+ UINTN Distance;
Distance = 0;
@@ -1767,9 +1780,11 @@ GetDistanceBetweenMenus(
if (MenuOption->Row == 0) {
UpdateOptionSkipLines (MenuOption);
}
+
Distance += MenuOption->Skip;
- Link = Link->BackLink;
+ Link = Link->BackLink;
}
+
return Distance;
}
@@ -1783,28 +1798,29 @@ GetDistanceBetweenMenus(
**/
LIST_ENTRY *
FindTopOfScreenMenuOption (
- IN LIST_ENTRY *HighLightMenu
+ IN LIST_ENTRY *HighLightMenu
)
{
- LIST_ENTRY *NewPos;
- UI_MENU_OPTION *MenuOption;
- UINTN TopRow;
- UINTN BottomRow;
+ LIST_ENTRY *NewPos;
+ UI_MENU_OPTION *MenuOption;
+ UINTN TopRow;
+ UINTN BottomRow;
TopRow = gStatementDimensions.TopRow + SCROLL_ARROW_HEIGHT;
BottomRow = gStatementDimensions.BottomRow - SCROLL_ARROW_HEIGHT;
- NewPos = gMenuOption.ForwardLink;
+ NewPos = gMenuOption.ForwardLink;
MenuOption = MENU_OPTION_FROM_LINK (NewPos);
- while (!IsTopOfScreeMenuOption(MenuOption)) {
- NewPos = NewPos->ForwardLink;
+ while (!IsTopOfScreeMenuOption (MenuOption)) {
+ NewPos = NewPos->ForwardLink;
if (NewPos == &gMenuOption) {
//
// Not Found it, break
//
break;
}
+
MenuOption = MENU_OPTION_FROM_LINK (NewPos);
}
@@ -1814,6 +1830,7 @@ FindTopOfScreenMenuOption (
if (NewPos == &gMenuOption) {
return NULL;
}
+
//
// Check whether highlight menu and top of screen menu can be shown within one page,
// if can't, return NULL to re-calcaulate the top of scrren menu. Because some new menus
@@ -1844,10 +1861,10 @@ FindTopMenu (
OUT UINTN *SkipValue
)
{
- UINTN TopRow;
- UINTN BottomRow;
- UI_MENU_OPTION *MenuOption;
- UINTN TmpValue;
+ UINTN TopRow;
+ UINTN BottomRow;
+ UI_MENU_OPTION *MenuOption;
+ UINTN TmpValue;
TopRow = gStatementDimensions.TopRow + SCROLL_ARROW_HEIGHT;
BottomRow = gStatementDimensions.BottomRow - SCROLL_ARROW_HEIGHT;
@@ -1855,13 +1872,13 @@ FindTopMenu (
// When option mismatch happens,there exist two cases,one is reenter the form, just like the if case below,
// and the other is exit current form and enter last form, it can be covered by the else case.
//
- if (gMisMatch && gFormData->HiiHandle == gHighligthMenuInfo.HiiHandle && gFormData->FormId == gHighligthMenuInfo.FormId) {
+ if (gMisMatch && (gFormData->HiiHandle == gHighligthMenuInfo.HiiHandle) && (gFormData->FormId == gHighligthMenuInfo.FormId)) {
//
// Reenter caused by option mismatch or auto exit caused by refresh form(refresh interval/guid),
// base on the record highlight info to find the highlight menu.
//
- *HighlightMenu = FindHighLightMenuOption(NULL);
+ *HighlightMenu = FindHighLightMenuOption (NULL);
if (*HighlightMenu != NULL) {
//
// Update skip info for this highlight menu.
@@ -1872,12 +1889,12 @@ FindTopMenu (
//
// Found the last time highlight menu.
//
- *TopOfScreen = FindTopOfScreenMenuOption(*HighlightMenu);
+ *TopOfScreen = FindTopOfScreenMenuOption (*HighlightMenu);
if (*TopOfScreen != NULL) {
//
// Found the last time selectable top of screen menu.
//
- AdjustDateAndTimePosition(TRUE, TopOfScreen);
+ AdjustDateAndTimePosition (TRUE, TopOfScreen);
MenuOption = MENU_OPTION_FROM_LINK (*TopOfScreen);
UpdateOptionSkipLines (MenuOption);
@@ -1893,10 +1910,10 @@ FindTopMenu (
*TopOfScreen = *HighlightMenu;
TmpValue = 0;
} else {
- *TopOfScreen = FindTopOfScreenMenu(*HighlightMenu, BottomRow - TopRow - MenuOption->Skip, &TmpValue);
+ *TopOfScreen = FindTopOfScreenMenu (*HighlightMenu, BottomRow - TopRow - MenuOption->Skip, &TmpValue);
}
- *SkipValue = TmpValue;
+ *SkipValue = TmpValue;
}
} else {
//
@@ -1906,17 +1923,17 @@ FindTopMenu (
if (!IsListEmpty (&gMenuOption)) {
MoveToNextStatement (FALSE, HighlightMenu, BottomRow - TopRow, TRUE);
}
- *TopOfScreen = gMenuOption.ForwardLink;
- *SkipValue = 0;
- }
+ *TopOfScreen = gMenuOption.ForwardLink;
+ *SkipValue = 0;
+ }
} else if (FormData->HighLightedStatement != NULL) {
if (IsSavedHighlightStatement (FormData->HighLightedStatement)) {
//
// Input highlight menu is same as last time highlight menu.
// Base on last time highlight menu to set the top of screen menu and highlight menu.
//
- *HighlightMenu = FindHighLightMenuOption(NULL);
+ *HighlightMenu = FindHighLightMenuOption (NULL);
ASSERT (*HighlightMenu != NULL);
//
@@ -1925,7 +1942,7 @@ FindTopMenu (
MenuOption = MENU_OPTION_FROM_LINK (*HighlightMenu);
UpdateOptionSkipLines (MenuOption);
- *TopOfScreen = FindTopOfScreenMenuOption(*HighlightMenu);
+ *TopOfScreen = FindTopOfScreenMenuOption (*HighlightMenu);
if (*TopOfScreen == NULL) {
//
// Not found last time top of screen menu, so base on current highlight menu
@@ -1937,24 +1954,25 @@ FindTopMenu (
*TopOfScreen = *HighlightMenu;
TmpValue = 0;
} else {
- *TopOfScreen = FindTopOfScreenMenu(*HighlightMenu, BottomRow - TopRow - MenuOption->Skip, &TmpValue);
+ *TopOfScreen = FindTopOfScreenMenu (*HighlightMenu, BottomRow - TopRow - MenuOption->Skip, &TmpValue);
}
- *SkipValue = TmpValue;
+ *SkipValue = TmpValue;
} else {
- AdjustDateAndTimePosition(TRUE, TopOfScreen);
+ AdjustDateAndTimePosition (TRUE, TopOfScreen);
MenuOption = MENU_OPTION_FROM_LINK (*TopOfScreen);
UpdateOptionSkipLines (MenuOption);
*SkipValue = gHighligthMenuInfo.SkipValue;
}
- AdjustDateAndTimePosition(TRUE, TopOfScreen);
+
+ AdjustDateAndTimePosition (TRUE, TopOfScreen);
} else {
//
// Input highlight menu is not save as last time highlight menu.
//
- *HighlightMenu = FindHighLightMenuOption(FormData->HighLightedStatement);
- MenuOption = MENU_OPTION_FROM_LINK (*HighlightMenu);
+ *HighlightMenu = FindHighLightMenuOption (FormData->HighLightedStatement);
+ MenuOption = MENU_OPTION_FROM_LINK (*HighlightMenu);
UpdateOptionSkipLines (MenuOption);
//
@@ -1965,12 +1983,13 @@ FindTopMenu (
*TopOfScreen = *HighlightMenu;
TmpValue = 0;
} else {
- *TopOfScreen = FindTopOfScreenMenu(*HighlightMenu, BottomRow - TopRow - MenuOption->Skip, &TmpValue);
+ *TopOfScreen = FindTopOfScreenMenu (*HighlightMenu, BottomRow - TopRow - MenuOption->Skip, &TmpValue);
}
- *SkipValue = TmpValue;
+ *SkipValue = TmpValue;
}
- AdjustDateAndTimePosition(TRUE, TopOfScreen);
+
+ AdjustDateAndTimePosition (TRUE, TopOfScreen);
} else {
//
// If not has input highlight statement, just return the first one in this form.
@@ -1980,7 +1999,8 @@ FindTopMenu (
if (!IsListEmpty (&gMenuOption)) {
MoveToNextStatement (FALSE, HighlightMenu, BottomRow - TopRow, TRUE);
}
- *SkipValue = 0;
+
+ *SkipValue = 0;
}
gMisMatch = FALSE;
@@ -2001,17 +2021,17 @@ FindTopMenu (
**/
VOID
UpdateHighlightMenuInfo (
- IN LIST_ENTRY *Highlight,
- IN LIST_ENTRY *TopOfScreen,
- IN UINTN SkipValue
+ IN LIST_ENTRY *Highlight,
+ IN LIST_ENTRY *TopOfScreen,
+ IN UINTN SkipValue
)
{
- UI_MENU_OPTION *MenuOption;
- FORM_DISPLAY_ENGINE_STATEMENT *Statement;
+ UI_MENU_OPTION *MenuOption;
+ FORM_DISPLAY_ENGINE_STATEMENT *Statement;
- gHighligthMenuInfo.HiiHandle = gFormData->HiiHandle;
- gHighligthMenuInfo.FormId = gFormData->FormId;
- gHighligthMenuInfo.SkipValue = (UINT16)SkipValue;
+ gHighligthMenuInfo.HiiHandle = gFormData->HiiHandle;
+ gHighligthMenuInfo.FormId = gFormData->FormId;
+ gHighligthMenuInfo.SkipValue = (UINT16)SkipValue;
if (!IsListEmpty (&gMenuOption)) {
MenuOption = MENU_OPTION_FROM_LINK (Highlight);
@@ -2020,7 +2040,7 @@ UpdateHighlightMenuInfo (
gUserInput->SelectedStatement = Statement;
gHighligthMenuInfo.HLTSequence = MenuOption->Sequence;
- gHighligthMenuInfo.HLTQuestionId = GetQuestionIdInfo(Statement->OpCode);
+ gHighligthMenuInfo.HLTQuestionId = GetQuestionIdInfo (Statement->OpCode);
if (gHighligthMenuInfo.HLTQuestionId == 0) {
//
// if question id == 0, save the opcode buffer..
@@ -2028,16 +2048,17 @@ UpdateHighlightMenuInfo (
if (gHighligthMenuInfo.HLTOpCode != NULL) {
FreePool (gHighligthMenuInfo.HLTOpCode);
}
+
gHighligthMenuInfo.HLTOpCode = AllocateCopyPool (Statement->OpCode->Length, Statement->OpCode);
ASSERT (gHighligthMenuInfo.HLTOpCode != NULL);
- gHighligthMenuInfo.HLTIndex = GetIndexInfoForOpcode(Statement->OpCode);
+ gHighligthMenuInfo.HLTIndex = GetIndexInfoForOpcode (Statement->OpCode);
}
MenuOption = MENU_OPTION_FROM_LINK (TopOfScreen);
Statement = MenuOption->ThisTag;
- gHighligthMenuInfo.TOSQuestionId = GetQuestionIdInfo(Statement->OpCode);
+ gHighligthMenuInfo.TOSQuestionId = GetQuestionIdInfo (Statement->OpCode);
if (gHighligthMenuInfo.TOSQuestionId == 0) {
//
// if question id == 0, save the opcode buffer..
@@ -2045,28 +2066,31 @@ UpdateHighlightMenuInfo (
if (gHighligthMenuInfo.TOSOpCode != NULL) {
FreePool (gHighligthMenuInfo.TOSOpCode);
}
+
gHighligthMenuInfo.TOSOpCode = AllocateCopyPool (Statement->OpCode->Length, Statement->OpCode);
ASSERT (gHighligthMenuInfo.TOSOpCode != NULL);
- gHighligthMenuInfo.TOSIndex = GetIndexInfoForOpcode(Statement->OpCode);
+ gHighligthMenuInfo.TOSIndex = GetIndexInfoForOpcode (Statement->OpCode);
}
} else {
- gUserInput->SelectedStatement = NULL;
+ gUserInput->SelectedStatement = NULL;
gHighligthMenuInfo.HLTSequence = 0;
gHighligthMenuInfo.HLTQuestionId = 0;
if (gHighligthMenuInfo.HLTOpCode != NULL) {
FreePool (gHighligthMenuInfo.HLTOpCode);
}
- gHighligthMenuInfo.HLTOpCode = NULL;
- gHighligthMenuInfo.HLTIndex = 0;
+
+ gHighligthMenuInfo.HLTOpCode = NULL;
+ gHighligthMenuInfo.HLTIndex = 0;
gHighligthMenuInfo.TOSQuestionId = 0;
if (gHighligthMenuInfo.TOSOpCode != NULL) {
FreePool (gHighligthMenuInfo.TOSOpCode);
}
- gHighligthMenuInfo.TOSOpCode = NULL;
- gHighligthMenuInfo.TOSIndex = 0;
+
+ gHighligthMenuInfo.TOSOpCode = NULL;
+ gHighligthMenuInfo.TOSIndex = 0;
}
}
@@ -2079,11 +2103,11 @@ UpdateHighlightMenuInfo (
**/
VOID
SetDisplayAttribute (
- IN UI_MENU_OPTION *MenuOption,
- IN BOOLEAN Highlight
+ IN UI_MENU_OPTION *MenuOption,
+ IN BOOLEAN Highlight
)
{
- FORM_DISPLAY_ENGINE_STATEMENT *Statement;
+ FORM_DISPLAY_ENGINE_STATEMENT *Statement;
Statement = MenuOption->ThisTag;
@@ -2117,15 +2141,15 @@ SetDisplayAttribute (
**/
VOID
DisplayMenuString (
- IN UI_MENU_OPTION *MenuOption,
- IN UINTN Col,
- IN UINTN Row,
- IN CHAR16 *String,
- IN UINTN Width,
- IN BOOLEAN Highlight
+ IN UI_MENU_OPTION *MenuOption,
+ IN UINTN Col,
+ IN UINTN Row,
+ IN CHAR16 *String,
+ IN UINTN Width,
+ IN BOOLEAN Highlight
)
{
- UINTN Length;
+ UINTN Length;
//
// Print string with normal color.
@@ -2139,13 +2163,13 @@ DisplayMenuString (
// Print the highlight menu string.
// First print the highlight string.
//
- SetDisplayAttribute(MenuOption, TRUE);
+ SetDisplayAttribute (MenuOption, TRUE);
Length = PrintStringAt (Col, Row, String);
//
// Second, clean the empty after the string.
//
- SetDisplayAttribute(MenuOption, FALSE);
+ SetDisplayAttribute (MenuOption, FALSE);
PrintStringAtWithWidth (Col + Length, Row, L"", Width - Length);
}
@@ -2160,22 +2184,22 @@ DisplayMenuString (
**/
BOOLEAN
HasOptionString (
- IN UI_MENU_OPTION *MenuOption
+ IN UI_MENU_OPTION *MenuOption
)
{
- FORM_DISPLAY_ENGINE_STATEMENT *Statement;
- CHAR16 *String;
- UINTN Size;
- EFI_IFR_TEXT *TextOp;
+ FORM_DISPLAY_ENGINE_STATEMENT *Statement;
+ CHAR16 *String;
+ UINTN Size;
+ EFI_IFR_TEXT *TextOp;
- Size = 0;
+ Size = 0;
Statement = MenuOption->ThisTag;
//
// See if the second text parameter is really NULL
//
if (Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) {
- TextOp = (EFI_IFR_TEXT *) Statement->OpCode;
+ TextOp = (EFI_IFR_TEXT *)Statement->OpCode;
if (TextOp->TextTwo != 0) {
String = GetToken (TextOp->TextTwo, gFormData->HiiHandle);
Size = StrLen (String);
@@ -2184,16 +2208,16 @@ HasOptionString (
}
if ((Statement->OpCode->OpCode == EFI_IFR_SUBTITLE_OP) ||
- (Statement->OpCode->OpCode == EFI_IFR_REF_OP) ||
- (Statement->OpCode->OpCode == EFI_IFR_PASSWORD_OP) ||
- (Statement->OpCode->OpCode == EFI_IFR_ACTION_OP) ||
- (Statement->OpCode->OpCode == EFI_IFR_RESET_BUTTON_OP) ||
- //
- // Allow a wide display if text op-code and no secondary text op-code
- //
- ((Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) && (Size == 0))
- ) {
-
+ (Statement->OpCode->OpCode == EFI_IFR_REF_OP) ||
+ (Statement->OpCode->OpCode == EFI_IFR_PASSWORD_OP) ||
+ (Statement->OpCode->OpCode == EFI_IFR_ACTION_OP) ||
+ (Statement->OpCode->OpCode == EFI_IFR_RESET_BUTTON_OP) ||
+ //
+ // Allow a wide display if text op-code and no secondary text op-code
+ //
+ ((Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) && (Size == 0))
+ )
+ {
return FALSE;
}
@@ -2211,16 +2235,16 @@ HasOptionString (
**/
BOOLEAN
FxConfirmPopup (
- IN UINT32 Action
+ IN UINT32 Action
)
{
- EFI_INPUT_KEY Key;
- CHAR16 *CfmStr;
- UINTN CfmStrLen;
- UINT32 CheckFlags;
- BOOLEAN RetVal;
- UINTN CatLen;
- UINTN MaxLen;
+ EFI_INPUT_KEY Key;
+ CHAR16 *CfmStr;
+ UINTN CfmStrLen;
+ UINT32 CheckFlags;
+ BOOLEAN RetVal;
+ UINTN CatLen;
+ UINTN MaxLen;
CfmStrLen = 0;
CatLen = StrLen (gConfirmMsgConnect);
@@ -2360,43 +2384,43 @@ FxConfirmPopup (
**/
EFI_STATUS
DisplayOneMenu (
- IN UI_MENU_OPTION *MenuOption,
- IN UINTN SkipWidth,
- IN UINTN BeginCol,
- IN UINTN SkipLine,
- IN UINTN BottomRow,
- IN BOOLEAN Highlight,
- IN BOOLEAN UpdateCol
+ IN UI_MENU_OPTION *MenuOption,
+ IN UINTN SkipWidth,
+ IN UINTN BeginCol,
+ IN UINTN SkipLine,
+ IN UINTN BottomRow,
+ IN BOOLEAN Highlight,
+ IN BOOLEAN UpdateCol
)
{
- FORM_DISPLAY_ENGINE_STATEMENT *Statement;
- UINTN Index;
- UINT16 Width;
- UINT16 PromptWidth;
- CHAR16 *StringPtr;
- CHAR16 *OptionString;
- CHAR16 *OutputString;
- UINT16 GlyphWidth;
- UINTN Temp;
- UINTN Temp2;
- UINTN Temp3;
- EFI_STATUS Status;
- UINTN Row;
- BOOLEAN IsProcessingFirstRow;
- UINTN Col;
- UINTN PromptLineNum;
- UINTN OptionLineNum;
- CHAR16 AdjustValue;
- UINTN MaxRow;
-
- Statement = MenuOption->ThisTag;
- Temp = SkipLine;
- Temp2 = SkipLine;
- Temp3 = SkipLine;
- AdjustValue = 0;
- PromptLineNum = 0;
- OptionLineNum = 0;
- MaxRow = 0;
+ FORM_DISPLAY_ENGINE_STATEMENT *Statement;
+ UINTN Index;
+ UINT16 Width;
+ UINT16 PromptWidth;
+ CHAR16 *StringPtr;
+ CHAR16 *OptionString;
+ CHAR16 *OutputString;
+ UINT16 GlyphWidth;
+ UINTN Temp;
+ UINTN Temp2;
+ UINTN Temp3;
+ EFI_STATUS Status;
+ UINTN Row;
+ BOOLEAN IsProcessingFirstRow;
+ UINTN Col;
+ UINTN PromptLineNum;
+ UINTN OptionLineNum;
+ CHAR16 AdjustValue;
+ UINTN MaxRow;
+
+ Statement = MenuOption->ThisTag;
+ Temp = SkipLine;
+ Temp2 = SkipLine;
+ Temp3 = SkipLine;
+ AdjustValue = 0;
+ PromptLineNum = 0;
+ OptionLineNum = 0;
+ MaxRow = 0;
IsProcessingFirstRow = TRUE;
//
@@ -2413,21 +2437,21 @@ DisplayOneMenu (
}
if (OptionString != NULL) {
- if (Statement->OpCode->OpCode == EFI_IFR_DATE_OP || Statement->OpCode->OpCode == EFI_IFR_TIME_OP) {
+ if ((Statement->OpCode->OpCode == EFI_IFR_DATE_OP) || (Statement->OpCode->OpCode == EFI_IFR_TIME_OP)) {
//
// Adjust option string for date/time opcode.
//
- ProcessStringForDateTime(MenuOption, OptionString, UpdateCol);
+ ProcessStringForDateTime (MenuOption, OptionString, UpdateCol);
}
- Width = (UINT16) gOptionBlockWidth - 1;
- Row = MenuOption->Row;
- GlyphWidth = 1;
+ Width = (UINT16)gOptionBlockWidth - 1;
+ Row = MenuOption->Row;
+ GlyphWidth = 1;
OptionLineNum = 0;
for (Index = 0; GetLineByWidth (OptionString, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
if (((Temp2 == 0)) && (Row <= BottomRow)) {
- if (Statement->OpCode->OpCode == EFI_IFR_DATE_OP || Statement->OpCode->OpCode == EFI_IFR_TIME_OP) {
+ if ((Statement->OpCode->OpCode == EFI_IFR_DATE_OP) || (Statement->OpCode->OpCode == EFI_IFR_TIME_OP)) {
//
// For date/time question, it has three menu options for this qustion.
// The first/second menu options with the skip value is 0. the last one
@@ -2438,7 +2462,7 @@ DisplayOneMenu (
// For date/ time, print the last past (year for date and second for time)
// - 7 means skip [##/##/ for date and [##:##: for time.
//
- DisplayMenuString (MenuOption,MenuOption->OptCol, Row, OutputString, Width + 1 - 7, Highlight);
+ DisplayMenuString (MenuOption, MenuOption->OptCol, Row, OutputString, Width + 1 - 7, Highlight);
} else {
//
// For date/ time, print the first and second past (year for date and second for time)
@@ -2449,6 +2473,7 @@ DisplayOneMenu (
} else {
DisplayMenuString (MenuOption, MenuOption->OptCol, Row, OutputString, Width + 1, Highlight);
}
+
OptionLineNum++;
}
@@ -2490,7 +2515,7 @@ DisplayOneMenu (
GlyphWidth = 1;
PromptLineNum = 0;
- if (MenuOption->Description == NULL || MenuOption->Description[0] == '\0') {
+ if ((MenuOption->Description == NULL) || (MenuOption->Description[0] == '\0')) {
PrintStringAtWithWidth (BeginCol, Row, L"", PromptWidth + AdjustValue + SkipWidth);
PromptLineNum++;
} else {
@@ -2501,7 +2526,7 @@ DisplayOneMenu (
//
PrintStringAtWithWidth (BeginCol, Row, L"", SkipWidth);
- if (Statement->OpCode->OpCode == EFI_IFR_REF_OP && MenuOption->Col >= 2 && IsProcessingFirstRow) {
+ if ((Statement->OpCode->OpCode == EFI_IFR_REF_OP) && (MenuOption->Col >= 2) && IsProcessingFirstRow) {
//
// Print Arrow for Goto button.
//
@@ -2512,9 +2537,11 @@ DisplayOneMenu (
);
IsProcessingFirstRow = FALSE;
}
+
DisplayMenuString (MenuOption, MenuOption->Col, Row, OutputString, PromptWidth + AdjustValue, Highlight);
- PromptLineNum ++;
+ PromptLineNum++;
}
+
//
// If there is more string to process print on the next row and increment the Skip value
//
@@ -2533,16 +2560,15 @@ DisplayOneMenu (
Highlight = FALSE;
}
-
//
// 3. If this is a text op with secondary text information
//
- if ((Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) && (((EFI_IFR_TEXT*)Statement->OpCode)->TextTwo != 0)) {
- StringPtr = GetToken (((EFI_IFR_TEXT*)Statement->OpCode)->TextTwo, gFormData->HiiHandle);
+ if ((Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) && (((EFI_IFR_TEXT *)Statement->OpCode)->TextTwo != 0)) {
+ StringPtr = GetToken (((EFI_IFR_TEXT *)Statement->OpCode)->TextTwo, gFormData->HiiHandle);
- Width = (UINT16) gOptionBlockWidth - 1;
- Row = MenuOption->Row;
- GlyphWidth = 1;
+ Width = (UINT16)gOptionBlockWidth - 1;
+ Row = MenuOption->Row;
+ GlyphWidth = 1;
OptionLineNum = 0;
for (Index = 0; GetLineByWidth (StringPtr, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
@@ -2550,6 +2576,7 @@ DisplayOneMenu (
DisplayMenuString (MenuOption, MenuOption->OptCol, Row, OutputString, Width + 1, Highlight);
OptionLineNum++;
}
+
//
// If there is more string to process print on the next row and increment the Skip value
//
@@ -2578,10 +2605,10 @@ DisplayOneMenu (
// 4.Line number for Option string and prompt string are not equal.
// Clean the column whose line number is less.
//
- if (HasOptionString(MenuOption) && (OptionLineNum != PromptLineNum)) {
+ if (HasOptionString (MenuOption) && (OptionLineNum != PromptLineNum)) {
Col = OptionLineNum < PromptLineNum ? MenuOption->OptCol : BeginCol;
Row = (OptionLineNum < PromptLineNum ? OptionLineNum : PromptLineNum) + MenuOption->Row;
- Width = (UINT16) (OptionLineNum < PromptLineNum ? gOptionBlockWidth : PromptWidth + AdjustValue + SkipWidth);
+ Width = (UINT16)(OptionLineNum < PromptLineNum ? gOptionBlockWidth : PromptWidth + AdjustValue + SkipWidth);
MaxRow = (OptionLineNum < PromptLineNum ? PromptLineNum : OptionLineNum) + MenuOption->Row - 1;
while (Row <= MaxRow) {
@@ -2608,84 +2635,84 @@ UiDisplayMenu (
IN FORM_DISPLAY_ENGINE_FORM *FormData
)
{
- UINTN SkipValue;
- INTN Difference;
- UINTN DistanceValue;
- UINTN Row;
- UINTN Col;
- UINTN Temp;
- UINTN Temp2;
- UINTN TopRow;
- UINTN BottomRow;
- UINTN Index;
- CHAR16 *StringPtr;
- CHAR16 *StringRightPtr;
- CHAR16 *StringErrorPtr;
- CHAR16 *OptionString;
- CHAR16 *HelpString;
- CHAR16 *HelpHeaderString;
- CHAR16 *HelpBottomString;
- BOOLEAN NewLine;
- BOOLEAN Repaint;
- BOOLEAN UpArrow;
- BOOLEAN DownArrow;
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
- LIST_ENTRY *Link;
- LIST_ENTRY *NewPos;
- LIST_ENTRY *TopOfScreen;
- LIST_ENTRY *SavedListEntry;
- UI_MENU_OPTION *MenuOption;
- UI_MENU_OPTION *NextMenuOption;
- UI_MENU_OPTION *SavedMenuOption;
- UI_CONTROL_FLAG ControlFlag;
- UI_SCREEN_OPERATION ScreenOperation;
- FORM_DISPLAY_ENGINE_STATEMENT *Statement;
- BROWSER_HOT_KEY *HotKey;
- UINTN HelpPageIndex;
- UINTN HelpPageCount;
- UINTN RowCount;
- UINTN HelpLine;
- UINTN HelpHeaderLine;
- UINTN HelpBottomLine;
- BOOLEAN MultiHelpPage;
- UINT16 EachLineWidth;
- UINT16 HeaderLineWidth;
- UINT16 BottomLineWidth;
- EFI_STRING_ID HelpInfo;
- UI_EVENT_TYPE EventType;
- BOOLEAN SkipHighLight;
- EFI_HII_VALUE *StatementValue;
-
- EventType = UIEventNone;
- Status = EFI_SUCCESS;
- HelpString = NULL;
- HelpHeaderString = NULL;
- HelpBottomString = NULL;
- OptionString = NULL;
- ScreenOperation = UiNoOperation;
- NewLine = TRUE;
- HelpPageCount = 0;
- HelpLine = 0;
- RowCount = 0;
- HelpBottomLine = 0;
- HelpHeaderLine = 0;
- HelpPageIndex = 0;
- MultiHelpPage = FALSE;
- EachLineWidth = 0;
- HeaderLineWidth = 0;
- BottomLineWidth = 0;
- UpArrow = FALSE;
- DownArrow = FALSE;
- SkipValue = 0;
- SkipHighLight = FALSE;
-
- NextMenuOption = NULL;
- SavedMenuOption = NULL;
- HotKey = NULL;
- Repaint = TRUE;
- MenuOption = NULL;
- gModalSkipColumn = (CHAR16) (gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn) / 6;
+ UINTN SkipValue;
+ INTN Difference;
+ UINTN DistanceValue;
+ UINTN Row;
+ UINTN Col;
+ UINTN Temp;
+ UINTN Temp2;
+ UINTN TopRow;
+ UINTN BottomRow;
+ UINTN Index;
+ CHAR16 *StringPtr;
+ CHAR16 *StringRightPtr;
+ CHAR16 *StringErrorPtr;
+ CHAR16 *OptionString;
+ CHAR16 *HelpString;
+ CHAR16 *HelpHeaderString;
+ CHAR16 *HelpBottomString;
+ BOOLEAN NewLine;
+ BOOLEAN Repaint;
+ BOOLEAN UpArrow;
+ BOOLEAN DownArrow;
+ EFI_STATUS Status;
+ EFI_INPUT_KEY Key;
+ LIST_ENTRY *Link;
+ LIST_ENTRY *NewPos;
+ LIST_ENTRY *TopOfScreen;
+ LIST_ENTRY *SavedListEntry;
+ UI_MENU_OPTION *MenuOption;
+ UI_MENU_OPTION *NextMenuOption;
+ UI_MENU_OPTION *SavedMenuOption;
+ UI_CONTROL_FLAG ControlFlag;
+ UI_SCREEN_OPERATION ScreenOperation;
+ FORM_DISPLAY_ENGINE_STATEMENT *Statement;
+ BROWSER_HOT_KEY *HotKey;
+ UINTN HelpPageIndex;
+ UINTN HelpPageCount;
+ UINTN RowCount;
+ UINTN HelpLine;
+ UINTN HelpHeaderLine;
+ UINTN HelpBottomLine;
+ BOOLEAN MultiHelpPage;
+ UINT16 EachLineWidth;
+ UINT16 HeaderLineWidth;
+ UINT16 BottomLineWidth;
+ EFI_STRING_ID HelpInfo;
+ UI_EVENT_TYPE EventType;
+ BOOLEAN SkipHighLight;
+ EFI_HII_VALUE *StatementValue;
+
+ EventType = UIEventNone;
+ Status = EFI_SUCCESS;
+ HelpString = NULL;
+ HelpHeaderString = NULL;
+ HelpBottomString = NULL;
+ OptionString = NULL;
+ ScreenOperation = UiNoOperation;
+ NewLine = TRUE;
+ HelpPageCount = 0;
+ HelpLine = 0;
+ RowCount = 0;
+ HelpBottomLine = 0;
+ HelpHeaderLine = 0;
+ HelpPageIndex = 0;
+ MultiHelpPage = FALSE;
+ EachLineWidth = 0;
+ HeaderLineWidth = 0;
+ BottomLineWidth = 0;
+ UpArrow = FALSE;
+ DownArrow = FALSE;
+ SkipValue = 0;
+ SkipHighLight = FALSE;
+
+ NextMenuOption = NULL;
+ SavedMenuOption = NULL;
+ HotKey = NULL;
+ Repaint = TRUE;
+ MenuOption = NULL;
+ gModalSkipColumn = (CHAR16)(gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn) / 6;
ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
@@ -2699,9 +2726,9 @@ UiDisplayMenu (
Col = gStatementDimensions.LeftColumn + LEFT_SKIPPED_COLUMNS;
}
- FindTopMenu(FormData, &TopOfScreen, &NewPos, &SkipValue);
+ FindTopMenu (FormData, &TopOfScreen, &NewPos, &SkipValue);
if (!IsListEmpty (&gMenuOption)) {
- NextMenuOption = MENU_OPTION_FROM_LINK (NewPos);
+ NextMenuOption = MENU_OPTION_FROM_LINK (NewPos);
gUserInput->SelectedStatement = NextMenuOption->ThisTag;
}
@@ -2710,376 +2737,371 @@ UiDisplayMenu (
ControlFlag = CfInitialization;
while (TRUE) {
switch (ControlFlag) {
- case CfInitialization:
- if ((gOldFormEntry.HiiHandle != FormData->HiiHandle) ||
- (!CompareGuid (&gOldFormEntry.FormSetGuid, &FormData->FormSetGuid))) {
- //
- // Clear Statement range if different formset is painted.
- //
- ClearLines (
- gStatementDimensions.LeftColumn,
- gStatementDimensions.RightColumn,
- TopRow - SCROLL_ARROW_HEIGHT,
- BottomRow + SCROLL_ARROW_HEIGHT,
- GetFieldTextColor ()
- );
-
- }
- ControlFlag = CfRepaint;
- break;
-
- case CfRepaint:
- ControlFlag = CfRefreshHighLight;
+ case CfInitialization:
+ if ((gOldFormEntry.HiiHandle != FormData->HiiHandle) ||
+ (!CompareGuid (&gOldFormEntry.FormSetGuid, &FormData->FormSetGuid)))
+ {
+ //
+ // Clear Statement range if different formset is painted.
+ //
+ ClearLines (
+ gStatementDimensions.LeftColumn,
+ gStatementDimensions.RightColumn,
+ TopRow - SCROLL_ARROW_HEIGHT,
+ BottomRow + SCROLL_ARROW_HEIGHT,
+ GetFieldTextColor ()
+ );
+ }
- if (Repaint) {
- //
- // Display menu
- //
- DownArrow = FALSE;
- UpArrow = FALSE;
- Row = TopRow;
+ ControlFlag = CfRepaint;
+ break;
- gST->ConOut->SetAttribute (gST->ConOut, GetFieldTextColor ());
+ case CfRepaint:
+ ControlFlag = CfRefreshHighLight;
- //
- // 1. Check whether need to print the arrow up.
- //
- if (!ValueIsScroll (TRUE, TopOfScreen)) {
- UpArrow = TRUE;
- }
+ if (Repaint) {
+ //
+ // Display menu
+ //
+ DownArrow = FALSE;
+ UpArrow = FALSE;
+ Row = TopRow;
- if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
- PrintStringAtWithWidth(gStatementDimensions.LeftColumn + gModalSkipColumn, TopRow - 1, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - 2 * gModalSkipColumn);
- } else {
- PrintStringAtWithWidth(gStatementDimensions.LeftColumn, TopRow - 1, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn);
- }
- if (UpArrow) {
- gST->ConOut->SetAttribute (gST->ConOut, GetArrowColor ());
- PrintCharAt (
- gStatementDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + 1,
- TopRow - SCROLL_ARROW_HEIGHT,
- ARROW_UP
- );
gST->ConOut->SetAttribute (gST->ConOut, GetFieldTextColor ());
- }
- //
- // 2.Paint the menu.
- //
- for (Link = TopOfScreen; Link != &gMenuOption; Link = Link->ForwardLink) {
- MenuOption = MENU_OPTION_FROM_LINK (Link);
- MenuOption->Row = Row;
- MenuOption->Col = Col;
+ //
+ // 1. Check whether need to print the arrow up.
+ //
+ if (!ValueIsScroll (TRUE, TopOfScreen)) {
+ UpArrow = TRUE;
+ }
+
if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
- MenuOption->OptCol = gStatementDimensions.LeftColumn + LEFT_SKIPPED_COLUMNS + gPromptBlockWidth + gModalSkipColumn;
+ PrintStringAtWithWidth (gStatementDimensions.LeftColumn + gModalSkipColumn, TopRow - 1, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - 2 * gModalSkipColumn);
} else {
- MenuOption->OptCol = gStatementDimensions.LeftColumn + LEFT_SKIPPED_COLUMNS + gPromptBlockWidth;
+ PrintStringAtWithWidth (gStatementDimensions.LeftColumn, TopRow - 1, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn);
}
- if (MenuOption->NestInStatement) {
- MenuOption->Col += SUBTITLE_INDENT;
+ if (UpArrow) {
+ gST->ConOut->SetAttribute (gST->ConOut, GetArrowColor ());
+ PrintCharAt (
+ gStatementDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + 1,
+ TopRow - SCROLL_ARROW_HEIGHT,
+ ARROW_UP
+ );
+ gST->ConOut->SetAttribute (gST->ConOut, GetFieldTextColor ());
}
//
- // Save the highlight menu, will be used in CfRefreshHighLight case.
+ // 2.Paint the menu.
//
- if (Link == NewPos) {
- SavedMenuOption = MenuOption;
- SkipHighLight = TRUE;
- }
+ for (Link = TopOfScreen; Link != &gMenuOption; Link = Link->ForwardLink) {
+ MenuOption = MENU_OPTION_FROM_LINK (Link);
+ MenuOption->Row = Row;
+ MenuOption->Col = Col;
+ if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
+ MenuOption->OptCol = gStatementDimensions.LeftColumn + LEFT_SKIPPED_COLUMNS + gPromptBlockWidth + gModalSkipColumn;
+ } else {
+ MenuOption->OptCol = gStatementDimensions.LeftColumn + LEFT_SKIPPED_COLUMNS + gPromptBlockWidth;
+ }
- if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
- Status = DisplayOneMenu (MenuOption,
- MenuOption->Col - gStatementDimensions.LeftColumn,
- gStatementDimensions.LeftColumn + gModalSkipColumn,
- Link == TopOfScreen ? SkipValue : 0,
- BottomRow,
- (BOOLEAN) ((Link == NewPos) && IsSelectable(MenuOption)),
- TRUE
- );
- } else {
- Status = DisplayOneMenu (MenuOption,
- MenuOption->Col - gStatementDimensions.LeftColumn,
- gStatementDimensions.LeftColumn,
- Link == TopOfScreen ? SkipValue : 0,
- BottomRow,
- (BOOLEAN) ((Link == NewPos) && IsSelectable(MenuOption)),
- TRUE
- );
+ if (MenuOption->NestInStatement) {
+ MenuOption->Col += SUBTITLE_INDENT;
+ }
+
+ //
+ // Save the highlight menu, will be used in CfRefreshHighLight case.
+ //
+ if (Link == NewPos) {
+ SavedMenuOption = MenuOption;
+ SkipHighLight = TRUE;
+ }
+
+ if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
+ Status = DisplayOneMenu (
+ MenuOption,
+ MenuOption->Col - gStatementDimensions.LeftColumn,
+ gStatementDimensions.LeftColumn + gModalSkipColumn,
+ Link == TopOfScreen ? SkipValue : 0,
+ BottomRow,
+ (BOOLEAN)((Link == NewPos) && IsSelectable (MenuOption)),
+ TRUE
+ );
+ } else {
+ Status = DisplayOneMenu (
+ MenuOption,
+ MenuOption->Col - gStatementDimensions.LeftColumn,
+ gStatementDimensions.LeftColumn,
+ Link == TopOfScreen ? SkipValue : 0,
+ BottomRow,
+ (BOOLEAN)((Link == NewPos) && IsSelectable (MenuOption)),
+ TRUE
+ );
+ }
+
+ if (EFI_ERROR (Status)) {
+ if (gMisMatch) {
+ return EFI_SUCCESS;
+ } else {
+ return Status;
+ }
+ }
+
+ //
+ // 3. Update the row info which will be used by next menu.
+ //
+ if (Link == TopOfScreen) {
+ Row += MenuOption->Skip - SkipValue;
+ } else {
+ Row += MenuOption->Skip;
+ }
+
+ if (Row > BottomRow) {
+ if (!ValueIsScroll (FALSE, Link)) {
+ DownArrow = TRUE;
+ }
+
+ Row = BottomRow + 1;
+ break;
+ }
}
- if (EFI_ERROR (Status)) {
- if (gMisMatch) {
- return EFI_SUCCESS;
+ //
+ // 3. Menus in this form may not cover all form, clean the remain field.
+ //
+ while (Row <= BottomRow) {
+ if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
+ PrintStringAtWithWidth (gStatementDimensions.LeftColumn + gModalSkipColumn, Row++, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - 2 * gModalSkipColumn);
} else {
- return Status;
+ PrintStringAtWithWidth (gStatementDimensions.LeftColumn, Row++, L"", gStatementDimensions.RightColumn - gHelpBlockWidth - gStatementDimensions.LeftColumn);
}
}
+
//
- // 3. Update the row info which will be used by next menu.
+ // 4. Print the down arrow row.
//
- if (Link == TopOfScreen) {
- Row += MenuOption->Skip - SkipValue;
+ if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
+ PrintStringAtWithWidth (gStatementDimensions.LeftColumn + gModalSkipColumn, BottomRow + 1, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - 2 * +gModalSkipColumn);
} else {
- Row += MenuOption->Skip;
+ PrintStringAtWithWidth (gStatementDimensions.LeftColumn, BottomRow + 1, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn);
}
- if (Row > BottomRow) {
- if (!ValueIsScroll (FALSE, Link)) {
- DownArrow = TRUE;
- }
-
- Row = BottomRow + 1;
- break;
+ if (DownArrow) {
+ gST->ConOut->SetAttribute (gST->ConOut, GetArrowColor ());
+ PrintCharAt (
+ gStatementDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + 1,
+ BottomRow + SCROLL_ARROW_HEIGHT,
+ ARROW_DOWN
+ );
+ gST->ConOut->SetAttribute (gST->ConOut, GetFieldTextColor ());
}
+
+ MenuOption = NULL;
}
+ break;
+
+ case CfRefreshHighLight:
+
//
- // 3. Menus in this form may not cover all form, clean the remain field.
+ // MenuOption: Last menu option that need to remove hilight
+ // MenuOption is set to NULL in Repaint
+ // NewPos: Current menu option that need to hilight
//
- while (Row <= BottomRow) {
- if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
- PrintStringAtWithWidth(gStatementDimensions.LeftColumn + gModalSkipColumn, Row++, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - 2 * gModalSkipColumn);
- } else {
- PrintStringAtWithWidth(gStatementDimensions.LeftColumn, Row++, L"", gStatementDimensions.RightColumn - gHelpBlockWidth - gStatementDimensions.LeftColumn);
- }
+ ControlFlag = CfUpdateHelpString;
+
+ ASSERT (NewPos != NULL);
+ UpdateHighlightMenuInfo (NewPos, TopOfScreen, SkipValue);
+
+ if (SkipHighLight) {
+ SkipHighLight = FALSE;
+ MenuOption = SavedMenuOption;
+ RefreshKeyHelp (gFormData, SavedMenuOption->ThisTag, FALSE);
+ break;
}
- //
- // 4. Print the down arrow row.
- //
- if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
- PrintStringAtWithWidth(gStatementDimensions.LeftColumn + gModalSkipColumn, BottomRow + 1, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - 2 * + gModalSkipColumn);
+ if (IsListEmpty (&gMenuOption)) {
+ //
+ // No menu option, just update the hotkey filed.
+ //
+ RefreshKeyHelp (gFormData, NULL, FALSE);
+ break;
+ }
+
+ if ((MenuOption != NULL) && (TopOfScreen == &MenuOption->Link)) {
+ Temp = SkipValue;
} else {
- PrintStringAtWithWidth(gStatementDimensions.LeftColumn, BottomRow + 1, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn);
+ Temp = 0;
}
- if (DownArrow) {
- gST->ConOut->SetAttribute (gST->ConOut, GetArrowColor ());
- PrintCharAt (
- gStatementDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + 1,
- BottomRow + SCROLL_ARROW_HEIGHT,
- ARROW_DOWN
- );
- gST->ConOut->SetAttribute (gST->ConOut, GetFieldTextColor ());
+
+ if (NewPos == TopOfScreen) {
+ Temp2 = SkipValue;
+ } else {
+ Temp2 = 0;
}
- MenuOption = NULL;
- }
- break;
+ if ((MenuOption == NULL) || (NewPos != &MenuOption->Link)) {
+ if (MenuOption != NULL) {
+ //
+ // Remove the old highlight menu.
+ //
+ Status = DisplayOneMenu (
+ MenuOption,
+ MenuOption->Col - gStatementDimensions.LeftColumn,
+ gStatementDimensions.LeftColumn,
+ Temp,
+ BottomRow,
+ FALSE,
+ FALSE
+ );
+ }
- case CfRefreshHighLight:
+ //
+ // This is the current selected statement
+ //
+ MenuOption = MENU_OPTION_FROM_LINK (NewPos);
+ RefreshKeyHelp (gFormData, MenuOption->ThisTag, FALSE);
- //
- // MenuOption: Last menu option that need to remove hilight
- // MenuOption is set to NULL in Repaint
- // NewPos: Current menu option that need to hilight
- //
- ControlFlag = CfUpdateHelpString;
+ if (!IsSelectable (MenuOption)) {
+ break;
+ }
- ASSERT (NewPos != NULL);
- UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);
+ Status = DisplayOneMenu (
+ MenuOption,
+ MenuOption->Col - gStatementDimensions.LeftColumn,
+ gStatementDimensions.LeftColumn,
+ Temp2,
+ BottomRow,
+ TRUE,
+ FALSE
+ );
+ }
- if (SkipHighLight) {
- SkipHighLight = FALSE;
- MenuOption = SavedMenuOption;
- RefreshKeyHelp(gFormData, SavedMenuOption->ThisTag, FALSE);
break;
- }
- if (IsListEmpty (&gMenuOption)) {
+ case CfUpdateHelpString:
+ ControlFlag = CfPrepareToReadKey;
+ if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
+ break;
+ }
+
//
- // No menu option, just update the hotkey filed.
+ // NewLine means only update highlight menu (remove old highlight and highlith
+ // the new one), not need to full repain the form.
//
- RefreshKeyHelp(gFormData, NULL, FALSE);
- break;
- }
-
- if (MenuOption != NULL && TopOfScreen == &MenuOption->Link) {
- Temp = SkipValue;
- } else {
- Temp = 0;
- }
- if (NewPos == TopOfScreen) {
- Temp2 = SkipValue;
- } else {
- Temp2 = 0;
- }
+ if (Repaint || NewLine) {
+ if (IsListEmpty (&gMenuOption)) {
+ //
+ // Don't print anything if no mwnu option.
+ //
+ StringPtr = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
+ } else {
+ //
+ // Don't print anything if it is a NULL help token
+ //
+ ASSERT (MenuOption != NULL);
+ HelpInfo = ((EFI_IFR_STATEMENT_HEADER *)((CHAR8 *)MenuOption->ThisTag->OpCode + sizeof (EFI_IFR_OP_HEADER)))->Help;
+ Statement = MenuOption->ThisTag;
+ StatementValue = &Statement->CurrentValue;
+ if ((HelpInfo == 0) || !IsSelectable (MenuOption)) {
+ if (((Statement->OpCode->OpCode == EFI_IFR_DATE_OP) && (StatementValue->Value.date.Month == 0xff)) || ((Statement->OpCode->OpCode == EFI_IFR_TIME_OP) && (StatementValue->Value.time.Hour == 0xff))) {
+ StringPtr = GetToken (STRING_TOKEN (GET_TIME_FAIL), gHiiHandle);
+ } else {
+ StringPtr = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
+ }
+ } else {
+ if (((Statement->OpCode->OpCode == EFI_IFR_DATE_OP) && (StatementValue->Value.date.Month == 0xff)) || ((Statement->OpCode->OpCode == EFI_IFR_TIME_OP) && (StatementValue->Value.time.Hour == 0xff))) {
+ StringRightPtr = GetToken (HelpInfo, gFormData->HiiHandle);
+ StringErrorPtr = GetToken (STRING_TOKEN (GET_TIME_FAIL), gHiiHandle);
+ StringPtr = AllocateZeroPool ((StrLen (StringRightPtr) + StrLen (StringErrorPtr)+ 1) * sizeof (CHAR16));
+ StrCpyS (StringPtr, StrLen (StringRightPtr) + StrLen (StringErrorPtr) + 1, StringRightPtr);
+ StrCatS (StringPtr, StrLen (StringRightPtr) + StrLen (StringErrorPtr) + 1, StringErrorPtr);
+ FreePool (StringRightPtr);
+ FreePool (StringErrorPtr);
+ } else {
+ StringPtr = GetToken (HelpInfo, gFormData->HiiHandle);
+ }
+ }
+ }
- if (MenuOption == NULL || NewPos != &MenuOption->Link) {
- if (MenuOption != NULL) {
+ RowCount = BottomRow - TopRow + 1;
+ HelpPageIndex = 0;
//
- // Remove the old highlight menu.
+ // 1.Calculate how many line the help string need to print.
//
- Status = DisplayOneMenu (MenuOption,
- MenuOption->Col - gStatementDimensions.LeftColumn,
- gStatementDimensions.LeftColumn,
- Temp,
- BottomRow,
- FALSE,
- FALSE
- );
- }
-
- //
- // This is the current selected statement
- //
- MenuOption = MENU_OPTION_FROM_LINK (NewPos);
- RefreshKeyHelp(gFormData, MenuOption->ThisTag, FALSE);
+ if (HelpString != NULL) {
+ FreePool (HelpString);
+ HelpString = NULL;
+ }
- if (!IsSelectable (MenuOption)) {
- break;
- }
+ HelpLine = ProcessHelpString (StringPtr, &HelpString, &EachLineWidth, RowCount);
+ FreePool (StringPtr);
- Status = DisplayOneMenu (MenuOption,
- MenuOption->Col - gStatementDimensions.LeftColumn,
- gStatementDimensions.LeftColumn,
- Temp2,
- BottomRow,
- TRUE,
- FALSE
- );
- }
- break;
+ if (HelpLine > RowCount) {
+ MultiHelpPage = TRUE;
+ StringPtr = GetToken (STRING_TOKEN (ADJUST_HELP_PAGE_UP), gHiiHandle);
+ if (HelpHeaderString != NULL) {
+ FreePool (HelpHeaderString);
+ HelpHeaderString = NULL;
+ }
- case CfUpdateHelpString:
- ControlFlag = CfPrepareToReadKey;
- if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
- break;
- }
+ HelpHeaderLine = ProcessHelpString (StringPtr, &HelpHeaderString, &HeaderLineWidth, 0);
+ FreePool (StringPtr);
+ StringPtr = GetToken (STRING_TOKEN (ADJUST_HELP_PAGE_DOWN), gHiiHandle);
+ if (HelpBottomString != NULL) {
+ FreePool (HelpBottomString);
+ HelpBottomString = NULL;
+ }
- //
- // NewLine means only update highlight menu (remove old highlight and highlith
- // the new one), not need to full repain the form.
- //
- if (Repaint || NewLine) {
- if (IsListEmpty (&gMenuOption)) {
- //
- // Don't print anything if no mwnu option.
- //
- StringPtr = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
- } else {
- //
- // Don't print anything if it is a NULL help token
- //
- ASSERT(MenuOption != NULL);
- HelpInfo = ((EFI_IFR_STATEMENT_HEADER *) ((CHAR8 *)MenuOption->ThisTag->OpCode + sizeof (EFI_IFR_OP_HEADER)))->Help;
- Statement = MenuOption->ThisTag;
- StatementValue = &Statement->CurrentValue;
- if (HelpInfo == 0 || !IsSelectable (MenuOption)) {
- if ((Statement->OpCode->OpCode == EFI_IFR_DATE_OP && StatementValue->Value.date.Month== 0xff)||(Statement->OpCode->OpCode == EFI_IFR_TIME_OP && StatementValue->Value.time.Hour == 0xff)){
- StringPtr = GetToken (STRING_TOKEN (GET_TIME_FAIL), gHiiHandle);
+ HelpBottomLine = ProcessHelpString (StringPtr, &HelpBottomString, &BottomLineWidth, 0);
+ FreePool (StringPtr);
+ //
+ // Calculate the help page count.
+ //
+ if (HelpLine > 2 * RowCount - 2) {
+ HelpPageCount = (HelpLine - RowCount + 1) / (RowCount - 2) + 1;
+ if ((HelpLine - RowCount + 1) % (RowCount - 2) != 0) {
+ HelpPageCount += 1;
+ }
} else {
- StringPtr = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
+ HelpPageCount = 2;
}
} else {
- if ((Statement->OpCode->OpCode == EFI_IFR_DATE_OP && StatementValue->Value.date.Month== 0xff)||(Statement->OpCode->OpCode == EFI_IFR_TIME_OP && StatementValue->Value.time.Hour == 0xff)){
- StringRightPtr = GetToken (HelpInfo, gFormData->HiiHandle);
- StringErrorPtr = GetToken (STRING_TOKEN (GET_TIME_FAIL), gHiiHandle);
- StringPtr = AllocateZeroPool ((StrLen (StringRightPtr) + StrLen (StringErrorPtr)+ 1 ) * sizeof (CHAR16));
- StrCpyS (StringPtr, StrLen (StringRightPtr) + StrLen (StringErrorPtr) + 1, StringRightPtr);
- StrCatS (StringPtr, StrLen (StringRightPtr) + StrLen (StringErrorPtr) + 1, StringErrorPtr);
- FreePool (StringRightPtr);
- FreePool (StringErrorPtr);
- } else {
- StringPtr = GetToken (HelpInfo, gFormData->HiiHandle);
- }
+ MultiHelpPage = FALSE;
}
}
- RowCount = BottomRow - TopRow + 1;
- HelpPageIndex = 0;
//
- // 1.Calculate how many line the help string need to print.
+ // Check whether need to show the 'More(U/u)' at the begin.
+ // Base on current direct info, here shows aligned to the right side of the column.
+ // If the direction is multi line and aligned to right side may have problem, so
+ // add ASSERT code here.
//
- if (HelpString != NULL) {
- FreePool (HelpString);
- HelpString = NULL;
- }
- HelpLine = ProcessHelpString (StringPtr, &HelpString, &EachLineWidth, RowCount);
- FreePool (StringPtr);
-
- if (HelpLine > RowCount) {
- MultiHelpPage = TRUE;
- StringPtr = GetToken (STRING_TOKEN(ADJUST_HELP_PAGE_UP), gHiiHandle);
- if (HelpHeaderString != NULL) {
- FreePool (HelpHeaderString);
- HelpHeaderString = NULL;
- }
- HelpHeaderLine = ProcessHelpString (StringPtr, &HelpHeaderString, &HeaderLineWidth, 0);
- FreePool (StringPtr);
- StringPtr = GetToken (STRING_TOKEN(ADJUST_HELP_PAGE_DOWN), gHiiHandle);
- if (HelpBottomString != NULL) {
- FreePool (HelpBottomString);
- HelpBottomString = NULL;
- }
- HelpBottomLine = ProcessHelpString (StringPtr, &HelpBottomString, &BottomLineWidth, 0);
- FreePool (StringPtr);
- //
- // Calculate the help page count.
- //
- if (HelpLine > 2 * RowCount - 2) {
- HelpPageCount = (HelpLine - RowCount + 1) / (RowCount - 2) + 1;
- if ((HelpLine - RowCount + 1) % (RowCount - 2) != 0) {
- HelpPageCount += 1;
- }
- } else {
- HelpPageCount = 2;
+ if (HelpPageIndex > 0) {
+ gST->ConOut->SetAttribute (gST->ConOut, GetInfoTextColor ());
+ for (Index = 0; Index < HelpHeaderLine; Index++) {
+ ASSERT (HelpHeaderLine == 1);
+ ASSERT (GetStringWidth (HelpHeaderString) / 2 < ((UINT32)gHelpBlockWidth - 1));
+ PrintStringAtWithWidth (
+ gStatementDimensions.RightColumn - gHelpBlockWidth,
+ Index + TopRow,
+ gEmptyString,
+ gHelpBlockWidth
+ );
+ PrintStringAt (
+ gStatementDimensions.RightColumn - GetStringWidth (HelpHeaderString) / 2 - 1,
+ Index + TopRow,
+ &HelpHeaderString[Index * HeaderLineWidth]
+ );
}
- } else {
- MultiHelpPage = FALSE;
}
- }
- //
- // Check whether need to show the 'More(U/u)' at the begin.
- // Base on current direct info, here shows aligned to the right side of the column.
- // If the direction is multi line and aligned to right side may have problem, so
- // add ASSERT code here.
- //
- if (HelpPageIndex > 0) {
- gST->ConOut->SetAttribute (gST->ConOut, GetInfoTextColor ());
- for (Index = 0; Index < HelpHeaderLine; Index++) {
- ASSERT (HelpHeaderLine == 1);
- ASSERT (GetStringWidth (HelpHeaderString) / 2 < ((UINT32) gHelpBlockWidth - 1));
- PrintStringAtWithWidth (
- gStatementDimensions.RightColumn - gHelpBlockWidth,
- Index + TopRow,
- gEmptyString,
- gHelpBlockWidth
- );
- PrintStringAt (
- gStatementDimensions.RightColumn - GetStringWidth (HelpHeaderString) / 2 - 1,
- Index + TopRow,
- &HelpHeaderString[Index * HeaderLineWidth]
- );
- }
- }
-
- gST->ConOut->SetAttribute (gST->ConOut, GetHelpTextColor ());
- //
- // Print the help string info.
- //
- if (!MultiHelpPage) {
- for (Index = 0; Index < HelpLine; Index++) {
- PrintStringAtWithWidth (
- gStatementDimensions.RightColumn - gHelpBlockWidth,
- Index + TopRow,
- &HelpString[Index * EachLineWidth],
- gHelpBlockWidth
- );
- }
- for (; Index < RowCount; Index ++) {
- PrintStringAtWithWidth (
- gStatementDimensions.RightColumn - gHelpBlockWidth,
- Index + TopRow,
- gEmptyString,
- gHelpBlockWidth
- );
- }
- gST->ConOut->SetCursorPosition(gST->ConOut, gStatementDimensions.RightColumn-1, BottomRow);
- } else {
- if (HelpPageIndex == 0) {
- for (Index = 0; Index < RowCount - HelpBottomLine; Index++) {
+ gST->ConOut->SetAttribute (gST->ConOut, GetHelpTextColor ());
+ //
+ // Print the help string info.
+ //
+ if (!MultiHelpPage) {
+ for (Index = 0; Index < HelpLine; Index++) {
PrintStringAtWithWidth (
gStatementDimensions.RightColumn - gHelpBlockWidth,
Index + TopRow,
@@ -3087,714 +3109,764 @@ UiDisplayMenu (
gHelpBlockWidth
);
}
- } else {
- for (Index = 0; (Index < RowCount - HelpBottomLine - HelpHeaderLine) &&
- (Index + HelpPageIndex * (RowCount - 2) + 1 < HelpLine); Index++) {
+
+ for ( ; Index < RowCount; Index++) {
PrintStringAtWithWidth (
gStatementDimensions.RightColumn - gHelpBlockWidth,
- Index + TopRow + HelpHeaderLine,
- &HelpString[(Index + HelpPageIndex * (RowCount - 2) + 1)* EachLineWidth],
+ Index + TopRow,
+ gEmptyString,
gHelpBlockWidth
);
}
- if (HelpPageIndex == HelpPageCount - 1) {
- for (; Index < RowCount - HelpHeaderLine; Index ++) {
+
+ gST->ConOut->SetCursorPosition (gST->ConOut, gStatementDimensions.RightColumn-1, BottomRow);
+ } else {
+ if (HelpPageIndex == 0) {
+ for (Index = 0; Index < RowCount - HelpBottomLine; Index++) {
+ PrintStringAtWithWidth (
+ gStatementDimensions.RightColumn - gHelpBlockWidth,
+ Index + TopRow,
+ &HelpString[Index * EachLineWidth],
+ gHelpBlockWidth
+ );
+ }
+ } else {
+ for (Index = 0; (Index < RowCount - HelpBottomLine - HelpHeaderLine) &&
+ (Index + HelpPageIndex * (RowCount - 2) + 1 < HelpLine); Index++)
+ {
PrintStringAtWithWidth (
gStatementDimensions.RightColumn - gHelpBlockWidth,
Index + TopRow + HelpHeaderLine,
- gEmptyString,
+ &HelpString[(Index + HelpPageIndex * (RowCount - 2) + 1)* EachLineWidth],
gHelpBlockWidth
);
}
- gST->ConOut->SetCursorPosition(gST->ConOut, gStatementDimensions.RightColumn-1, BottomRow);
- }
- }
- }
-
- //
- // Check whether need to print the 'More(D/d)' at the bottom.
- // Base on current direct info, here shows aligned to the right side of the column.
- // If the direction is multi line and aligned to right side may have problem, so
- // add ASSERT code here.
- //
- if (HelpPageIndex < HelpPageCount - 1 && MultiHelpPage) {
- gST->ConOut->SetAttribute (gST->ConOut, GetInfoTextColor ());
- for (Index = 0; Index < HelpBottomLine; Index++) {
- ASSERT (HelpBottomLine == 1);
- ASSERT (GetStringWidth (HelpBottomString) / 2 < ((UINT32) gHelpBlockWidth - 1));
- PrintStringAtWithWidth (
- gStatementDimensions.RightColumn - gHelpBlockWidth,
- BottomRow + Index - HelpBottomLine + 1,
- gEmptyString,
- gHelpBlockWidth
- );
- PrintStringAt (
- gStatementDimensions.RightColumn - GetStringWidth (HelpBottomString) / 2 - 1,
- BottomRow + Index - HelpBottomLine + 1,
- &HelpBottomString[Index * BottomLineWidth]
- );
- }
- }
- //
- // Reset this flag every time we finish using it.
- //
- Repaint = FALSE;
- NewLine = FALSE;
- break;
-
- case CfPrepareToReadKey:
- ControlFlag = CfReadKey;
- ScreenOperation = UiNoOperation;
- break;
- case CfReadKey:
- ControlFlag = CfScreenOperation;
+ if (HelpPageIndex == HelpPageCount - 1) {
+ for ( ; Index < RowCount - HelpHeaderLine; Index++) {
+ PrintStringAtWithWidth (
+ gStatementDimensions.RightColumn - gHelpBlockWidth,
+ Index + TopRow + HelpHeaderLine,
+ gEmptyString,
+ gHelpBlockWidth
+ );
+ }
- //
- // Wait for user's selection
- //
- while (TRUE) {
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (!EFI_ERROR (Status)) {
- EventType = UIEventKey;
- break;
+ gST->ConOut->SetCursorPosition (gST->ConOut, gStatementDimensions.RightColumn-1, BottomRow);
+ }
+ }
}
//
- // If we encounter error, continue to read another key in.
+ // Check whether need to print the 'More(D/d)' at the bottom.
+ // Base on current direct info, here shows aligned to the right side of the column.
+ // If the direction is multi line and aligned to right side may have problem, so
+ // add ASSERT code here.
//
- if (Status != EFI_NOT_READY) {
- continue;
+ if ((HelpPageIndex < HelpPageCount - 1) && MultiHelpPage) {
+ gST->ConOut->SetAttribute (gST->ConOut, GetInfoTextColor ());
+ for (Index = 0; Index < HelpBottomLine; Index++) {
+ ASSERT (HelpBottomLine == 1);
+ ASSERT (GetStringWidth (HelpBottomString) / 2 < ((UINT32)gHelpBlockWidth - 1));
+ PrintStringAtWithWidth (
+ gStatementDimensions.RightColumn - gHelpBlockWidth,
+ BottomRow + Index - HelpBottomLine + 1,
+ gEmptyString,
+ gHelpBlockWidth
+ );
+ PrintStringAt (
+ gStatementDimensions.RightColumn - GetStringWidth (HelpBottomString) / 2 - 1,
+ BottomRow + Index - HelpBottomLine + 1,
+ &HelpBottomString[Index * BottomLineWidth]
+ );
+ }
}
- EventType = UiWaitForEvent(gST->ConIn->WaitForKey);
- if (EventType == UIEventKey) {
- gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- }
+ //
+ // Reset this flag every time we finish using it.
+ //
+ Repaint = FALSE;
+ NewLine = FALSE;
break;
- }
- if (EventType == UIEventDriver) {
- gMisMatch = TRUE;
- gUserInput->Action = BROWSER_ACTION_NONE;
- ControlFlag = CfExit;
+ case CfPrepareToReadKey:
+ ControlFlag = CfReadKey;
+ ScreenOperation = UiNoOperation;
break;
- }
- if (EventType == UIEventTimeOut) {
- gUserInput->Action = BROWSER_ACTION_FORM_EXIT;
- ControlFlag = CfExit;
- break;
- }
+ case CfReadKey:
+ ControlFlag = CfScreenOperation;
+
+ //
+ // Wait for user's selection
+ //
+ while (TRUE) {
+ Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+ if (!EFI_ERROR (Status)) {
+ EventType = UIEventKey;
+ break;
+ }
+
+ //
+ // If we encounter error, continue to read another key in.
+ //
+ if (Status != EFI_NOT_READY) {
+ continue;
+ }
+
+ EventType = UiWaitForEvent (gST->ConIn->WaitForKey);
+ if (EventType == UIEventKey) {
+ gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+ }
- switch (Key.UnicodeChar) {
- case CHAR_CARRIAGE_RETURN:
- if(MenuOption == NULL || MenuOption->GrayOut || MenuOption->ReadOnly) {
- ControlFlag = CfReadKey;
break;
}
- ScreenOperation = UiSelect;
- gDirection = 0;
- break;
+ if (EventType == UIEventDriver) {
+ gMisMatch = TRUE;
+ gUserInput->Action = BROWSER_ACTION_NONE;
+ ControlFlag = CfExit;
+ break;
+ }
- //
- // We will push the adjustment of these numeric values directly to the input handler
- // NOTE: we won't handle manual input numeric
- //
- case '+':
- case '-':
- //
- // If the screen has no menu items, and the user didn't select UiReset
- // ignore the selection and go back to reading keys.
- //
- ASSERT(MenuOption != NULL);
- if(IsListEmpty (&gMenuOption) || MenuOption->GrayOut || MenuOption->ReadOnly) {
- ControlFlag = CfReadKey;
+ if (EventType == UIEventTimeOut) {
+ gUserInput->Action = BROWSER_ACTION_FORM_EXIT;
+ ControlFlag = CfExit;
break;
}
- Statement = MenuOption->ThisTag;
- if ((Statement->OpCode->OpCode == EFI_IFR_DATE_OP)
- || (Statement->OpCode->OpCode == EFI_IFR_TIME_OP)
- || ((Statement->OpCode->OpCode == EFI_IFR_NUMERIC_OP) && (GetFieldFromNum(Statement->OpCode) != 0))
- ){
- if (Key.UnicodeChar == '+') {
- gDirection = SCAN_RIGHT;
- } else {
- gDirection = SCAN_LEFT;
- }
+ switch (Key.UnicodeChar) {
+ case CHAR_CARRIAGE_RETURN:
+ if ((MenuOption == NULL) || MenuOption->GrayOut || MenuOption->ReadOnly) {
+ ControlFlag = CfReadKey;
+ break;
+ }
- Status = ProcessOptions (MenuOption, TRUE, &OptionString, TRUE);
- if (OptionString != NULL) {
- FreePool (OptionString);
- }
- if (EFI_ERROR (Status)) {
+ ScreenOperation = UiSelect;
+ gDirection = 0;
+ break;
+
+ //
+ // We will push the adjustment of these numeric values directly to the input handler
+ // NOTE: we won't handle manual input numeric
+ //
+ case '+':
+ case '-':
//
- // Repaint to clear possible error prompt pop-up
+ // If the screen has no menu items, and the user didn't select UiReset
+ // ignore the selection and go back to reading keys.
//
- Repaint = TRUE;
- NewLine = TRUE;
- } else {
- ControlFlag = CfExit;
- }
- }
- break;
+ ASSERT (MenuOption != NULL);
+ if (IsListEmpty (&gMenuOption) || MenuOption->GrayOut || MenuOption->ReadOnly) {
+ ControlFlag = CfReadKey;
+ break;
+ }
- case '^':
- ScreenOperation = UiUp;
- break;
+ Statement = MenuOption->ThisTag;
+ if ( (Statement->OpCode->OpCode == EFI_IFR_DATE_OP)
+ || (Statement->OpCode->OpCode == EFI_IFR_TIME_OP)
+ || ((Statement->OpCode->OpCode == EFI_IFR_NUMERIC_OP) && (GetFieldFromNum (Statement->OpCode) != 0))
+ )
+ {
+ if (Key.UnicodeChar == '+') {
+ gDirection = SCAN_RIGHT;
+ } else {
+ gDirection = SCAN_LEFT;
+ }
+
+ Status = ProcessOptions (MenuOption, TRUE, &OptionString, TRUE);
+ if (OptionString != NULL) {
+ FreePool (OptionString);
+ }
+
+ if (EFI_ERROR (Status)) {
+ //
+ // Repaint to clear possible error prompt pop-up
+ //
+ Repaint = TRUE;
+ NewLine = TRUE;
+ } else {
+ ControlFlag = CfExit;
+ }
+ }
- case 'V':
- case 'v':
- ScreenOperation = UiDown;
- break;
+ break;
- case ' ':
- if(IsListEmpty (&gMenuOption)) {
- ControlFlag = CfReadKey;
- break;
- }
+ case '^':
+ ScreenOperation = UiUp;
+ break;
- ASSERT(MenuOption != NULL);
- if (MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_CHECKBOX_OP && !MenuOption->GrayOut && !MenuOption->ReadOnly) {
- ScreenOperation = UiSelect;
- }
- break;
+ case 'V':
+ case 'v':
+ ScreenOperation = UiDown;
+ break;
- case 'D':
- case 'd':
- if (!MultiHelpPage) {
- ControlFlag = CfReadKey;
- break;
- }
- ControlFlag = CfUpdateHelpString;
- HelpPageIndex = HelpPageIndex < HelpPageCount - 1 ? HelpPageIndex + 1 : HelpPageCount - 1;
- break;
+ case ' ':
+ if (IsListEmpty (&gMenuOption)) {
+ ControlFlag = CfReadKey;
+ break;
+ }
- case 'U':
- case 'u':
- if (!MultiHelpPage) {
- ControlFlag = CfReadKey;
- break;
+ ASSERT (MenuOption != NULL);
+ if ((MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_CHECKBOX_OP) && !MenuOption->GrayOut && !MenuOption->ReadOnly) {
+ ScreenOperation = UiSelect;
+ }
+
+ break;
+
+ case 'D':
+ case 'd':
+ if (!MultiHelpPage) {
+ ControlFlag = CfReadKey;
+ break;
+ }
+
+ ControlFlag = CfUpdateHelpString;
+ HelpPageIndex = HelpPageIndex < HelpPageCount - 1 ? HelpPageIndex + 1 : HelpPageCount - 1;
+ break;
+
+ case 'U':
+ case 'u':
+ if (!MultiHelpPage) {
+ ControlFlag = CfReadKey;
+ break;
+ }
+
+ ControlFlag = CfUpdateHelpString;
+ HelpPageIndex = HelpPageIndex > 0 ? HelpPageIndex - 1 : 0;
+ break;
+
+ case CHAR_NULL:
+ for (Index = 0; Index < mScanCodeNumber; Index++) {
+ if (Key.ScanCode == gScanCodeToOperation[Index].ScanCode) {
+ ScreenOperation = gScanCodeToOperation[Index].ScreenOperation;
+ break;
+ }
+ }
+
+ if (((FormData->Attribute & HII_DISPLAY_MODAL) != 0) && ((Key.ScanCode == SCAN_ESC) || (Index == mScanCodeNumber))) {
+ //
+ // ModalForm has no ESC key and Hot Key.
+ //
+ ControlFlag = CfReadKey;
+ } else if (Index == mScanCodeNumber) {
+ //
+ // Check whether Key matches the registered hot key.
+ //
+ HotKey = NULL;
+ HotKey = GetHotKeyFromRegisterList (&Key);
+ if (HotKey != NULL) {
+ ScreenOperation = UiHotKey;
+ }
+ }
+
+ break;
}
- ControlFlag = CfUpdateHelpString;
- HelpPageIndex = HelpPageIndex > 0 ? HelpPageIndex - 1 : 0;
+
break;
- case CHAR_NULL:
- for (Index = 0; Index < mScanCodeNumber; Index++) {
- if (Key.ScanCode == gScanCodeToOperation[Index].ScanCode) {
- ScreenOperation = gScanCodeToOperation[Index].ScreenOperation;
+ case CfScreenOperation:
+ if ((ScreenOperation != UiReset) && (ScreenOperation != UiHotKey)) {
+ //
+ // If the screen has no menu items, and the user didn't select UiReset or UiHotKey
+ // ignore the selection and go back to reading keys.
+ //
+ if (IsListEmpty (&gMenuOption)) {
+ ControlFlag = CfReadKey;
break;
}
}
- if (((FormData->Attribute & HII_DISPLAY_MODAL) != 0) && (Key.ScanCode == SCAN_ESC || Index == mScanCodeNumber)) {
- //
- // ModalForm has no ESC key and Hot Key.
- //
- ControlFlag = CfReadKey;
- } else if (Index == mScanCodeNumber) {
- //
- // Check whether Key matches the registered hot key.
- //
- HotKey = NULL;
- HotKey = GetHotKeyFromRegisterList (&Key);
- if (HotKey != NULL) {
- ScreenOperation = UiHotKey;
+ for (Index = 0;
+ Index < ARRAY_SIZE (gScreenOperationToControlFlag);
+ Index++
+ )
+ {
+ if (ScreenOperation == gScreenOperationToControlFlag[Index].ScreenOperation) {
+ ControlFlag = gScreenOperationToControlFlag[Index].ControlFlag;
+ break;
}
}
+
break;
- }
- break;
- case CfScreenOperation:
- if ((ScreenOperation != UiReset) && (ScreenOperation != UiHotKey)) {
- //
- // If the screen has no menu items, and the user didn't select UiReset or UiHotKey
- // ignore the selection and go back to reading keys.
- //
- if (IsListEmpty (&gMenuOption)) {
- ControlFlag = CfReadKey;
- break;
- }
- }
+ case CfUiSelect:
+ ControlFlag = CfRepaint;
- for (Index = 0;
- Index < ARRAY_SIZE (gScreenOperationToControlFlag);
- Index++
- ) {
- if (ScreenOperation == gScreenOperationToControlFlag[Index].ScreenOperation) {
- ControlFlag = gScreenOperationToControlFlag[Index].ControlFlag;
+ ASSERT (MenuOption != NULL);
+ Statement = MenuOption->ThisTag;
+ if (Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) {
break;
}
- }
- break;
- case CfUiSelect:
- ControlFlag = CfRepaint;
+ switch (Statement->OpCode->OpCode) {
+ case EFI_IFR_REF_OP:
+ case EFI_IFR_ACTION_OP:
+ case EFI_IFR_RESET_BUTTON_OP:
+ ControlFlag = CfExit;
+ break;
- ASSERT(MenuOption != NULL);
- Statement = MenuOption->ThisTag;
- if (Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) {
- break;
- }
+ default:
+ //
+ // Editable Questions: oneof, ordered list, checkbox, numeric, string, password
+ //
+ RefreshKeyHelp (gFormData, Statement, TRUE);
+ Status = ProcessOptions (MenuOption, TRUE, &OptionString, TRUE);
+
+ if (OptionString != NULL) {
+ FreePool (OptionString);
+ }
+
+ if (EFI_ERROR (Status)) {
+ Repaint = TRUE;
+ NewLine = TRUE;
+ RefreshKeyHelp (gFormData, Statement, FALSE);
+ break;
+ } else {
+ ControlFlag = CfExit;
+ break;
+ }
+ }
- switch (Statement->OpCode->OpCode) {
- case EFI_IFR_REF_OP:
- case EFI_IFR_ACTION_OP:
- case EFI_IFR_RESET_BUTTON_OP:
- ControlFlag = CfExit;
break;
- default:
+ case CfUiReset:
//
- // Editable Questions: oneof, ordered list, checkbox, numeric, string, password
+ // We come here when someone press ESC
+ // If the policy is not exit front page when user press ESC, process here.
//
- RefreshKeyHelp (gFormData, Statement, TRUE);
- Status = ProcessOptions (MenuOption, TRUE, &OptionString, TRUE);
-
- if (OptionString != NULL) {
- FreePool (OptionString);
- }
-
- if (EFI_ERROR (Status)) {
- Repaint = TRUE;
- NewLine = TRUE;
- RefreshKeyHelp (gFormData, Statement, FALSE);
- break;
- } else {
- ControlFlag = CfExit;
+ if (!FormExitPolicy ()) {
+ Repaint = TRUE;
+ NewLine = TRUE;
+ ControlFlag = CfRepaint;
break;
}
- }
- break;
- case CfUiReset:
- //
- // We come here when someone press ESC
- // If the policy is not exit front page when user press ESC, process here.
- //
- if (!FormExitPolicy()) {
- Repaint = TRUE;
- NewLine = TRUE;
- ControlFlag = CfRepaint;
+ gUserInput->Action = BROWSER_ACTION_FORM_EXIT;
+ ControlFlag = CfExit;
break;
- }
- gUserInput->Action = BROWSER_ACTION_FORM_EXIT;
- ControlFlag = CfExit;
- break;
+ case CfUiHotKey:
+ ControlFlag = CfRepaint;
- case CfUiHotKey:
- ControlFlag = CfRepaint;
+ ASSERT (HotKey != NULL);
- ASSERT (HotKey != NULL);
+ if (FxConfirmPopup (HotKey->Action)) {
+ gUserInput->Action = HotKey->Action;
+ if ((HotKey->Action & BROWSER_ACTION_DEFAULT) == BROWSER_ACTION_DEFAULT) {
+ gUserInput->DefaultId = HotKey->DefaultId;
+ }
- if (FxConfirmPopup(HotKey->Action)) {
- gUserInput->Action = HotKey->Action;
- if ((HotKey->Action & BROWSER_ACTION_DEFAULT) == BROWSER_ACTION_DEFAULT) {
- gUserInput->DefaultId = HotKey->DefaultId;
+ ControlFlag = CfExit;
+ } else {
+ Repaint = TRUE;
+ NewLine = TRUE;
+ ControlFlag = CfRepaint;
}
- ControlFlag = CfExit;
- } else {
- Repaint = TRUE;
- NewLine = TRUE;
- ControlFlag = CfRepaint;
- }
- break;
+ break;
- case CfUiLeft:
- ControlFlag = CfRepaint;
- ASSERT(MenuOption != NULL);
- if ((MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_DATE_OP) || (MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TIME_OP)) {
- if (MenuOption->Sequence != 0) {
- //
- // In the middle or tail of the Date/Time op-code set, go left.
- //
- ASSERT(NewPos != NULL);
- NewPos = NewPos->BackLink;
+ case CfUiLeft:
+ ControlFlag = CfRepaint;
+ ASSERT (MenuOption != NULL);
+ if ((MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_DATE_OP) || (MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TIME_OP)) {
+ if (MenuOption->Sequence != 0) {
+ //
+ // In the middle or tail of the Date/Time op-code set, go left.
+ //
+ ASSERT (NewPos != NULL);
+ NewPos = NewPos->BackLink;
+ }
}
- }
- break;
- case CfUiRight:
- ControlFlag = CfRepaint;
- ASSERT(MenuOption != NULL);
- if ((MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_DATE_OP) || (MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TIME_OP)) {
- if (MenuOption->Sequence != 2) {
- //
- // In the middle or tail of the Date/Time op-code set, go left.
- //
- ASSERT(NewPos != NULL);
- NewPos = NewPos->ForwardLink;
+ break;
+
+ case CfUiRight:
+ ControlFlag = CfRepaint;
+ ASSERT (MenuOption != NULL);
+ if ((MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_DATE_OP) || (MenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TIME_OP)) {
+ if (MenuOption->Sequence != 2) {
+ //
+ // In the middle or tail of the Date/Time op-code set, go left.
+ //
+ ASSERT (NewPos != NULL);
+ NewPos = NewPos->ForwardLink;
+ }
}
- }
- break;
- case CfUiUp:
- ControlFlag = CfRepaint;
- NewLine = TRUE;
+ break;
- SavedListEntry = NewPos;
- ASSERT(NewPos != NULL);
+ case CfUiUp:
+ ControlFlag = CfRepaint;
+ NewLine = TRUE;
- MenuOption = MENU_OPTION_FROM_LINK (NewPos);
- ASSERT (MenuOption != NULL);
+ SavedListEntry = NewPos;
+ ASSERT (NewPos != NULL);
- //
- // Adjust Date/Time position before we advance forward.
- //
- AdjustDateAndTimePosition (TRUE, &NewPos);
+ MenuOption = MENU_OPTION_FROM_LINK (NewPos);
+ ASSERT (MenuOption != NULL);
- NewPos = NewPos->BackLink;
- //
- // Find next selectable menu or the first menu beyond current form.
- //
- Difference = MoveToNextStatement (TRUE, &NewPos, MenuOption->Row - TopRow, FALSE);
- if (Difference < 0) {
//
- // We hit the begining MenuOption that can be focused
- // so we simply scroll to the top.
+ // Adjust Date/Time position before we advance forward.
//
- Repaint = TRUE;
- if (TopOfScreen != gMenuOption.ForwardLink || SkipValue != 0) {
- TopOfScreen = gMenuOption.ForwardLink;
- NewPos = SavedListEntry;
- SkipValue = 0;
- } else {
+ AdjustDateAndTimePosition (TRUE, &NewPos);
+
+ NewPos = NewPos->BackLink;
+ //
+ // Find next selectable menu or the first menu beyond current form.
+ //
+ Difference = MoveToNextStatement (TRUE, &NewPos, MenuOption->Row - TopRow, FALSE);
+ if (Difference < 0) {
//
- // Scroll up to the last page when we have arrived at top page.
+ // We hit the begining MenuOption that can be focused
+ // so we simply scroll to the top.
//
- TopOfScreen = FindTopOfScreenMenu (gMenuOption.BackLink, BottomRow - TopRow, &SkipValue);
- NewPos = gMenuOption.BackLink;
- MoveToNextStatement (TRUE, &NewPos, BottomRow - TopRow, TRUE);
- }
- } else {
- NextMenuOption = MENU_OPTION_FROM_LINK (NewPos);
+ Repaint = TRUE;
+ if ((TopOfScreen != gMenuOption.ForwardLink) || (SkipValue != 0)) {
+ TopOfScreen = gMenuOption.ForwardLink;
+ NewPos = SavedListEntry;
+ SkipValue = 0;
+ } else {
+ //
+ // Scroll up to the last page when we have arrived at top page.
+ //
+ TopOfScreen = FindTopOfScreenMenu (gMenuOption.BackLink, BottomRow - TopRow, &SkipValue);
+ NewPos = gMenuOption.BackLink;
+ MoveToNextStatement (TRUE, &NewPos, BottomRow - TopRow, TRUE);
+ }
+ } else {
+ NextMenuOption = MENU_OPTION_FROM_LINK (NewPos);
+
+ if (MenuOption->Row < TopRow + Difference + NextMenuOption->Skip) {
+ //
+ // Previous focus MenuOption is above the TopOfScreen, so we need to scroll
+ //
+ TopOfScreen = NewPos;
+ Repaint = TRUE;
+ SkipValue = 0;
+ }
- if (MenuOption->Row < TopRow + Difference + NextMenuOption->Skip) {
//
- // Previous focus MenuOption is above the TopOfScreen, so we need to scroll
+ // Check whether new highlight menu is selectable, if not, keep highlight on the old one.
//
- TopOfScreen = NewPos;
- Repaint = TRUE;
- SkipValue = 0;
+ // BottomRow - TopRow + 1 means the total rows current forms supported.
+ // Difference + NextMenuOption->Skip + 1 means the distance between last highlight menu
+ // and new top menu. New top menu will all shows in next form, but last highlight menu
+ // may only shows 1 line. + 1 at right part means at least need to keep 1 line for the
+ // last highlight menu.
+ //
+ if (!IsSelectable (NextMenuOption) && IsSelectable (MenuOption) &&
+ (BottomRow - TopRow + 1 >= Difference + NextMenuOption->Skip + 1))
+ {
+ NewPos = SavedListEntry;
+ }
}
+ UpdateStatusBar (INPUT_ERROR, FALSE);
+
//
- // Check whether new highlight menu is selectable, if not, keep highlight on the old one.
+ // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
//
- // BottomRow - TopRow + 1 means the total rows current forms supported.
- // Difference + NextMenuOption->Skip + 1 means the distance between last highlight menu
- // and new top menu. New top menu will all shows in next form, but last highlight menu
- // may only shows 1 line. + 1 at right part means at least need to keep 1 line for the
- // last highlight menu.
- //
- if (!IsSelectable(NextMenuOption) && IsSelectable(MenuOption) &&
- (BottomRow - TopRow + 1 >= Difference + NextMenuOption->Skip + 1)) {
- NewPos = SavedListEntry;
- }
- }
-
- UpdateStatusBar (INPUT_ERROR, FALSE);
-
- //
- // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
- //
- AdjustDateAndTimePosition (TRUE, &TopOfScreen);
- AdjustDateAndTimePosition (TRUE, &NewPos);
-
- UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);
- break;
+ AdjustDateAndTimePosition (TRUE, &TopOfScreen);
+ AdjustDateAndTimePosition (TRUE, &NewPos);
- case CfUiPageUp:
- //
- // SkipValue means lines is skipped when show the top menu option.
- //
- ControlFlag = CfRepaint;
- NewLine = TRUE;
- Repaint = TRUE;
+ UpdateHighlightMenuInfo (NewPos, TopOfScreen, SkipValue);
+ break;
- Link = TopOfScreen;
- //
- // First minus the menu of the top screen, it's value is SkipValue.
- //
- if (SkipValue >= BottomRow - TopRow + 1) {
+ case CfUiPageUp:
//
- // SkipValue > (BottomRow - TopRow + 1) means current menu has more than one
- // form of options to be show, so just update the SkipValue to show the next
- // parts of options.
+ // SkipValue means lines is skipped when show the top menu option.
//
- SkipValue -= BottomRow - TopRow + 1;
- NewPos = TopOfScreen;
- break;
- } else {
- Index = (BottomRow + 1) - SkipValue - TopRow;
- }
-
- TopOfScreen = FindTopOfScreenMenu(TopOfScreen, Index, &SkipValue);
- NewPos = TopOfScreen;
- MoveToNextStatement (FALSE, &NewPos, BottomRow - TopRow, FALSE);
+ ControlFlag = CfRepaint;
+ NewLine = TRUE;
+ Repaint = TRUE;
- UpdateStatusBar (INPUT_ERROR, FALSE);
+ Link = TopOfScreen;
+ //
+ // First minus the menu of the top screen, it's value is SkipValue.
+ //
+ if (SkipValue >= BottomRow - TopRow + 1) {
+ //
+ // SkipValue > (BottomRow - TopRow + 1) means current menu has more than one
+ // form of options to be show, so just update the SkipValue to show the next
+ // parts of options.
+ //
+ SkipValue -= BottomRow - TopRow + 1;
+ NewPos = TopOfScreen;
+ break;
+ } else {
+ Index = (BottomRow + 1) - SkipValue - TopRow;
+ }
- //
- // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
- // Don't do this when we are already in the first page.
- //
- AdjustDateAndTimePosition (TRUE, &TopOfScreen);
- AdjustDateAndTimePosition (TRUE, &NewPos);
+ TopOfScreen = FindTopOfScreenMenu (TopOfScreen, Index, &SkipValue);
+ NewPos = TopOfScreen;
+ MoveToNextStatement (FALSE, &NewPos, BottomRow - TopRow, FALSE);
- UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);
- break;
+ UpdateStatusBar (INPUT_ERROR, FALSE);
- case CfUiPageDown:
- //
- // SkipValue means lines is skipped when show the top menu option.
- //
- ControlFlag = CfRepaint;
- NewLine = TRUE;
- Repaint = TRUE;
+ //
+ // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
+ // Don't do this when we are already in the first page.
+ //
+ AdjustDateAndTimePosition (TRUE, &TopOfScreen);
+ AdjustDateAndTimePosition (TRUE, &NewPos);
- Link = TopOfScreen;
- NextMenuOption = MENU_OPTION_FROM_LINK (Link);
- Index = TopRow + NextMenuOption->Skip - SkipValue;
- //
- // Count to the menu option which will show at the top of the next form.
- //
- while ((Index <= BottomRow + 1) && (Link->ForwardLink != &gMenuOption)) {
- Link = Link->ForwardLink;
- NextMenuOption = MENU_OPTION_FROM_LINK (Link);
- Index = Index + NextMenuOption->Skip;
- }
+ UpdateHighlightMenuInfo (NewPos, TopOfScreen, SkipValue);
+ break;
- if ((Link->ForwardLink == &gMenuOption) && (Index <= BottomRow + 1)) {
+ case CfUiPageDown:
//
- // Highlight on the last menu which can be highlight.
+ // SkipValue means lines is skipped when show the top menu option.
//
- Repaint = FALSE;
- MoveToNextStatement (TRUE, &Link, Index - TopRow, TRUE);
- } else {
+ ControlFlag = CfRepaint;
+ NewLine = TRUE;
+ Repaint = TRUE;
+
+ Link = TopOfScreen;
+ NextMenuOption = MENU_OPTION_FROM_LINK (Link);
+ Index = TopRow + NextMenuOption->Skip - SkipValue;
//
- // Calculate the skip line for top of screen menu.
+ // Count to the menu option which will show at the top of the next form.
//
- if (Link == TopOfScreen) {
+ while ((Index <= BottomRow + 1) && (Link->ForwardLink != &gMenuOption)) {
+ Link = Link->ForwardLink;
+ NextMenuOption = MENU_OPTION_FROM_LINK (Link);
+ Index = Index + NextMenuOption->Skip;
+ }
+
+ if ((Link->ForwardLink == &gMenuOption) && (Index <= BottomRow + 1)) {
//
- // The top of screen menu option occupies the entire form.
+ // Highlight on the last menu which can be highlight.
//
- SkipValue += BottomRow - TopRow + 1;
+ Repaint = FALSE;
+ MoveToNextStatement (TRUE, &Link, Index - TopRow, TRUE);
} else {
- SkipValue = NextMenuOption->Skip - (Index - (BottomRow + 1));
+ //
+ // Calculate the skip line for top of screen menu.
+ //
+ if (Link == TopOfScreen) {
+ //
+ // The top of screen menu option occupies the entire form.
+ //
+ SkipValue += BottomRow - TopRow + 1;
+ } else {
+ SkipValue = NextMenuOption->Skip - (Index - (BottomRow + 1));
+ }
+
+ TopOfScreen = Link;
+ MenuOption = NULL;
+ //
+ // Move to the Next selectable menu.
+ //
+ MoveToNextStatement (FALSE, &Link, BottomRow - TopRow, TRUE);
}
- TopOfScreen = Link;
- MenuOption = NULL;
+
//
- // Move to the Next selectable menu.
+ // Save the menu as the next highlight menu.
//
- MoveToNextStatement (FALSE, &Link, BottomRow - TopRow, TRUE);
- }
+ NewPos = Link;
- //
- // Save the menu as the next highlight menu.
- //
- NewPos = Link;
-
- UpdateStatusBar (INPUT_ERROR, FALSE);
-
- //
- // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
- // Don't do this when we are already in the last page.
- //
- AdjustDateAndTimePosition (TRUE, &TopOfScreen);
- AdjustDateAndTimePosition (TRUE, &NewPos);
+ UpdateStatusBar (INPUT_ERROR, FALSE);
- UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);
- break;
-
- case CfUiDown:
- //
- // SkipValue means lines is skipped when show the top menu option.
- // NewPos points to the menu which is highlighted now.
- //
- ControlFlag = CfRepaint;
- NewLine = TRUE;
+ //
+ // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
+ // Don't do this when we are already in the last page.
+ //
+ AdjustDateAndTimePosition (TRUE, &TopOfScreen);
+ AdjustDateAndTimePosition (TRUE, &NewPos);
- if (NewPos == TopOfScreen) {
- Temp2 = SkipValue;
- } else {
- Temp2 = 0;
- }
+ UpdateHighlightMenuInfo (NewPos, TopOfScreen, SkipValue);
+ break;
- SavedListEntry = NewPos;
- //
- // Since the behavior of hitting the down arrow on a Date/Time op-code is intended
- // to be one that progresses to the next set of op-codes, we need to advance to the last
- // Date/Time op-code and leave the remaining logic in UiDown intact so the appropriate
- // checking can be done. The only other logic we need to introduce is that if a Date/Time
- // op-code is the last entry in the menu, we need to rewind back to the first op-code of
- // the Date/Time op-code.
- //
- AdjustDateAndTimePosition (FALSE, &NewPos);
+ case CfUiDown:
+ //
+ // SkipValue means lines is skipped when show the top menu option.
+ // NewPos points to the menu which is highlighted now.
+ //
+ ControlFlag = CfRepaint;
+ NewLine = TRUE;
- MenuOption = MENU_OPTION_FROM_LINK (NewPos);
- NewPos = NewPos->ForwardLink;
- //
- // Find the next selectable menu.
- //
- if (MenuOption->Row + MenuOption->Skip - Temp2 > BottomRow + 1) {
- if (gMenuOption.ForwardLink == NewPos || &gMenuOption == NewPos) {
- Difference = -1;
+ if (NewPos == TopOfScreen) {
+ Temp2 = SkipValue;
} else {
- Difference = 0;
+ Temp2 = 0;
}
- } else {
- Difference = MoveToNextStatement (FALSE, &NewPos, BottomRow + 1 - (MenuOption->Row + MenuOption->Skip - Temp2), FALSE);
- }
- if (Difference < 0) {
+
+ SavedListEntry = NewPos;
//
- // Scroll to the first page.
+ // Since the behavior of hitting the down arrow on a Date/Time op-code is intended
+ // to be one that progresses to the next set of op-codes, we need to advance to the last
+ // Date/Time op-code and leave the remaining logic in UiDown intact so the appropriate
+ // checking can be done. The only other logic we need to introduce is that if a Date/Time
+ // op-code is the last entry in the menu, we need to rewind back to the first op-code of
+ // the Date/Time op-code.
//
- if (TopOfScreen != gMenuOption.ForwardLink || SkipValue != 0) {
- TopOfScreen = gMenuOption.ForwardLink;
- Repaint = TRUE;
- MenuOption = NULL;
- } else {
- MenuOption = MENU_OPTION_FROM_LINK (SavedListEntry);
- }
- NewPos = gMenuOption.ForwardLink;
- MoveToNextStatement (FALSE, &NewPos, BottomRow - TopRow, TRUE);
+ AdjustDateAndTimePosition (FALSE, &NewPos);
- SkipValue = 0;
+ MenuOption = MENU_OPTION_FROM_LINK (NewPos);
+ NewPos = NewPos->ForwardLink;
//
- // If we are at the end of the list and sitting on a Date/Time op, rewind to the head.
+ // Find the next selectable menu.
//
- AdjustDateAndTimePosition (TRUE, &TopOfScreen);
- AdjustDateAndTimePosition (TRUE, &NewPos);
+ if (MenuOption->Row + MenuOption->Skip - Temp2 > BottomRow + 1) {
+ if ((gMenuOption.ForwardLink == NewPos) || (&gMenuOption == NewPos)) {
+ Difference = -1;
+ } else {
+ Difference = 0;
+ }
+ } else {
+ Difference = MoveToNextStatement (FALSE, &NewPos, BottomRow + 1 - (MenuOption->Row + MenuOption->Skip - Temp2), FALSE);
+ }
- UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);
- break;
- }
+ if (Difference < 0) {
+ //
+ // Scroll to the first page.
+ //
+ if ((TopOfScreen != gMenuOption.ForwardLink) || (SkipValue != 0)) {
+ TopOfScreen = gMenuOption.ForwardLink;
+ Repaint = TRUE;
+ MenuOption = NULL;
+ } else {
+ MenuOption = MENU_OPTION_FROM_LINK (SavedListEntry);
+ }
- //
- // Get next selected menu info.
- //
- AdjustDateAndTimePosition (FALSE, &NewPos);
- NextMenuOption = MENU_OPTION_FROM_LINK (NewPos);
- if (NextMenuOption->Row == 0) {
- UpdateOptionSkipLines (NextMenuOption);
- }
+ NewPos = gMenuOption.ForwardLink;
+ MoveToNextStatement (FALSE, &NewPos, BottomRow - TopRow, TRUE);
+
+ SkipValue = 0;
+ //
+ // If we are at the end of the list and sitting on a Date/Time op, rewind to the head.
+ //
+ AdjustDateAndTimePosition (TRUE, &TopOfScreen);
+ AdjustDateAndTimePosition (TRUE, &NewPos);
+
+ UpdateHighlightMenuInfo (NewPos, TopOfScreen, SkipValue);
+ break;
+ }
- //
- // Calculate new highlight menu end row.
- //
- Temp = (MenuOption->Row + MenuOption->Skip - Temp2) + Difference + NextMenuOption->Skip - 1;
- if (Temp > BottomRow) {
//
- // Get the top screen menu info.
+ // Get next selected menu info.
//
- AdjustDateAndTimePosition (FALSE, &TopOfScreen);
- SavedMenuOption = MENU_OPTION_FROM_LINK (TopOfScreen);
+ AdjustDateAndTimePosition (FALSE, &NewPos);
+ NextMenuOption = MENU_OPTION_FROM_LINK (NewPos);
+ if (NextMenuOption->Row == 0) {
+ UpdateOptionSkipLines (NextMenuOption);
+ }
//
- // Current Top screen menu occupy (SavedMenuOption->Skip - SkipValue) rows.
- // Full shows the new selected menu need to skip (Temp - BottomRow - 1) rows.
+ // Calculate new highlight menu end row.
//
- if ((Temp - BottomRow) >= (SavedMenuOption->Skip - SkipValue)) {
+ Temp = (MenuOption->Row + MenuOption->Skip - Temp2) + Difference + NextMenuOption->Skip - 1;
+ if (Temp > BottomRow) {
//
- // Skip the top op-code
+ // Get the top screen menu info.
//
- TopOfScreen = TopOfScreen->ForwardLink;
- DistanceValue = (Temp - BottomRow) - (SavedMenuOption->Skip - SkipValue);
-
+ AdjustDateAndTimePosition (FALSE, &TopOfScreen);
SavedMenuOption = MENU_OPTION_FROM_LINK (TopOfScreen);
//
- // If we have a remainder, skip that many more op-codes until we drain the remainder
- // Special case is the selected highlight menu has more than one form of menus.
+ // Current Top screen menu occupy (SavedMenuOption->Skip - SkipValue) rows.
+ // Full shows the new selected menu need to skip (Temp - BottomRow - 1) rows.
//
- while (DistanceValue >= SavedMenuOption->Skip && TopOfScreen != NewPos) {
+ if ((Temp - BottomRow) >= (SavedMenuOption->Skip - SkipValue)) {
//
- // Since the Difference is greater than or equal to this op-code's skip value, skip it
+ // Skip the top op-code
//
- DistanceValue = DistanceValue - (INTN) SavedMenuOption->Skip;
- TopOfScreen = TopOfScreen->ForwardLink;
+ TopOfScreen = TopOfScreen->ForwardLink;
+ DistanceValue = (Temp - BottomRow) - (SavedMenuOption->Skip - SkipValue);
+
SavedMenuOption = MENU_OPTION_FROM_LINK (TopOfScreen);
- }
- //
- // Since we will act on this op-code in the next routine, and increment the
- // SkipValue, set the skips to one less than what is required.
- //
- if (TopOfScreen != NewPos) {
- SkipValue = DistanceValue;
+
+ //
+ // If we have a remainder, skip that many more op-codes until we drain the remainder
+ // Special case is the selected highlight menu has more than one form of menus.
+ //
+ while (DistanceValue >= SavedMenuOption->Skip && TopOfScreen != NewPos) {
+ //
+ // Since the Difference is greater than or equal to this op-code's skip value, skip it
+ //
+ DistanceValue = DistanceValue - (INTN)SavedMenuOption->Skip;
+ TopOfScreen = TopOfScreen->ForwardLink;
+ SavedMenuOption = MENU_OPTION_FROM_LINK (TopOfScreen);
+ }
+
+ //
+ // Since we will act on this op-code in the next routine, and increment the
+ // SkipValue, set the skips to one less than what is required.
+ //
+ if (TopOfScreen != NewPos) {
+ SkipValue = DistanceValue;
+ } else {
+ SkipValue = 0;
+ }
} else {
- SkipValue = 0;
+ //
+ // Since we will act on this op-code in the next routine, and increment the
+ // SkipValue, set the skips to one less than what is required.
+ //
+ SkipValue += Temp - BottomRow;
}
- } else {
+
+ Repaint = TRUE;
+ } else if (!IsSelectable (NextMenuOption)) {
//
- // Since we will act on this op-code in the next routine, and increment the
- // SkipValue, set the skips to one less than what is required.
+ // Continue to go down until scroll to next page or the selectable option is found.
//
- SkipValue += Temp - BottomRow;
+ ScreenOperation = UiDown;
+ ControlFlag = CfScreenOperation;
+ break;
}
- Repaint = TRUE;
- } else if (!IsSelectable (NextMenuOption)) {
+
+ MenuOption = MENU_OPTION_FROM_LINK (SavedListEntry);
+
//
- // Continue to go down until scroll to next page or the selectable option is found.
+ // Check whether new highlight menu is selectable, if not, keep highlight on the old one.
//
- ScreenOperation = UiDown;
- ControlFlag = CfScreenOperation;
- break;
- }
+ // BottomRow - TopRow + 1 means the total rows current forms supported.
+ // Difference + NextMenuOption->Skip + 1 means the distance between last highlight menu
+ // and new top menu. New top menu will all shows in next form, but last highlight menu
+ // may only shows 1 line. + 1 at right part means at least need to keep 1 line for the
+ // last highlight menu.
+ //
+ if (!IsSelectable (NextMenuOption) && IsSelectable (MenuOption) &&
+ (BottomRow - TopRow + 1 >= Difference + NextMenuOption->Skip + 1))
+ {
+ NewPos = SavedListEntry;
+ }
- MenuOption = MENU_OPTION_FROM_LINK (SavedListEntry);
+ UpdateStatusBar (INPUT_ERROR, FALSE);
- //
- // Check whether new highlight menu is selectable, if not, keep highlight on the old one.
- //
- // BottomRow - TopRow + 1 means the total rows current forms supported.
- // Difference + NextMenuOption->Skip + 1 means the distance between last highlight menu
- // and new top menu. New top menu will all shows in next form, but last highlight menu
- // may only shows 1 line. + 1 at right part means at least need to keep 1 line for the
- // last highlight menu.
- //
- if (!IsSelectable (NextMenuOption) && IsSelectable (MenuOption) &&
- (BottomRow - TopRow + 1 >= Difference + NextMenuOption->Skip + 1)) {
- NewPos = SavedListEntry;
- }
+ //
+ // If we are at the end of the list and sitting on a Date/Time op, rewind to the head.
+ //
+ AdjustDateAndTimePosition (TRUE, &TopOfScreen);
+ AdjustDateAndTimePosition (TRUE, &NewPos);
- UpdateStatusBar (INPUT_ERROR, FALSE);
+ UpdateHighlightMenuInfo (NewPos, TopOfScreen, SkipValue);
+ break;
- //
- // If we are at the end of the list and sitting on a Date/Time op, rewind to the head.
- //
- AdjustDateAndTimePosition (TRUE, &TopOfScreen);
- AdjustDateAndTimePosition (TRUE, &NewPos);
+ case CfUiNoOperation:
+ ControlFlag = CfRepaint;
+ break;
- UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);
- break;
+ case CfExit:
+ gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
+ if (HelpString != NULL) {
+ FreePool (HelpString);
+ }
- case CfUiNoOperation:
- ControlFlag = CfRepaint;
- break;
+ if (HelpHeaderString != NULL) {
+ FreePool (HelpHeaderString);
+ }
- case CfExit:
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- if (HelpString != NULL) {
- FreePool (HelpString);
- }
- if (HelpHeaderString != NULL) {
- FreePool (HelpHeaderString);
- }
- if (HelpBottomString != NULL) {
- FreePool (HelpBottomString);
- }
- return EFI_SUCCESS;
+ if (HelpBottomString != NULL) {
+ FreePool (HelpBottomString);
+ }
- default:
- break;
+ return EFI_SUCCESS;
+
+ default:
+ break;
}
}
}
@@ -3806,22 +3878,23 @@ UiDisplayMenu (
**/
VOID
-FreeMenuOptionData(
- LIST_ENTRY *MenuOptionList
+FreeMenuOptionData (
+ LIST_ENTRY *MenuOptionList
)
{
- LIST_ENTRY *Link;
- UI_MENU_OPTION *Option;
+ LIST_ENTRY *Link;
+ UI_MENU_OPTION *Option;
//
// Free menu option list
//
while (!IsListEmpty (MenuOptionList)) {
- Link = GetFirstNode (MenuOptionList);
+ Link = GetFirstNode (MenuOptionList);
Option = MENU_OPTION_FROM_LINK (Link);
- if (Option->Description != NULL){
- FreePool(Option->Description);
+ if (Option->Description != NULL) {
+ FreePool (Option->Description);
}
+
RemoveEntryList (&Option->Link);
FreePool (Option);
}
@@ -3837,20 +3910,20 @@ BrowserStatusProcess (
VOID
)
{
- CHAR16 *ErrorInfo;
- EFI_INPUT_KEY Key;
- EFI_EVENT WaitList[2];
- EFI_EVENT RefreshIntervalEvent;
- EFI_EVENT TimeOutEvent;
- UINT8 TimeOut;
- EFI_STATUS Status;
- UINTN Index;
- WARNING_IF_CONTEXT EventContext;
- EFI_IFR_OP_HEADER *OpCodeBuf;
- EFI_STRING_ID StringToken;
- CHAR16 DiscardChange;
- CHAR16 JumpToFormSet;
- CHAR16 *PrintString;
+ CHAR16 *ErrorInfo;
+ EFI_INPUT_KEY Key;
+ EFI_EVENT WaitList[2];
+ EFI_EVENT RefreshIntervalEvent;
+ EFI_EVENT TimeOutEvent;
+ UINT8 TimeOut;
+ EFI_STATUS Status;
+ UINTN Index;
+ WARNING_IF_CONTEXT EventContext;
+ EFI_IFR_OP_HEADER *OpCodeBuf;
+ EFI_STRING_ID StringToken;
+ CHAR16 DiscardChange;
+ CHAR16 JumpToFormSet;
+ CHAR16 *PrintString;
if (gFormData->BrowserStatus == BROWSER_SUCCESS) {
return;
@@ -3867,16 +3940,18 @@ BrowserStatusProcess (
if (gFormData->BrowserStatus == (BROWSER_WARNING_IF)) {
ASSERT (OpCodeBuf != NULL && OpCodeBuf->OpCode == EFI_IFR_WARNING_IF_OP);
- TimeOut = ((EFI_IFR_WARNING_IF *) OpCodeBuf)->TimeOut;
- StringToken = ((EFI_IFR_WARNING_IF *) OpCodeBuf)->Warning;
+ TimeOut = ((EFI_IFR_WARNING_IF *)OpCodeBuf)->TimeOut;
+ StringToken = ((EFI_IFR_WARNING_IF *)OpCodeBuf)->Warning;
} else {
TimeOut = 0;
if ((gFormData->BrowserStatus == (BROWSER_NO_SUBMIT_IF)) &&
- (OpCodeBuf != NULL && OpCodeBuf->OpCode == EFI_IFR_NO_SUBMIT_IF_OP)) {
- StringToken = ((EFI_IFR_NO_SUBMIT_IF *) OpCodeBuf)->Error;
+ ((OpCodeBuf != NULL) && (OpCodeBuf->OpCode == EFI_IFR_NO_SUBMIT_IF_OP)))
+ {
+ StringToken = ((EFI_IFR_NO_SUBMIT_IF *)OpCodeBuf)->Error;
} else if ((gFormData->BrowserStatus == (BROWSER_INCONSISTENT_IF)) &&
- (OpCodeBuf != NULL && OpCodeBuf->OpCode == EFI_IFR_INCONSISTENT_IF_OP)) {
- StringToken = ((EFI_IFR_INCONSISTENT_IF *) OpCodeBuf)->Error;
+ ((OpCodeBuf != NULL) && (OpCodeBuf->OpCode == EFI_IFR_INCONSISTENT_IF_OP)))
+ {
+ StringToken = ((EFI_IFR_INCONSISTENT_IF *)OpCodeBuf)->Error;
}
}
@@ -3890,127 +3965,129 @@ BrowserStatusProcess (
ErrorInfo = gFormData->ErrorString;
} else {
switch (gFormData->BrowserStatus) {
- case BROWSER_SUBMIT_FAIL:
- ErrorInfo = gSaveFailed;
- break;
+ case BROWSER_SUBMIT_FAIL:
+ ErrorInfo = gSaveFailed;
+ break;
- case BROWSER_FORM_NOT_FOUND:
- ErrorInfo = gFormNotFound;
- break;
+ case BROWSER_FORM_NOT_FOUND:
+ ErrorInfo = gFormNotFound;
+ break;
- case BROWSER_FORM_SUPPRESS:
- ErrorInfo = gFormSuppress;
- break;
+ case BROWSER_FORM_SUPPRESS:
+ ErrorInfo = gFormSuppress;
+ break;
- case BROWSER_PROTOCOL_NOT_FOUND:
- ErrorInfo = gProtocolNotFound;
- break;
+ case BROWSER_PROTOCOL_NOT_FOUND:
+ ErrorInfo = gProtocolNotFound;
+ break;
- case BROWSER_SUBMIT_FAIL_NO_SUBMIT_IF:
- ErrorInfo = gNoSubmitIfFailed;
- break;
+ case BROWSER_SUBMIT_FAIL_NO_SUBMIT_IF:
+ ErrorInfo = gNoSubmitIfFailed;
+ break;
- case BROWSER_RECONNECT_FAIL:
- ErrorInfo = gReconnectFail;
- break;
+ case BROWSER_RECONNECT_FAIL:
+ ErrorInfo = gReconnectFail;
+ break;
- case BROWSER_RECONNECT_SAVE_CHANGES:
- ErrorInfo = gReconnectConfirmChanges;
- break;
+ case BROWSER_RECONNECT_SAVE_CHANGES:
+ ErrorInfo = gReconnectConfirmChanges;
+ break;
- case BROWSER_RECONNECT_REQUIRED:
- ErrorInfo = gReconnectRequired;
- break;
+ case BROWSER_RECONNECT_REQUIRED:
+ ErrorInfo = gReconnectRequired;
+ break;
- default:
- ErrorInfo = gBrowserError;
- break;
+ default:
+ ErrorInfo = gBrowserError;
+ break;
}
}
switch (gFormData->BrowserStatus) {
- case BROWSER_SUBMIT_FAIL:
- case BROWSER_SUBMIT_FAIL_NO_SUBMIT_IF:
- case BROWSER_RECONNECT_SAVE_CHANGES:
- ASSERT (gUserInput != NULL);
- if (gFormData->BrowserStatus == (BROWSER_SUBMIT_FAIL)) {
- PrintString = gSaveProcess;
- JumpToFormSet = gJumpToFormSet[0];
- DiscardChange = gDiscardChange[0];
- } else if (gFormData->BrowserStatus == (BROWSER_RECONNECT_SAVE_CHANGES)){
- PrintString = gChangesOpt;
- JumpToFormSet = gConfirmOptYes[0];
- DiscardChange = gConfirmOptNo[0];
- } else {
- PrintString = gSaveNoSubmitProcess;
- JumpToFormSet = gCheckError[0];
- DiscardChange = gDiscardChange[0];
- }
+ case BROWSER_SUBMIT_FAIL:
+ case BROWSER_SUBMIT_FAIL_NO_SUBMIT_IF:
+ case BROWSER_RECONNECT_SAVE_CHANGES:
+ ASSERT (gUserInput != NULL);
+ if (gFormData->BrowserStatus == (BROWSER_SUBMIT_FAIL)) {
+ PrintString = gSaveProcess;
+ JumpToFormSet = gJumpToFormSet[0];
+ DiscardChange = gDiscardChange[0];
+ } else if (gFormData->BrowserStatus == (BROWSER_RECONNECT_SAVE_CHANGES)) {
+ PrintString = gChangesOpt;
+ JumpToFormSet = gConfirmOptYes[0];
+ DiscardChange = gConfirmOptNo[0];
+ } else {
+ PrintString = gSaveNoSubmitProcess;
+ JumpToFormSet = gCheckError[0];
+ DiscardChange = gDiscardChange[0];
+ }
- do {
- CreateDialog (&Key, gEmptyString, ErrorInfo, PrintString, gEmptyString, NULL);
- } while (((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (DiscardChange | UPPER_LOWER_CASE_OFFSET)) &&
- ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (JumpToFormSet | UPPER_LOWER_CASE_OFFSET)));
+ do {
+ CreateDialog (&Key, gEmptyString, ErrorInfo, PrintString, gEmptyString, NULL);
+ } while (((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (DiscardChange | UPPER_LOWER_CASE_OFFSET)) &&
+ ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (JumpToFormSet | UPPER_LOWER_CASE_OFFSET)));
- if ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (DiscardChange | UPPER_LOWER_CASE_OFFSET)) {
- gUserInput->Action = BROWSER_ACTION_DISCARD;
- } else {
- gUserInput->Action = BROWSER_ACTION_GOTO;
- }
- break;
+ if ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (DiscardChange | UPPER_LOWER_CASE_OFFSET)) {
+ gUserInput->Action = BROWSER_ACTION_DISCARD;
+ } else {
+ gUserInput->Action = BROWSER_ACTION_GOTO;
+ }
- default:
- if (TimeOut == 0) {
- do {
- CreateDialog (&Key, gEmptyString, ErrorInfo, gPressEnter, gEmptyString, NULL);
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- } else {
- Status = gBS->CreateEvent (EVT_NOTIFY_WAIT, TPL_CALLBACK, EmptyEventProcess, NULL, &TimeOutEvent);
- ASSERT_EFI_ERROR (Status);
+ break;
+
+ default:
+ if (TimeOut == 0) {
+ do {
+ CreateDialog (&Key, gEmptyString, ErrorInfo, gPressEnter, gEmptyString, NULL);
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ } else {
+ Status = gBS->CreateEvent (EVT_NOTIFY_WAIT, TPL_CALLBACK, EmptyEventProcess, NULL, &TimeOutEvent);
+ ASSERT_EFI_ERROR (Status);
- EventContext.SyncEvent = TimeOutEvent;
- EventContext.TimeOut = &TimeOut;
- EventContext.ErrorInfo = ErrorInfo;
+ EventContext.SyncEvent = TimeOutEvent;
+ EventContext.TimeOut = &TimeOut;
+ EventContext.ErrorInfo = ErrorInfo;
- Status = gBS->CreateEvent (EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_CALLBACK, RefreshTimeOutProcess, &EventContext, &RefreshIntervalEvent);
- ASSERT_EFI_ERROR (Status);
+ Status = gBS->CreateEvent (EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_CALLBACK, RefreshTimeOutProcess, &EventContext, &RefreshIntervalEvent);
+ ASSERT_EFI_ERROR (Status);
- //
- // Show the dialog first to avoid long time not reaction.
- //
- gBS->SignalEvent (RefreshIntervalEvent);
+ //
+ // Show the dialog first to avoid long time not reaction.
+ //
+ gBS->SignalEvent (RefreshIntervalEvent);
- Status = gBS->SetTimer (RefreshIntervalEvent, TimerPeriodic, ONE_SECOND);
- ASSERT_EFI_ERROR (Status);
+ Status = gBS->SetTimer (RefreshIntervalEvent, TimerPeriodic, ONE_SECOND);
+ ASSERT_EFI_ERROR (Status);
- while (TRUE) {
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (!EFI_ERROR (Status) && Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
- break;
- }
+ while (TRUE) {
+ Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+ if (!EFI_ERROR (Status) && (Key.UnicodeChar == CHAR_CARRIAGE_RETURN)) {
+ break;
+ }
- if (Status != EFI_NOT_READY) {
- continue;
- }
+ if (Status != EFI_NOT_READY) {
+ continue;
+ }
- WaitList[0] = TimeOutEvent;
- WaitList[1] = gST->ConIn->WaitForKey;
+ WaitList[0] = TimeOutEvent;
+ WaitList[1] = gST->ConIn->WaitForKey;
- Status = gBS->WaitForEvent (2, WaitList, &Index);
- ASSERT_EFI_ERROR (Status);
+ Status = gBS->WaitForEvent (2, WaitList, &Index);
+ ASSERT_EFI_ERROR (Status);
- if (Index == 0) {
- //
- // Timeout occur, close the hoot time out event.
- //
- break;
+ if (Index == 0) {
+ //
+ // Timeout occur, close the hoot time out event.
+ //
+ break;
+ }
}
+
+ gBS->CloseEvent (TimeOutEvent);
+ gBS->CloseEvent (RefreshIntervalEvent);
}
- gBS->CloseEvent (TimeOutEvent);
- gBS->CloseEvent (RefreshIntervalEvent);
- }
- break;
+ break;
}
if (StringToken != 0) {
@@ -4049,7 +4126,7 @@ FormDisplay (
//
// Process the status info first.
//
- BrowserStatusProcess();
+ BrowserStatusProcess ();
if (gFormData->BrowserStatus != BROWSER_SUCCESS) {
//
// gFormData->BrowserStatus != BROWSER_SUCCESS, means only need to print the error info, return here.
@@ -4071,25 +4148,26 @@ FormDisplay (
// |<-.->|<-.........->|<- .........->|<-...........->|
// Skip Prompt Option Help
//
- gOptionBlockWidth = (CHAR16) ((gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn) / 3) + 1;
- gHelpBlockWidth = (CHAR16) (gOptionBlockWidth - 1 - LEFT_SKIPPED_COLUMNS);
- gPromptBlockWidth = (CHAR16) (gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - 2 * (gOptionBlockWidth - 1) - 1);
+ gOptionBlockWidth = (CHAR16)((gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn) / 3) + 1;
+ gHelpBlockWidth = (CHAR16)(gOptionBlockWidth - 1 - LEFT_SKIPPED_COLUMNS);
+ gPromptBlockWidth = (CHAR16)(gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - 2 * (gOptionBlockWidth - 1) - 1);
- ConvertStatementToMenu();
+ ConvertStatementToMenu ();
//
// Check whether layout is changed.
//
- if (mIsFirstForm
- || (gOldFormEntry.HiiHandle != FormData->HiiHandle)
- || (!CompareGuid (&gOldFormEntry.FormSetGuid, &FormData->FormSetGuid))
- || (gOldFormEntry.FormId != FormData->FormId)) {
+ if ( mIsFirstForm
+ || (gOldFormEntry.HiiHandle != FormData->HiiHandle)
+ || (!CompareGuid (&gOldFormEntry.FormSetGuid, &FormData->FormSetGuid))
+ || (gOldFormEntry.FormId != FormData->FormId))
+ {
mStatementLayoutIsChanged = TRUE;
} else {
mStatementLayoutIsChanged = FALSE;
}
- Status = UiDisplayMenu(FormData);
+ Status = UiDisplayMenu (FormData);
//
// Backup last form info.
@@ -4097,12 +4175,12 @@ FormDisplay (
mIsFirstForm = FALSE;
gOldFormEntry.HiiHandle = FormData->HiiHandle;
CopyGuid (&gOldFormEntry.FormSetGuid, &FormData->FormSetGuid);
- gOldFormEntry.FormId = FormData->FormId;
+ gOldFormEntry.FormId = FormData->FormId;
//
- //Free the Ui menu option list.
+ // Free the Ui menu option list.
//
- FreeMenuOptionData(&gMenuOption);
+ FreeMenuOptionData (&gMenuOption);
return Status;
}
@@ -4130,9 +4208,9 @@ DriverClearDisplayPage (
**/
VOID
SetUnicodeMem (
- IN VOID *Buffer,
- IN UINTN Size,
- IN CHAR16 Value
+ IN VOID *Buffer,
+ IN UINTN Size,
+ IN CHAR16 Value
)
{
CHAR16 *Ptr;
@@ -4156,14 +4234,14 @@ SetUnicodeMem (
EFI_STATUS
EFIAPI
InitializeDisplayEngine (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- EFI_INPUT_KEY HotKey;
- EFI_STRING NewString;
- EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2;
+ EFI_STATUS Status;
+ EFI_INPUT_KEY HotKey;
+ EFI_STRING NewString;
+ EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2;
//
// Publish our HII data
@@ -4191,14 +4269,14 @@ InitializeDisplayEngine (
// Install HII Popup Protocol.
//
Status = gBS->InstallProtocolInterface (
- &mPrivateData.Handle,
- &gEfiHiiPopupProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mPrivateData.HiiPopup
- );
+ &mPrivateData.Handle,
+ &gEfiHiiPopupProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mPrivateData.HiiPopup
+ );
ASSERT_EFI_ERROR (Status);
- InitializeDisplayStrings();
+ InitializeDisplayStrings ();
ZeroMem (&gHighligthMenuInfo, sizeof (gHighligthMenuInfo));
ZeroMem (&gOldFormEntry, sizeof (gOldFormEntry));
@@ -4206,20 +4284,20 @@ InitializeDisplayEngine (
//
// Use BrowserEx2 protocol to register HotKey.
//
- Status = gBS->LocateProtocol (&gEdkiiFormBrowserEx2ProtocolGuid, NULL, (VOID **) &FormBrowserEx2);
+ Status = gBS->LocateProtocol (&gEdkiiFormBrowserEx2ProtocolGuid, NULL, (VOID **)&FormBrowserEx2);
if (!EFI_ERROR (Status)) {
//
// Register the default HotKey F9 and F10 again.
//
HotKey.UnicodeChar = CHAR_NULL;
- HotKey.ScanCode = SCAN_F10;
- NewString = HiiGetString (gHiiHandle, STRING_TOKEN (FUNCTION_TEN_STRING), NULL);
+ HotKey.ScanCode = SCAN_F10;
+ NewString = HiiGetString (gHiiHandle, STRING_TOKEN (FUNCTION_TEN_STRING), NULL);
ASSERT (NewString != NULL);
FormBrowserEx2->RegisterHotKey (&HotKey, BROWSER_ACTION_SUBMIT, 0, NewString);
FreePool (NewString);
- HotKey.ScanCode = SCAN_F9;
- NewString = HiiGetString (gHiiHandle, STRING_TOKEN (FUNCTION_NINE_STRING), NULL);
+ HotKey.ScanCode = SCAN_F9;
+ NewString = HiiGetString (gHiiHandle, STRING_TOKEN (FUNCTION_NINE_STRING), NULL);
ASSERT (NewString != NULL);
FormBrowserEx2->RegisterHotKey (&HotKey, BROWSER_ACTION_DEFAULT, EFI_HII_DEFAULT_CLASS_STANDARD, NewString);
FreePool (NewString);
@@ -4240,10 +4318,10 @@ InitializeDisplayEngine (
EFI_STATUS
EFIAPI
UnloadDisplayEngine (
- IN EFI_HANDLE ImageHandle
+ IN EFI_HANDLE ImageHandle
)
{
- HiiRemovePackages(gHiiHandle);
+ HiiRemovePackages (gHiiHandle);
FreeDisplayStrings ();
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h
index e6d3ae417e..6e2670428e 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.h
@@ -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 gPromptBlockWidth;
-extern CHAR16 gOptionBlockWidth;
-extern CHAR16 gHelpBlockWidth;
-extern CHAR16 *mUnknownString;
-extern BOOLEAN gMisMatch;
+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;
//
// 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
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
index 722c56aa28..f70feeb55f 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
@@ -18,21 +18,22 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
GetFieldFromOp (
- IN EFI_IFR_OP_HEADER *OpCode,
- OUT UINTN *Minimum,
- OUT UINTN *Maximum
+ IN EFI_IFR_OP_HEADER *OpCode,
+ OUT UINTN *Minimum,
+ OUT UINTN *Maximum
)
{
EFI_IFR_STRING *StringOp;
EFI_IFR_PASSWORD *PasswordOp;
+
if (OpCode->OpCode == EFI_IFR_STRING_OP) {
- StringOp = (EFI_IFR_STRING *) OpCode;
+ StringOp = (EFI_IFR_STRING *)OpCode;
*Minimum = StringOp->MinSize;
*Maximum = StringOp->MaxSize;
} else if (OpCode->OpCode == EFI_IFR_PASSWORD_OP) {
- PasswordOp = (EFI_IFR_PASSWORD *) OpCode;
- *Minimum = PasswordOp->MinSize;
- *Maximum = PasswordOp->MaxSize;
+ PasswordOp = (EFI_IFR_PASSWORD *)OpCode;
+ *Minimum = PasswordOp->MinSize;
+ *Maximum = PasswordOp->MaxSize;
} else {
*Minimum = 0;
*Maximum = 0;
@@ -52,44 +53,44 @@ GetFieldFromOp (
**/
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
)
{
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
- CHAR16 NullCharacter;
- UINTN ScreenSize;
- CHAR16 Space[2];
- CHAR16 KeyPad[2];
- CHAR16 *TempString;
- CHAR16 *BufferedString;
- UINTN Index;
- UINTN Index2;
- UINTN Count;
- UINTN Start;
- UINTN Top;
- UINTN DimensionsWidth;
- UINTN DimensionsHeight;
- UINTN CurrentCursor;
- BOOLEAN CursorVisible;
- UINTN Minimum;
- UINTN Maximum;
+ EFI_STATUS Status;
+ EFI_INPUT_KEY Key;
+ CHAR16 NullCharacter;
+ UINTN ScreenSize;
+ CHAR16 Space[2];
+ CHAR16 KeyPad[2];
+ CHAR16 *TempString;
+ CHAR16 *BufferedString;
+ UINTN Index;
+ UINTN Index2;
+ UINTN Count;
+ UINTN Start;
+ UINTN Top;
+ UINTN DimensionsWidth;
+ UINTN DimensionsHeight;
+ UINTN CurrentCursor;
+ BOOLEAN CursorVisible;
+ UINTN Minimum;
+ UINTN Maximum;
FORM_DISPLAY_ENGINE_STATEMENT *Question;
- BOOLEAN IsPassword;
- UINTN MaxLen;
+ BOOLEAN IsPassword;
+ UINTN MaxLen;
DimensionsWidth = gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn;
DimensionsHeight = gStatementDimensions.BottomRow - gStatementDimensions.TopRow;
- NullCharacter = CHAR_NULL;
- ScreenSize = GetStringWidth (Prompt) / sizeof (CHAR16);
- Space[0] = L' ';
- Space[1] = CHAR_NULL;
+ NullCharacter = CHAR_NULL;
+ ScreenSize = GetStringWidth (Prompt) / sizeof (CHAR16);
+ Space[0] = L' ';
+ Space[1] = CHAR_NULL;
- Question = MenuOption->ThisTag;
- GetFieldFromOp(Question->OpCode, &Minimum, &Maximum);
+ Question = MenuOption->ThisTag;
+ GetFieldFromOp (Question->OpCode, &Minimum, &Maximum);
if (Question->OpCode->OpCode == EFI_IFR_PASSWORD_OP) {
IsPassword = TRUE;
@@ -97,7 +98,7 @@ ReadString (
IsPassword = FALSE;
}
- MaxLen = Maximum + 1;
+ MaxLen = Maximum + 1;
TempString = AllocateZeroPool (MaxLen * sizeof (CHAR16));
ASSERT (TempString);
@@ -165,144 +166,150 @@ ReadString (
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_BLACK, EFI_LIGHTGRAY));
switch (Key.UnicodeChar) {
- case CHAR_NULL:
- switch (Key.ScanCode) {
- case SCAN_LEFT:
- if (CurrentCursor > 0) {
- CurrentCursor--;
- }
- break;
+ case CHAR_NULL:
+ switch (Key.ScanCode) {
+ case SCAN_LEFT:
+ if (CurrentCursor > 0) {
+ CurrentCursor--;
+ }
- case SCAN_RIGHT:
- if (CurrentCursor < (GetStringWidth (StringPtr) / 2 - 1)) {
- CurrentCursor++;
+ break;
+
+ case SCAN_RIGHT:
+ if (CurrentCursor < (GetStringWidth (StringPtr) / 2 - 1)) {
+ CurrentCursor++;
+ }
+
+ break;
+
+ case SCAN_ESC:
+ FreePool (TempString);
+ FreePool (BufferedString);
+ gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
+ gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
+ return EFI_DEVICE_ERROR;
+
+ case SCAN_DELETE:
+ for (Index = CurrentCursor; StringPtr[Index] != CHAR_NULL; Index++) {
+ StringPtr[Index] = StringPtr[Index + 1];
+ PrintCharAt (Start + Index + 1, Top + 3, IsPassword && StringPtr[Index] != CHAR_NULL ? L'*' : StringPtr[Index]);
+ }
+
+ break;
+
+ default:
+ break;
}
+
break;
- case SCAN_ESC:
- FreePool (TempString);
- FreePool (BufferedString);
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
- return EFI_DEVICE_ERROR;
-
- case SCAN_DELETE:
- for (Index = CurrentCursor; StringPtr[Index] != CHAR_NULL; Index++) {
- StringPtr[Index] = StringPtr[Index + 1];
- PrintCharAt (Start + Index + 1, Top + 3, IsPassword && StringPtr[Index] != CHAR_NULL? L'*' : StringPtr[Index]);
+ case CHAR_CARRIAGE_RETURN:
+ if (GetStringWidth (StringPtr) >= ((Minimum + 1) * sizeof (CHAR16))) {
+ FreePool (TempString);
+ FreePool (BufferedString);
+ gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
+ gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
+ return EFI_SUCCESS;
+ } else {
+ //
+ // Simply create a popup to tell the user that they had typed in too few characters.
+ // To save code space, we can then treat this as an error and return back to the menu.
+ //
+ do {
+ CreateDialog (&Key, &NullCharacter, gMiniString, gPressEnter, &NullCharacter, NULL);
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+
+ FreePool (TempString);
+ FreePool (BufferedString);
+ gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
+ gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
+ return EFI_DEVICE_ERROR;
}
- break;
- default:
- break;
- }
+ case CHAR_BACKSPACE:
+ if ((StringPtr[0] != CHAR_NULL) && (CurrentCursor != 0)) {
+ for (Index = 0; Index < CurrentCursor - 1; Index++) {
+ TempString[Index] = StringPtr[Index];
+ }
- break;
+ Count = GetStringWidth (StringPtr) / 2 - 1;
+ if (Count >= CurrentCursor) {
+ for (Index = CurrentCursor - 1, Index2 = CurrentCursor; Index2 < Count; Index++, Index2++) {
+ TempString[Index] = StringPtr[Index2];
+ }
- case CHAR_CARRIAGE_RETURN:
- if (GetStringWidth (StringPtr) >= ((Minimum + 1) * sizeof (CHAR16))) {
+ TempString[Index] = CHAR_NULL;
+ }
- FreePool (TempString);
- FreePool (BufferedString);
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
- return EFI_SUCCESS;
- } else {
+ //
+ // Effectively truncate string by 1 character
+ //
+ StrCpyS (StringPtr, MaxLen, TempString);
+ CurrentCursor--;
+ }
+
+ default:
//
- // Simply create a popup to tell the user that they had typed in too few characters.
- // To save code space, we can then treat this as an error and return back to the menu.
+ // If it is the beginning of the string, don't worry about checking maximum limits
//
- do {
- CreateDialog (&Key, &NullCharacter, gMiniString, gPressEnter, &NullCharacter, NULL);
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
-
- FreePool (TempString);
- FreePool (BufferedString);
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
- return EFI_DEVICE_ERROR;
- }
-
+ if ((StringPtr[0] == CHAR_NULL) && (Key.UnicodeChar != CHAR_BACKSPACE)) {
+ StrnCpyS (StringPtr, MaxLen, &Key.UnicodeChar, 1);
+ CurrentCursor++;
+ } else if ((GetStringWidth (StringPtr) < ((Maximum + 1) * sizeof (CHAR16))) && (Key.UnicodeChar != CHAR_BACKSPACE)) {
+ KeyPad[0] = Key.UnicodeChar;
+ KeyPad[1] = CHAR_NULL;
+ Count = GetStringWidth (StringPtr) / 2 - 1;
+ if (CurrentCursor < Count) {
+ for (Index = 0; Index < CurrentCursor; Index++) {
+ TempString[Index] = StringPtr[Index];
+ }
- case CHAR_BACKSPACE:
- if (StringPtr[0] != CHAR_NULL && CurrentCursor != 0) {
- for (Index = 0; Index < CurrentCursor - 1; Index++) {
- TempString[Index] = StringPtr[Index];
- }
- Count = GetStringWidth (StringPtr) / 2 - 1;
- if (Count >= CurrentCursor) {
- for (Index = CurrentCursor - 1, Index2 = CurrentCursor; Index2 < Count; Index++, Index2++) {
- TempString[Index] = StringPtr[Index2];
+ TempString[Index] = CHAR_NULL;
+ StrCatS (TempString, MaxLen, KeyPad);
+ StrCatS (TempString, MaxLen, StringPtr + CurrentCursor);
+ StrCpyS (StringPtr, MaxLen, TempString);
+ } else {
+ StrCatS (StringPtr, MaxLen, KeyPad);
}
- TempString[Index] = CHAR_NULL;
+
+ CurrentCursor++;
}
+
//
- // Effectively truncate string by 1 character
+ // If the width of the input string is now larger than the screen, we nee to
+ // adjust the index to start printing portions of the string
//
- StrCpyS (StringPtr, MaxLen, TempString);
- CurrentCursor --;
- }
+ SetUnicodeMem (BufferedString, ScreenSize - 1, L' ');
+ PrintStringAt (Start + 1, Top + 3, BufferedString);
- default:
- //
- // If it is the beginning of the string, don't worry about checking maximum limits
- //
- if ((StringPtr[0] == CHAR_NULL) && (Key.UnicodeChar != CHAR_BACKSPACE)) {
- StrnCpyS (StringPtr, MaxLen, &Key.UnicodeChar, 1);
- CurrentCursor++;
- } else if ((GetStringWidth (StringPtr) < ((Maximum + 1) * sizeof (CHAR16))) && (Key.UnicodeChar != CHAR_BACKSPACE)) {
- KeyPad[0] = Key.UnicodeChar;
- KeyPad[1] = CHAR_NULL;
- Count = GetStringWidth (StringPtr) / 2 - 1;
- if (CurrentCursor < Count) {
- for (Index = 0; Index < CurrentCursor; Index++) {
- TempString[Index] = StringPtr[Index];
- }
- TempString[Index] = CHAR_NULL;
- StrCatS (TempString, MaxLen, KeyPad);
- StrCatS (TempString, MaxLen, StringPtr + CurrentCursor);
- StrCpyS (StringPtr, MaxLen, TempString);
+ if ((GetStringWidth (StringPtr) / 2) > (DimensionsWidth - 2)) {
+ Index = (GetStringWidth (StringPtr) / 2) - DimensionsWidth + 2;
} else {
- StrCatS (StringPtr, MaxLen, KeyPad);
+ Index = 0;
}
- CurrentCursor++;
- }
- //
- // If the width of the input string is now larger than the screen, we nee to
- // adjust the index to start printing portions of the string
- //
- SetUnicodeMem (BufferedString, ScreenSize - 1, L' ');
- PrintStringAt (Start + 1, Top + 3, BufferedString);
+ if (IsPassword) {
+ gST->ConOut->SetCursorPosition (gST->ConOut, Start + 1, Top + 3);
+ }
- if ((GetStringWidth (StringPtr) / 2) > (DimensionsWidth - 2)) {
- Index = (GetStringWidth (StringPtr) / 2) - DimensionsWidth + 2;
- } else {
- Index = 0;
- }
+ for (Count = 0; Index + 1 < GetStringWidth (StringPtr) / 2; Index++, Count++) {
+ BufferedString[Count] = StringPtr[Index];
- if (IsPassword) {
- gST->ConOut->SetCursorPosition (gST->ConOut, Start + 1, Top + 3);
- }
-
- for (Count = 0; Index + 1 < GetStringWidth (StringPtr) / 2; Index++, Count++) {
- BufferedString[Count] = StringPtr[Index];
+ if (IsPassword) {
+ PrintCharAt ((UINTN)-1, (UINTN)-1, L'*');
+ }
+ }
- if (IsPassword) {
- PrintCharAt ((UINTN)-1, (UINTN)-1, L'*');
+ if (!IsPassword) {
+ PrintStringAt (Start + 1, Top + 3, BufferedString);
}
- }
- if (!IsPassword) {
- PrintStringAt (Start + 1, Top + 3, BufferedString);
- }
- break;
+ break;
}
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
gST->ConOut->SetCursorPosition (gST->ConOut, Start + CurrentCursor + 1, Top + 3);
} while (TRUE);
-
}
/**
@@ -315,36 +322,37 @@ ReadString (
**/
VOID
AdjustQuestionValue (
- IN EFI_HII_VALUE *QuestionValue,
- IN UINT8 Sequence
+ IN EFI_HII_VALUE *QuestionValue,
+ IN UINT8 Sequence
)
{
- UINT8 Month;
- UINT16 Year;
- UINT8 Maximum;
- UINT8 Minimum;
+ UINT8 Month;
+ UINT16 Year;
+ UINT8 Maximum;
+ UINT8 Minimum;
Month = QuestionValue->Value.date.Month;
Year = QuestionValue->Value.date.Year;
Minimum = 1;
switch (Month) {
- case 2:
- if ((Year % 4) == 0 && ((Year % 100) != 0 || (Year % 400) == 0)) {
- Maximum = 29;
- } else {
- Maximum = 28;
- }
- break;
- case 4:
- case 6:
- case 9:
- case 11:
- Maximum = 30;
- break;
- default:
- Maximum = 31;
- break;
+ case 2:
+ if (((Year % 4) == 0) && (((Year % 100) != 0) || ((Year % 400) == 0))) {
+ Maximum = 29;
+ } else {
+ Maximum = 28;
+ }
+
+ break;
+ case 4:
+ case 6:
+ case 9:
+ case 11:
+ Maximum = 30;
+ break;
+ default:
+ Maximum = 31;
+ break;
}
//
@@ -381,83 +389,87 @@ AdjustQuestionValue (
**/
VOID
GetValueFromNum (
- IN EFI_IFR_OP_HEADER *OpCode,
- IN BOOLEAN IntInput,
- IN EFI_HII_VALUE *QuestionValue,
- OUT UINT64 *Value,
- OUT UINT64 *Minimum,
- OUT UINT64 *Maximum,
- OUT UINT64 *Step,
- OUT UINT16 *StorageWidth
-)
+ IN EFI_IFR_OP_HEADER *OpCode,
+ IN BOOLEAN IntInput,
+ IN EFI_HII_VALUE *QuestionValue,
+ OUT UINT64 *Value,
+ OUT UINT64 *Minimum,
+ OUT UINT64 *Maximum,
+ OUT UINT64 *Step,
+ OUT UINT16 *StorageWidth
+ )
{
- EFI_IFR_NUMERIC *NumericOp;
+ EFI_IFR_NUMERIC *NumericOp;
- NumericOp = (EFI_IFR_NUMERIC *) OpCode;
+ NumericOp = (EFI_IFR_NUMERIC *)OpCode;
switch (NumericOp->Flags & EFI_IFR_NUMERIC_SIZE) {
- case EFI_IFR_NUMERIC_SIZE_1:
- if (IntInput) {
- *Minimum = (INT64) (INT8) NumericOp->data.u8.MinValue;
- *Maximum = (INT64) (INT8) NumericOp->data.u8.MaxValue;
- *Value = (INT64) (INT8) QuestionValue->Value.u8;
- } else {
- *Minimum = NumericOp->data.u8.MinValue;
- *Maximum = NumericOp->data.u8.MaxValue;
- *Value = QuestionValue->Value.u8;
- }
- *Step = NumericOp->data.u8.Step;
- *StorageWidth = (UINT16) sizeof (UINT8);
- break;
-
- case EFI_IFR_NUMERIC_SIZE_2:
- if (IntInput) {
- *Minimum = (INT64) (INT16) NumericOp->data.u16.MinValue;
- *Maximum = (INT64) (INT16) NumericOp->data.u16.MaxValue;
- *Value = (INT64) (INT16) QuestionValue->Value.u16;
- } else {
- *Minimum = NumericOp->data.u16.MinValue;
- *Maximum = NumericOp->data.u16.MaxValue;
- *Value = QuestionValue->Value.u16;
- }
- *Step = NumericOp->data.u16.Step;
- *StorageWidth = (UINT16) sizeof (UINT16);
- break;
-
- case EFI_IFR_NUMERIC_SIZE_4:
- if (IntInput) {
- *Minimum = (INT64) (INT32) NumericOp->data.u32.MinValue;
- *Maximum = (INT64) (INT32) NumericOp->data.u32.MaxValue;
- *Value = (INT64) (INT32) QuestionValue->Value.u32;
- } else {
- *Minimum = NumericOp->data.u32.MinValue;
- *Maximum = NumericOp->data.u32.MaxValue;
- *Value = QuestionValue->Value.u32;
- }
- *Step = NumericOp->data.u32.Step;
- *StorageWidth = (UINT16) sizeof (UINT32);
- break;
-
- case EFI_IFR_NUMERIC_SIZE_8:
- if (IntInput) {
- *Minimum = (INT64) NumericOp->data.u64.MinValue;
- *Maximum = (INT64) NumericOp->data.u64.MaxValue;
- *Value = (INT64) QuestionValue->Value.u64;
- } else {
- *Minimum = NumericOp->data.u64.MinValue;
- *Maximum = NumericOp->data.u64.MaxValue;
- *Value = QuestionValue->Value.u64;
- }
- *Step = NumericOp->data.u64.Step;
- *StorageWidth = (UINT16) sizeof (UINT64);
- break;
+ case EFI_IFR_NUMERIC_SIZE_1:
+ if (IntInput) {
+ *Minimum = (INT64)(INT8)NumericOp->data.u8.MinValue;
+ *Maximum = (INT64)(INT8)NumericOp->data.u8.MaxValue;
+ *Value = (INT64)(INT8)QuestionValue->Value.u8;
+ } else {
+ *Minimum = NumericOp->data.u8.MinValue;
+ *Maximum = NumericOp->data.u8.MaxValue;
+ *Value = QuestionValue->Value.u8;
+ }
+
+ *Step = NumericOp->data.u8.Step;
+ *StorageWidth = (UINT16)sizeof (UINT8);
+ break;
+
+ case EFI_IFR_NUMERIC_SIZE_2:
+ if (IntInput) {
+ *Minimum = (INT64)(INT16)NumericOp->data.u16.MinValue;
+ *Maximum = (INT64)(INT16)NumericOp->data.u16.MaxValue;
+ *Value = (INT64)(INT16)QuestionValue->Value.u16;
+ } else {
+ *Minimum = NumericOp->data.u16.MinValue;
+ *Maximum = NumericOp->data.u16.MaxValue;
+ *Value = QuestionValue->Value.u16;
+ }
+
+ *Step = NumericOp->data.u16.Step;
+ *StorageWidth = (UINT16)sizeof (UINT16);
+ break;
+
+ case EFI_IFR_NUMERIC_SIZE_4:
+ if (IntInput) {
+ *Minimum = (INT64)(INT32)NumericOp->data.u32.MinValue;
+ *Maximum = (INT64)(INT32)NumericOp->data.u32.MaxValue;
+ *Value = (INT64)(INT32)QuestionValue->Value.u32;
+ } else {
+ *Minimum = NumericOp->data.u32.MinValue;
+ *Maximum = NumericOp->data.u32.MaxValue;
+ *Value = QuestionValue->Value.u32;
+ }
+
+ *Step = NumericOp->data.u32.Step;
+ *StorageWidth = (UINT16)sizeof (UINT32);
+ break;
+
+ case EFI_IFR_NUMERIC_SIZE_8:
+ if (IntInput) {
+ *Minimum = (INT64)NumericOp->data.u64.MinValue;
+ *Maximum = (INT64)NumericOp->data.u64.MaxValue;
+ *Value = (INT64)QuestionValue->Value.u64;
+ } else {
+ *Minimum = NumericOp->data.u64.MinValue;
+ *Maximum = NumericOp->data.u64.MaxValue;
+ *Value = QuestionValue->Value.u64;
+ }
- default:
- break;
+ *Step = NumericOp->data.u64.Step;
+ *StorageWidth = (UINT16)sizeof (UINT64);
+ break;
+
+ default:
+ break;
}
if (*Maximum == 0) {
- *Maximum = (UINT64) -1;
+ *Maximum = (UINT64)-1;
}
}
@@ -472,31 +484,31 @@ GetValueFromNum (
**/
EFI_STATUS
GetNumericInput (
- IN UI_MENU_OPTION *MenuOption
+ IN UI_MENU_OPTION *MenuOption
)
{
- UINTN Column;
- UINTN Row;
- CHAR16 InputText[MAX_NUMERIC_INPUT_WIDTH];
- CHAR16 FormattedNumber[MAX_NUMERIC_INPUT_WIDTH - 1];
- UINT64 PreviousNumber[MAX_NUMERIC_INPUT_WIDTH - 3];
- UINTN Count;
- UINTN Loop;
- BOOLEAN ManualInput;
- BOOLEAN HexInput;
- BOOLEAN IntInput;
- BOOLEAN Negative;
- BOOLEAN ValidateFail;
- BOOLEAN DateOrTime;
- UINTN InputWidth;
- UINT64 EditValue;
- UINT64 Step;
- UINT64 Minimum;
- UINT64 Maximum;
- UINTN EraseLen;
- UINT8 Digital;
- EFI_INPUT_KEY Key;
- EFI_HII_VALUE *QuestionValue;
+ UINTN Column;
+ UINTN Row;
+ CHAR16 InputText[MAX_NUMERIC_INPUT_WIDTH];
+ CHAR16 FormattedNumber[MAX_NUMERIC_INPUT_WIDTH - 1];
+ UINT64 PreviousNumber[MAX_NUMERIC_INPUT_WIDTH - 3];
+ UINTN Count;
+ UINTN Loop;
+ BOOLEAN ManualInput;
+ BOOLEAN HexInput;
+ BOOLEAN IntInput;
+ BOOLEAN Negative;
+ BOOLEAN ValidateFail;
+ BOOLEAN DateOrTime;
+ UINTN InputWidth;
+ UINT64 EditValue;
+ UINT64 Step;
+ UINT64 Minimum;
+ UINT64 Maximum;
+ UINTN EraseLen;
+ UINT8 Digital;
+ EFI_INPUT_KEY Key;
+ EFI_HII_VALUE *QuestionValue;
FORM_DISPLAY_ENGINE_STATEMENT *Question;
EFI_IFR_NUMERIC *NumericOp;
UINT16 StorageWidth;
@@ -524,7 +536,7 @@ GetNumericInput (
// Only two case, user can enter to this function: Enter and +/- case.
// In Enter case, gDirection = 0; in +/- case, gDirection = SCAN_LEFT/SCAN_WRIGHT
//
- ManualInput = (BOOLEAN)(gDirection == 0 ? TRUE : FALSE);
+ ManualInput = (BOOLEAN)(gDirection == 0 ? TRUE : FALSE);
if ((Question->OpCode->OpCode == EFI_IFR_DATE_OP) || (Question->OpCode->OpCode == EFI_IFR_TIME_OP)) {
DateOrTime = TRUE;
@@ -535,91 +547,93 @@ GetNumericInput (
//
// Prepare Value to be edit
//
- EraseLen = 0;
+ EraseLen = 0;
EditValue = 0;
if (Question->OpCode->OpCode == EFI_IFR_DATE_OP) {
- Step = 1;
+ Step = 1;
Minimum = 1;
switch (MenuOption->Sequence) {
- case 0:
- Maximum = 12;
- EraseLen = 4;
- EditValue = QuestionValue->Value.date.Month;
- break;
+ case 0:
+ Maximum = 12;
+ EraseLen = 4;
+ EditValue = QuestionValue->Value.date.Month;
+ break;
- case 1:
- switch (QuestionValue->Value.date.Month) {
- case 2:
- if ((QuestionValue->Value.date.Year % 4) == 0 &&
- ((QuestionValue->Value.date.Year % 100) != 0 ||
- (QuestionValue->Value.date.Year % 400) == 0)) {
- Maximum = 29;
- } else {
- Maximum = 28;
+ case 1:
+ switch (QuestionValue->Value.date.Month) {
+ case 2:
+ if (((QuestionValue->Value.date.Year % 4) == 0) &&
+ (((QuestionValue->Value.date.Year % 100) != 0) ||
+ ((QuestionValue->Value.date.Year % 400) == 0)))
+ {
+ Maximum = 29;
+ } else {
+ Maximum = 28;
+ }
+
+ break;
+ case 4:
+ case 6:
+ case 9:
+ case 11:
+ Maximum = 30;
+ break;
+ default:
+ Maximum = 31;
+ break;
}
+
+ EraseLen = 3;
+ EditValue = QuestionValue->Value.date.Day;
break;
- case 4:
- case 6:
- case 9:
- case 11:
- Maximum = 30;
+
+ case 2:
+ Maximum = 0xffff;
+ EraseLen = 5;
+ EditValue = QuestionValue->Value.date.Year;
break;
+
default:
- Maximum = 31;
break;
- }
-
- EraseLen = 3;
- EditValue = QuestionValue->Value.date.Day;
- break;
-
- case 2:
- Maximum = 0xffff;
- EraseLen = 5;
- EditValue = QuestionValue->Value.date.Year;
- break;
-
- default:
- break;
}
} else if (Question->OpCode->OpCode == EFI_IFR_TIME_OP) {
- Step = 1;
+ Step = 1;
Minimum = 0;
switch (MenuOption->Sequence) {
- case 0:
- Maximum = 23;
- EraseLen = 4;
- EditValue = QuestionValue->Value.time.Hour;
- break;
+ case 0:
+ Maximum = 23;
+ EraseLen = 4;
+ EditValue = QuestionValue->Value.time.Hour;
+ break;
- case 1:
- Maximum = 59;
- EraseLen = 3;
- EditValue = QuestionValue->Value.time.Minute;
- break;
+ case 1:
+ Maximum = 59;
+ EraseLen = 3;
+ EditValue = QuestionValue->Value.time.Minute;
+ break;
- case 2:
- Maximum = 59;
- EraseLen = 3;
- EditValue = QuestionValue->Value.time.Second;
- break;
+ case 2:
+ Maximum = 59;
+ EraseLen = 3;
+ EditValue = QuestionValue->Value.time.Second;
+ break;
- default:
- break;
+ default:
+ break;
}
} else {
ASSERT (Question->OpCode->OpCode == EFI_IFR_NUMERIC_OP);
- NumericOp = (EFI_IFR_NUMERIC *) Question->OpCode;
- GetValueFromNum(Question->OpCode, (NumericOp->Flags & EFI_IFR_DISPLAY) == 0, QuestionValue, &EditValue, &Minimum, &Maximum, &Step, &StorageWidth);
- EraseLen = gOptionBlockWidth;
+ NumericOp = (EFI_IFR_NUMERIC *)Question->OpCode;
+ GetValueFromNum (Question->OpCode, (NumericOp->Flags & EFI_IFR_DISPLAY) == 0, QuestionValue, &EditValue, &Minimum, &Maximum, &Step, &StorageWidth);
+ EraseLen = gOptionBlockWidth;
}
if ((Question->OpCode->OpCode == EFI_IFR_NUMERIC_OP) && (NumericOp != NULL)) {
- if ((NumericOp->Flags & EFI_IFR_DISPLAY) == EFI_IFR_DISPLAY_UINT_HEX){
+ if ((NumericOp->Flags & EFI_IFR_DISPLAY) == EFI_IFR_DISPLAY_UINT_HEX) {
HexInput = TRUE;
- } else if ((NumericOp->Flags & EFI_IFR_DISPLAY) == 0){
+ } else if ((NumericOp->Flags & EFI_IFR_DISPLAY) == 0) {
//
// Display with EFI_IFR_DISPLAY_INT_DEC type. Support negative number.
//
@@ -636,25 +650,25 @@ GetNumericInput (
InputWidth = StorageWidth * 2;
} else {
switch (StorageWidth) {
- case 1:
- InputWidth = 3;
- break;
+ case 1:
+ InputWidth = 3;
+ break;
- case 2:
- InputWidth = 5;
- break;
+ case 2:
+ InputWidth = 5;
+ break;
- case 4:
- InputWidth = 10;
- break;
+ case 4:
+ InputWidth = 10;
+ break;
- case 8:
- InputWidth = 20;
- break;
+ case 8:
+ InputWidth = 20;
+ break;
- default:
- InputWidth = 0;
- break;
+ default:
+ InputWidth = 0;
+ break;
}
if (IntInput) {
@@ -687,13 +701,13 @@ GetNumericInput (
SetUnicodeMem (InputText + 1, InputWidth, L' ');
InputText[InputWidth + 1] = DATE_SEPARATOR;
InputText[InputWidth + 2] = L'\0';
- } else if (MenuOption->Sequence == 1){
+ } else if (MenuOption->Sequence == 1) {
SetUnicodeMem (InputText, InputWidth, L' ');
- InputText[InputWidth] = DATE_SEPARATOR;
+ InputText[InputWidth] = DATE_SEPARATOR;
InputText[InputWidth + 1] = L'\0';
} else {
SetUnicodeMem (InputText, InputWidth, L' ');
- InputText[InputWidth] = RIGHT_NUMERIC_DELIMITER;
+ InputText[InputWidth] = RIGHT_NUMERIC_DELIMITER;
InputText[InputWidth + 1] = L'\0';
}
@@ -711,13 +725,13 @@ GetNumericInput (
SetUnicodeMem (InputText + 1, InputWidth, L' ');
InputText[InputWidth + 1] = TIME_SEPARATOR;
InputText[InputWidth + 2] = L'\0';
- } else if (MenuOption->Sequence == 1){
+ } else if (MenuOption->Sequence == 1) {
SetUnicodeMem (InputText, InputWidth, L' ');
- InputText[InputWidth] = TIME_SEPARATOR;
+ InputText[InputWidth] = TIME_SEPARATOR;
InputText[InputWidth + 1] = L'\0';
} else {
SetUnicodeMem (InputText, InputWidth, L' ');
- InputText[InputWidth] = RIGHT_NUMERIC_DELIMITER;
+ InputText[InputWidth] = RIGHT_NUMERIC_DELIMITER;
InputText[InputWidth + 1] = L'\0';
}
@@ -735,8 +749,8 @@ GetNumericInput (
do {
Key.UnicodeChar = CHAR_NULL;
if (gDirection != 0) {
- Key.ScanCode = gDirection;
- gDirection = 0;
+ Key.ScanCode = gDirection;
+ gDirection = 0;
goto TheKey2;
}
@@ -744,353 +758,362 @@ GetNumericInput (
TheKey2:
switch (Key.UnicodeChar) {
+ case '+':
+ case '-':
+ if (ManualInput && IntInput) {
+ //
+ // In Manual input mode, check whether input the negative flag.
+ //
+ if (Key.UnicodeChar == '-') {
+ if (Negative) {
+ break;
+ }
- case '+':
- case '-':
- if (ManualInput && IntInput) {
- //
- // In Manual input mode, check whether input the negative flag.
- //
- if (Key.UnicodeChar == '-') {
- if (Negative) {
- break;
+ Negative = TRUE;
+ PrintCharAt (Column++, Row, Key.UnicodeChar);
}
- Negative = TRUE;
- PrintCharAt (Column++, Row, Key.UnicodeChar);
- }
- } else {
- if (Key.UnicodeChar == '+') {
- Key.ScanCode = SCAN_RIGHT;
} else {
- Key.ScanCode = SCAN_LEFT;
- }
- Key.UnicodeChar = CHAR_NULL;
- goto TheKey2;
- }
- break;
+ if (Key.UnicodeChar == '+') {
+ Key.ScanCode = SCAN_RIGHT;
+ } else {
+ Key.ScanCode = SCAN_LEFT;
+ }
- case CHAR_NULL:
- switch (Key.ScanCode) {
- case SCAN_LEFT:
- case SCAN_RIGHT:
- if (DateOrTime && !ManualInput) {
- //
- // By setting this value, we will return back to the caller.
- // We need to do this since an auto-refresh will destroy the adjustment
- // based on what the real-time-clock is showing. So we always commit
- // upon changing the value.
- //
- gDirection = SCAN_DOWN;
+ Key.UnicodeChar = CHAR_NULL;
+ goto TheKey2;
}
- if ((Step != 0) && !ManualInput) {
- if (Key.ScanCode == SCAN_LEFT) {
- if (IntInput) {
- if ((INT64) EditValue >= (INT64) Minimum + (INT64) Step) {
- EditValue = EditValue - Step;
- } else if ((INT64) EditValue > (INT64) Minimum){
- EditValue = Minimum;
- } else {
- EditValue = Maximum;
- }
- } else {
- if (EditValue >= Minimum + Step) {
- EditValue = EditValue - Step;
- } else if (EditValue > Minimum){
- EditValue = Minimum;
- } else {
- EditValue = Maximum;
- }
+ break;
+
+ case CHAR_NULL:
+ switch (Key.ScanCode) {
+ case SCAN_LEFT:
+ case SCAN_RIGHT:
+ if (DateOrTime && !ManualInput) {
+ //
+ // By setting this value, we will return back to the caller.
+ // We need to do this since an auto-refresh will destroy the adjustment
+ // based on what the real-time-clock is showing. So we always commit
+ // upon changing the value.
+ //
+ gDirection = SCAN_DOWN;
}
- } else if (Key.ScanCode == SCAN_RIGHT) {
- if (IntInput) {
- if ((INT64) EditValue + (INT64) Step <= (INT64) Maximum) {
- EditValue = EditValue + Step;
- } else if ((INT64) EditValue < (INT64) Maximum) {
- EditValue = Maximum;
- } else {
- EditValue = Minimum;
+
+ if ((Step != 0) && !ManualInput) {
+ if (Key.ScanCode == SCAN_LEFT) {
+ if (IntInput) {
+ if ((INT64)EditValue >= (INT64)Minimum + (INT64)Step) {
+ EditValue = EditValue - Step;
+ } else if ((INT64)EditValue > (INT64)Minimum) {
+ EditValue = Minimum;
+ } else {
+ EditValue = Maximum;
+ }
+ } else {
+ if (EditValue >= Minimum + Step) {
+ EditValue = EditValue - Step;
+ } else if (EditValue > Minimum) {
+ EditValue = Minimum;
+ } else {
+ EditValue = Maximum;
+ }
+ }
+ } else if (Key.ScanCode == SCAN_RIGHT) {
+ if (IntInput) {
+ if ((INT64)EditValue + (INT64)Step <= (INT64)Maximum) {
+ EditValue = EditValue + Step;
+ } else if ((INT64)EditValue < (INT64)Maximum) {
+ EditValue = Maximum;
+ } else {
+ EditValue = Minimum;
+ }
+ } else {
+ if (EditValue + Step <= Maximum) {
+ EditValue = EditValue + Step;
+ } else if (EditValue < Maximum) {
+ EditValue = Maximum;
+ } else {
+ EditValue = Minimum;
+ }
+ }
}
- } else {
- if (EditValue + Step <= Maximum) {
- EditValue = EditValue + Step;
- } else if (EditValue < Maximum) {
- EditValue = Maximum;
+
+ ZeroMem (FormattedNumber, 21 * sizeof (CHAR16));
+ if (Question->OpCode->OpCode == EFI_IFR_DATE_OP) {
+ if (MenuOption->Sequence == 2) {
+ //
+ // Year
+ //
+ UnicodeSPrint (FormattedNumber, 21 * sizeof (CHAR16), L"%04d", (UINT16)EditValue);
+ } else {
+ //
+ // Month/Day
+ //
+ UnicodeSPrint (FormattedNumber, 21 * sizeof (CHAR16), L"%02d", (UINT8)EditValue);
+ }
+
+ if (MenuOption->Sequence == 0) {
+ ASSERT (EraseLen >= 2);
+ FormattedNumber[EraseLen - 2] = DATE_SEPARATOR;
+ } else if (MenuOption->Sequence == 1) {
+ ASSERT (EraseLen >= 1);
+ FormattedNumber[EraseLen - 1] = DATE_SEPARATOR;
+ }
+ } else if (Question->OpCode->OpCode == EFI_IFR_TIME_OP) {
+ UnicodeSPrint (FormattedNumber, 21 * sizeof (CHAR16), L"%02d", (UINT8)EditValue);
+
+ if (MenuOption->Sequence == 0) {
+ ASSERT (EraseLen >= 2);
+ FormattedNumber[EraseLen - 2] = TIME_SEPARATOR;
+ } else if (MenuOption->Sequence == 1) {
+ ASSERT (EraseLen >= 1);
+ FormattedNumber[EraseLen - 1] = TIME_SEPARATOR;
+ }
} else {
- EditValue = Minimum;
+ QuestionValue->Value.u64 = EditValue;
+ PrintFormattedNumber (Question, FormattedNumber, 21 * sizeof (CHAR16));
}
- }
- }
- ZeroMem (FormattedNumber, 21 * sizeof (CHAR16));
- if (Question->OpCode->OpCode == EFI_IFR_DATE_OP) {
- if (MenuOption->Sequence == 2) {
- //
- // Year
- //
- UnicodeSPrint (FormattedNumber, 21 * sizeof (CHAR16), L"%04d", (UINT16) EditValue);
- } else {
- //
- // Month/Day
- //
- UnicodeSPrint (FormattedNumber, 21 * sizeof (CHAR16), L"%02d", (UINT8) EditValue);
- }
+ gST->ConOut->SetAttribute (gST->ConOut, GetFieldTextColor ());
+ for (Loop = 0; Loop < EraseLen; Loop++) {
+ PrintStringAt (MenuOption->OptCol + Loop, MenuOption->Row, L" ");
+ }
- if (MenuOption->Sequence == 0) {
- ASSERT (EraseLen >= 2);
- FormattedNumber[EraseLen - 2] = DATE_SEPARATOR;
- } else if (MenuOption->Sequence == 1) {
- ASSERT (EraseLen >= 1);
- FormattedNumber[EraseLen - 1] = DATE_SEPARATOR;
- }
- } else if (Question->OpCode->OpCode == EFI_IFR_TIME_OP) {
- UnicodeSPrint (FormattedNumber, 21 * sizeof (CHAR16), L"%02d", (UINT8) EditValue);
-
- if (MenuOption->Sequence == 0) {
- ASSERT (EraseLen >= 2);
- FormattedNumber[EraseLen - 2] = TIME_SEPARATOR;
- } else if (MenuOption->Sequence == 1) {
- ASSERT (EraseLen >= 1);
- FormattedNumber[EraseLen - 1] = TIME_SEPARATOR;
- }
- } else {
- QuestionValue->Value.u64 = EditValue;
- PrintFormattedNumber (Question, FormattedNumber, 21 * sizeof (CHAR16));
- }
+ gST->ConOut->SetAttribute (gST->ConOut, GetHighlightTextColor ());
- gST->ConOut->SetAttribute (gST->ConOut, GetFieldTextColor ());
- for (Loop = 0; Loop < EraseLen; Loop++) {
- PrintStringAt (MenuOption->OptCol + Loop, MenuOption->Row, L" ");
- }
- gST->ConOut->SetAttribute (gST->ConOut, GetHighlightTextColor ());
+ if (MenuOption->Sequence == 0) {
+ PrintCharAt (MenuOption->OptCol, Row, LEFT_NUMERIC_DELIMITER);
+ Column = MenuOption->OptCol + 1;
+ }
- if (MenuOption->Sequence == 0) {
- PrintCharAt (MenuOption->OptCol, Row, LEFT_NUMERIC_DELIMITER);
- Column = MenuOption->OptCol + 1;
- }
+ PrintStringAt (Column, Row, FormattedNumber);
- PrintStringAt (Column, Row, FormattedNumber);
+ if (!DateOrTime || (MenuOption->Sequence == 2)) {
+ PrintCharAt ((UINTN)-1, (UINTN)-1, RIGHT_NUMERIC_DELIMITER);
+ }
+ }
- if (!DateOrTime || MenuOption->Sequence == 2) {
- PrintCharAt ((UINTN)-1, (UINTN)-1, RIGHT_NUMERIC_DELIMITER);
- }
- }
+ goto EnterCarriageReturn;
- goto EnterCarriageReturn;
+ case SCAN_UP:
+ case SCAN_DOWN:
+ goto EnterCarriageReturn;
- case SCAN_UP:
- case SCAN_DOWN:
- goto EnterCarriageReturn;
+ case SCAN_ESC:
+ return EFI_DEVICE_ERROR;
- case SCAN_ESC:
- return EFI_DEVICE_ERROR;
+ default:
+ break;
+ }
- default:
break;
- }
-
- break;
EnterCarriageReturn:
- case CHAR_CARRIAGE_RETURN:
- //
- // Validate input value with Minimum value.
- //
- ValidateFail = FALSE;
- if (IntInput) {
+ case CHAR_CARRIAGE_RETURN:
//
- // After user input Enter, need to check whether the input value.
- // If input a negative value, should compare with maximum value.
- // else compare with the minimum value.
+ // Validate input value with Minimum value.
//
- if (Negative) {
- ValidateFail = (INT64) EditValue > (INT64) Maximum ? TRUE : FALSE;
- } else {
- ValidateFail = (INT64) EditValue < (INT64) Minimum ? TRUE : FALSE;
- }
+ ValidateFail = FALSE;
+ if (IntInput) {
+ //
+ // After user input Enter, need to check whether the input value.
+ // If input a negative value, should compare with maximum value.
+ // else compare with the minimum value.
+ //
+ if (Negative) {
+ ValidateFail = (INT64)EditValue > (INT64)Maximum ? TRUE : FALSE;
+ } else {
+ ValidateFail = (INT64)EditValue < (INT64)Minimum ? TRUE : FALSE;
+ }
- if (ValidateFail) {
+ if (ValidateFail) {
+ UpdateStatusBar (INPUT_ERROR, TRUE);
+ break;
+ }
+ } else if (EditValue < Minimum) {
UpdateStatusBar (INPUT_ERROR, TRUE);
break;
}
- } else if (EditValue < Minimum) {
- UpdateStatusBar (INPUT_ERROR, TRUE);
- break;
- }
- UpdateStatusBar (INPUT_ERROR, FALSE);
- CopyMem (&gUserInput->InputValue, &Question->CurrentValue, sizeof (EFI_HII_VALUE));
- QuestionValue = &gUserInput->InputValue;
- //
- // Store Edit value back to Question
- //
- if (Question->OpCode->OpCode == EFI_IFR_DATE_OP) {
- switch (MenuOption->Sequence) {
- case 0:
- QuestionValue->Value.date.Month = (UINT8) EditValue;
- break;
+ UpdateStatusBar (INPUT_ERROR, FALSE);
+ CopyMem (&gUserInput->InputValue, &Question->CurrentValue, sizeof (EFI_HII_VALUE));
+ QuestionValue = &gUserInput->InputValue;
+ //
+ // Store Edit value back to Question
+ //
+ if (Question->OpCode->OpCode == EFI_IFR_DATE_OP) {
+ switch (MenuOption->Sequence) {
+ case 0:
+ QuestionValue->Value.date.Month = (UINT8)EditValue;
+ break;
- case 1:
- QuestionValue->Value.date.Day = (UINT8) EditValue;
- break;
+ case 1:
+ QuestionValue->Value.date.Day = (UINT8)EditValue;
+ break;
- case 2:
- QuestionValue->Value.date.Year = (UINT16) EditValue;
- break;
+ case 2:
+ QuestionValue->Value.date.Year = (UINT16)EditValue;
+ break;
- default:
- break;
- }
- } else if (Question->OpCode->OpCode == EFI_IFR_TIME_OP) {
- switch (MenuOption->Sequence) {
- case 0:
- QuestionValue->Value.time.Hour = (UINT8) EditValue;
- break;
+ default:
+ break;
+ }
+ } else if (Question->OpCode->OpCode == EFI_IFR_TIME_OP) {
+ switch (MenuOption->Sequence) {
+ case 0:
+ QuestionValue->Value.time.Hour = (UINT8)EditValue;
+ break;
- case 1:
- QuestionValue->Value.time.Minute = (UINT8) EditValue;
- break;
+ case 1:
+ QuestionValue->Value.time.Minute = (UINT8)EditValue;
+ break;
- case 2:
- QuestionValue->Value.time.Second = (UINT8) EditValue;
- break;
+ case 2:
+ QuestionValue->Value.time.Second = (UINT8)EditValue;
+ break;
- default:
- break;
+ default:
+ break;
+ }
+ } else {
+ //
+ // Numeric
+ //
+ QuestionValue->Value.u64 = EditValue;
}
- } else {
+
//
- // Numeric
+ // Adjust the value to the correct one.
+ // Sample like: 2012.02.29 -> 2013.02.29 -> 2013.02.01
+ // 2013.03.29 -> 2013.02.29 -> 2013.02.28
//
- QuestionValue->Value.u64 = EditValue;
- }
+ if ((Question->OpCode->OpCode == EFI_IFR_DATE_OP) &&
+ ((MenuOption->Sequence == 0) || (MenuOption->Sequence == 2)))
+ {
+ AdjustQuestionValue (QuestionValue, (UINT8)MenuOption->Sequence);
+ }
- //
- // Adjust the value to the correct one.
- // Sample like: 2012.02.29 -> 2013.02.29 -> 2013.02.01
- // 2013.03.29 -> 2013.02.29 -> 2013.02.28
- //
- if (Question->OpCode->OpCode == EFI_IFR_DATE_OP &&
- (MenuOption->Sequence == 0 || MenuOption->Sequence == 2)) {
- AdjustQuestionValue (QuestionValue, (UINT8)MenuOption->Sequence);
- }
+ return EFI_SUCCESS;
- return EFI_SUCCESS;
+ case CHAR_BACKSPACE:
+ if (ManualInput) {
+ if (Count == 0) {
+ if (Negative) {
+ Negative = FALSE;
+ Column--;
+ PrintStringAt (Column, Row, L" ");
+ }
- case CHAR_BACKSPACE:
- if (ManualInput) {
- if (Count == 0) {
- if (Negative) {
- Negative = FALSE;
- Column--;
- PrintStringAt (Column, Row, L" ");
+ break;
}
- break;
+
+ //
+ // Remove a character
+ //
+ EditValue = PreviousNumber[Count - 1];
+ UpdateStatusBar (INPUT_ERROR, FALSE);
+ Count--;
+ Column--;
+ PrintStringAt (Column, Row, L" ");
}
- //
- // Remove a character
- //
- EditValue = PreviousNumber[Count - 1];
- UpdateStatusBar (INPUT_ERROR, FALSE);
- Count--;
- Column--;
- PrintStringAt (Column, Row, L" ");
- }
- break;
- default:
- if (ManualInput) {
- if (HexInput) {
- if ((Key.UnicodeChar >= L'0') && (Key.UnicodeChar <= L'9')) {
- Digital = (UINT8) (Key.UnicodeChar - L'0');
- } else if ((Key.UnicodeChar >= L'A') && (Key.UnicodeChar <= L'F')) {
- Digital = (UINT8) (Key.UnicodeChar - L'A' + 0x0A);
- } else if ((Key.UnicodeChar >= L'a') && (Key.UnicodeChar <= L'f')) {
- Digital = (UINT8) (Key.UnicodeChar - L'a' + 0x0A);
+ break;
+
+ default:
+ if (ManualInput) {
+ if (HexInput) {
+ if ((Key.UnicodeChar >= L'0') && (Key.UnicodeChar <= L'9')) {
+ Digital = (UINT8)(Key.UnicodeChar - L'0');
+ } else if ((Key.UnicodeChar >= L'A') && (Key.UnicodeChar <= L'F')) {
+ Digital = (UINT8)(Key.UnicodeChar - L'A' + 0x0A);
+ } else if ((Key.UnicodeChar >= L'a') && (Key.UnicodeChar <= L'f')) {
+ Digital = (UINT8)(Key.UnicodeChar - L'a' + 0x0A);
+ } else {
+ UpdateStatusBar (INPUT_ERROR, TRUE);
+ break;
+ }
} else {
- UpdateStatusBar (INPUT_ERROR, TRUE);
- break;
+ if ((Key.UnicodeChar > L'9') || (Key.UnicodeChar < L'0')) {
+ UpdateStatusBar (INPUT_ERROR, TRUE);
+ break;
+ }
}
- } else {
- if (Key.UnicodeChar > L'9' || Key.UnicodeChar < L'0') {
- UpdateStatusBar (INPUT_ERROR, TRUE);
+
+ //
+ // If Count exceed input width, there is no way more is valid
+ //
+ if (Count >= InputWidth) {
break;
}
- }
- //
- // If Count exceed input width, there is no way more is valid
- //
- if (Count >= InputWidth) {
- break;
- }
- //
- // Someone typed something valid!
- //
- if (Count != 0) {
- if (HexInput) {
- EditValue = LShiftU64 (EditValue, 4) + Digital;
- } else if (IntInput && Negative) {
- //
- // Save the negative number.
- //
- EditValue = ~(MultU64x32 (~(EditValue - 1), 10) + (Key.UnicodeChar - L'0')) + 1;
+ //
+ // Someone typed something valid!
+ //
+ if (Count != 0) {
+ if (HexInput) {
+ EditValue = LShiftU64 (EditValue, 4) + Digital;
+ } else if (IntInput && Negative) {
+ //
+ // Save the negative number.
+ //
+ EditValue = ~(MultU64x32 (~(EditValue - 1), 10) + (Key.UnicodeChar - L'0')) + 1;
+ } else {
+ EditValue = MultU64x32 (EditValue, 10) + (Key.UnicodeChar - L'0');
+ }
} else {
- EditValue = MultU64x32 (EditValue, 10) + (Key.UnicodeChar - L'0');
+ if (HexInput) {
+ EditValue = Digital;
+ } else if (IntInput && Negative) {
+ //
+ // Save the negative number.
+ //
+ EditValue = ~(Key.UnicodeChar - L'0') + 1;
+ } else {
+ EditValue = Key.UnicodeChar - L'0';
+ }
}
- } else {
- if (HexInput) {
- EditValue = Digital;
- } else if (IntInput && Negative) {
+
+ if (IntInput) {
+ ValidateFail = FALSE;
//
- // Save the negative number.
+ // When user input a new value, should check the current value.
+ // If user input a negative value, should compare it with minimum
+ // value, else compare it with maximum value.
//
- EditValue = ~(Key.UnicodeChar - L'0') + 1;
- } else {
- EditValue = Key.UnicodeChar - L'0';
- }
- }
+ if (Negative) {
+ ValidateFail = (INT64)EditValue < (INT64)Minimum ? TRUE : FALSE;
+ } else {
+ ValidateFail = (INT64)EditValue > (INT64)Maximum ? TRUE : FALSE;
+ }
- if (IntInput) {
- ValidateFail = FALSE;
- //
- // When user input a new value, should check the current value.
- // If user input a negative value, should compare it with minimum
- // value, else compare it with maximum value.
- //
- if (Negative) {
- ValidateFail = (INT64) EditValue < (INT64) Minimum ? TRUE : FALSE;
+ if (ValidateFail) {
+ UpdateStatusBar (INPUT_ERROR, TRUE);
+ ASSERT (Count < ARRAY_SIZE (PreviousNumber));
+ EditValue = PreviousNumber[Count];
+ break;
+ }
} else {
- ValidateFail = (INT64) EditValue > (INT64) Maximum ? TRUE : FALSE;
+ if (EditValue > Maximum) {
+ UpdateStatusBar (INPUT_ERROR, TRUE);
+ ASSERT (Count < ARRAY_SIZE (PreviousNumber));
+ EditValue = PreviousNumber[Count];
+ break;
+ }
}
- if (ValidateFail) {
- UpdateStatusBar (INPUT_ERROR, TRUE);
- ASSERT (Count < ARRAY_SIZE (PreviousNumber));
- EditValue = PreviousNumber[Count];
- break;
- }
- } else {
- if (EditValue > Maximum) {
- UpdateStatusBar (INPUT_ERROR, TRUE);
- ASSERT (Count < ARRAY_SIZE (PreviousNumber));
- EditValue = PreviousNumber[Count];
- break;
- }
- }
+ UpdateStatusBar (INPUT_ERROR, FALSE);
- UpdateStatusBar (INPUT_ERROR, FALSE);
+ Count++;
+ ASSERT (Count < (ARRAY_SIZE (PreviousNumber)));
+ PreviousNumber[Count] = EditValue;
- Count++;
- ASSERT (Count < (ARRAY_SIZE (PreviousNumber)));
- PreviousNumber[Count] = EditValue;
+ gST->ConOut->SetAttribute (gST->ConOut, GetHighlightTextColor ());
+ PrintCharAt (Column, Row, Key.UnicodeChar);
+ Column++;
+ }
- gST->ConOut->SetAttribute (gST->ConOut, GetHighlightTextColor ());
- PrintCharAt (Column, Row, Key.UnicodeChar);
- Column++;
- }
- break;
+ break;
}
} while (TRUE);
}
@@ -1111,19 +1134,19 @@ AdjustOptionOrder (
OUT UINTN *PopUpMenuLines
)
{
- UINTN Index;
- EFI_IFR_ORDERED_LIST *OrderList;
- UINT8 *ValueArray;
- UINT8 ValueType;
- LIST_ENTRY *Link;
- DISPLAY_QUESTION_OPTION *OneOfOption;
- EFI_HII_VALUE *HiiValueArray;
+ UINTN Index;
+ EFI_IFR_ORDERED_LIST *OrderList;
+ UINT8 *ValueArray;
+ UINT8 ValueType;
+ LIST_ENTRY *Link;
+ DISPLAY_QUESTION_OPTION *OneOfOption;
+ EFI_HII_VALUE *HiiValueArray;
Link = GetFirstNode (&Question->OptionListHead);
OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
ValueArray = Question->CurrentValue.Buffer;
ValueType = OneOfOption->OptionOpCode->Type;
- OrderList = (EFI_IFR_ORDERED_LIST *) Question->OpCode;
+ OrderList = (EFI_IFR_ORDERED_LIST *)Question->OpCode;
for (Index = 0; Index < OrderList->MaxContainers; Index++) {
if (GetArrayData (ValueArray, ValueType, Index) == 0) {
@@ -1140,7 +1163,7 @@ AdjustOptionOrder (
ASSERT (HiiValueArray != NULL);
for (Index = 0; Index < *PopUpMenuLines; Index++) {
- HiiValueArray[Index].Type = ValueType;
+ HiiValueArray[Index].Type = ValueType;
HiiValueArray[Index].Value.u64 = GetArrayData (ValueArray, ValueType, Index);
}
@@ -1176,28 +1199,28 @@ AdjustOptionOrder (
**/
BOOLEAN
IsValuesEqual (
- IN EFI_IFR_TYPE_VALUE *Value1,
- IN EFI_IFR_TYPE_VALUE *Value2,
- IN UINT8 Type
+ IN EFI_IFR_TYPE_VALUE *Value1,
+ IN EFI_IFR_TYPE_VALUE *Value2,
+ IN UINT8 Type
)
{
switch (Type) {
- case EFI_IFR_TYPE_BOOLEAN:
- case EFI_IFR_TYPE_NUM_SIZE_8:
- return (BOOLEAN) (Value1->u8 == Value2->u8);
+ case EFI_IFR_TYPE_BOOLEAN:
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ return (BOOLEAN)(Value1->u8 == Value2->u8);
- case EFI_IFR_TYPE_NUM_SIZE_16:
- return (BOOLEAN) (Value1->u16 == Value2->u16);
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ return (BOOLEAN)(Value1->u16 == Value2->u16);
- case EFI_IFR_TYPE_NUM_SIZE_32:
- return (BOOLEAN) (Value1->u32 == Value2->u32);
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ return (BOOLEAN)(Value1->u32 == Value2->u32);
- case EFI_IFR_TYPE_NUM_SIZE_64:
- return (BOOLEAN) (Value1->u64 == Value2->u64);
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ return (BOOLEAN)(Value1->u64 == Value2->u64);
- default:
- ASSERT (FALSE);
- return FALSE;
+ default:
+ ASSERT (FALSE);
+ return FALSE;
}
}
@@ -1211,35 +1234,35 @@ IsValuesEqual (
**/
VOID
SetValuesByType (
- OUT EFI_IFR_TYPE_VALUE *Dest,
- IN EFI_IFR_TYPE_VALUE *Source,
- IN UINT8 Type
+ OUT EFI_IFR_TYPE_VALUE *Dest,
+ IN EFI_IFR_TYPE_VALUE *Source,
+ IN UINT8 Type
)
{
switch (Type) {
- case EFI_IFR_TYPE_BOOLEAN:
- Dest->b = Source->b;
- break;
+ case EFI_IFR_TYPE_BOOLEAN:
+ Dest->b = Source->b;
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_8:
- Dest->u8 = Source->u8;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ Dest->u8 = Source->u8;
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_16:
- Dest->u16 = Source->u16;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ Dest->u16 = Source->u16;
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_32:
- Dest->u32 = Source->u32;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ Dest->u32 = Source->u32;
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_64:
- Dest->u64 = Source->u64;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ Dest->u64 = Source->u64;
+ break;
- default:
- ASSERT (FALSE);
- break;
+ default:
+ ASSERT (FALSE);
+ break;
}
}
@@ -1254,61 +1277,61 @@ SetValuesByType (
**/
EFI_STATUS
GetSelectionInputPopUp (
- IN UI_MENU_OPTION *MenuOption
+ IN UI_MENU_OPTION *MenuOption
)
{
- EFI_INPUT_KEY Key;
- UINTN Index;
- CHAR16 *StringPtr;
- CHAR16 *TempStringPtr;
- UINTN Index2;
- UINTN TopOptionIndex;
- UINTN HighlightOptionIndex;
- UINTN Start;
- UINTN End;
- UINTN Top;
- UINTN Bottom;
- UINTN PopUpMenuLines;
- UINTN MenuLinesInView;
- UINTN PopUpWidth;
- CHAR16 Character;
- INT32 SavedAttribute;
- BOOLEAN ShowDownArrow;
- BOOLEAN ShowUpArrow;
- UINTN DimensionsWidth;
- LIST_ENTRY *Link;
- BOOLEAN OrderedList;
- UINT8 *ValueArray;
- UINT8 *ReturnValue;
- UINT8 ValueType;
- EFI_HII_VALUE HiiValue;
- DISPLAY_QUESTION_OPTION *OneOfOption;
- DISPLAY_QUESTION_OPTION *CurrentOption;
+ EFI_INPUT_KEY Key;
+ UINTN Index;
+ CHAR16 *StringPtr;
+ CHAR16 *TempStringPtr;
+ UINTN Index2;
+ UINTN TopOptionIndex;
+ UINTN HighlightOptionIndex;
+ UINTN Start;
+ UINTN End;
+ UINTN Top;
+ UINTN Bottom;
+ UINTN PopUpMenuLines;
+ UINTN MenuLinesInView;
+ UINTN PopUpWidth;
+ CHAR16 Character;
+ INT32 SavedAttribute;
+ BOOLEAN ShowDownArrow;
+ BOOLEAN ShowUpArrow;
+ UINTN DimensionsWidth;
+ LIST_ENTRY *Link;
+ BOOLEAN OrderedList;
+ UINT8 *ValueArray;
+ UINT8 *ReturnValue;
+ UINT8 ValueType;
+ EFI_HII_VALUE HiiValue;
+ DISPLAY_QUESTION_OPTION *OneOfOption;
+ DISPLAY_QUESTION_OPTION *CurrentOption;
FORM_DISPLAY_ENGINE_STATEMENT *Question;
- INTN Result;
- EFI_IFR_ORDERED_LIST *OrderList;
+ INTN Result;
+ EFI_IFR_ORDERED_LIST *OrderList;
- DimensionsWidth = gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn;
+ DimensionsWidth = gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn;
- ValueArray = NULL;
- ValueType = 0;
- CurrentOption = NULL;
- ShowDownArrow = FALSE;
- ShowUpArrow = FALSE;
+ ValueArray = NULL;
+ ValueType = 0;
+ CurrentOption = NULL;
+ ShowDownArrow = FALSE;
+ ShowUpArrow = FALSE;
ZeroMem (&HiiValue, sizeof (EFI_HII_VALUE));
Question = MenuOption->ThisTag;
if (Question->OpCode->OpCode == EFI_IFR_ORDERED_LIST_OP) {
- Link = GetFirstNode (&Question->OptionListHead);
+ Link = GetFirstNode (&Question->OptionListHead);
OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
- ValueArray = Question->CurrentValue.Buffer;
- ValueType = OneOfOption->OptionOpCode->Type;
+ ValueArray = Question->CurrentValue.Buffer;
+ ValueType = OneOfOption->OptionOpCode->Type;
OrderedList = TRUE;
- OrderList = (EFI_IFR_ORDERED_LIST *) Question->OpCode;
+ OrderList = (EFI_IFR_ORDERED_LIST *)Question->OpCode;
} else {
OrderedList = FALSE;
- OrderList = NULL;
+ OrderList = NULL;
}
//
@@ -1316,7 +1339,7 @@ GetSelectionInputPopUp (
//
PopUpMenuLines = 0;
if (OrderedList) {
- AdjustOptionOrder(Question, &PopUpMenuLines);
+ AdjustOptionOrder (Question, &PopUpMenuLines);
} else {
Link = GetFirstNode (&Question->OptionListHead);
while (!IsNull (&Question->OptionListHead, Link)) {
@@ -1329,9 +1352,9 @@ GetSelectionInputPopUp (
//
// Get the number of one of options present and its size
//
- PopUpWidth = 0;
+ PopUpWidth = 0;
HighlightOptionIndex = 0;
- Link = GetFirstNode (&Question->OptionListHead);
+ Link = GetFirstNode (&Question->OptionListHead);
for (Index = 0; Index < PopUpMenuLines; Index++) {
OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
@@ -1339,6 +1362,7 @@ GetSelectionInputPopUp (
if (StrLen (StringPtr) > PopUpWidth) {
PopUpWidth = StrLen (StringPtr);
}
+
FreePool (StringPtr);
HiiValue.Type = OneOfOption->OptionOpCode->Type;
SetValuesByType (&HiiValue.Value, &OneOfOption->OptionOpCode->Value, HiiValue.Type);
@@ -1371,8 +1395,8 @@ GetSelectionInputPopUp (
MenuLinesInView = Bottom - Top - 1;
if (MenuLinesInView >= PopUpMenuLines) {
- Top = Top + (MenuLinesInView - PopUpMenuLines) / 2;
- Bottom = Top + PopUpMenuLines + 1;
+ Top = Top + (MenuLinesInView - PopUpMenuLines) / 2;
+ Bottom = Top + PopUpMenuLines + 1;
} else {
ShowDownArrow = TRUE;
}
@@ -1426,7 +1450,7 @@ GetSelectionInputPopUp (
Index2 = Top + 1;
for (Index = TopOptionIndex; (Index < PopUpMenuLines) && (Index2 < Bottom); Index++) {
OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
- Link = GetNextNode (&Question->OptionListHead, Link);
+ Link = GetNextNode (&Question->OptionListHead, Link);
StringPtr = GetToken (OneOfOption->OptionOpCode->Option, gFormData->HiiHandle);
ASSERT (StringPtr != NULL);
@@ -1436,7 +1460,7 @@ GetSelectionInputPopUp (
//
if (StrLen (StringPtr) > (PopUpWidth - 1)) {
TempStringPtr = AllocateZeroPool (sizeof (CHAR16) * (PopUpWidth - 1));
- ASSERT ( TempStringPtr != NULL );
+ ASSERT (TempStringPtr != NULL);
CopyMem (TempStringPtr, StringPtr, (sizeof (CHAR16) * (PopUpWidth - 5)));
FreePool (StringPtr);
StringPtr = TempStringPtr;
@@ -1444,18 +1468,18 @@ GetSelectionInputPopUp (
}
if (Index == HighlightOptionIndex) {
- //
- // Highlight the selected one
- //
- CurrentOption = OneOfOption;
+ //
+ // Highlight the selected one
+ //
+ CurrentOption = OneOfOption;
- gST->ConOut->SetAttribute (gST->ConOut, GetPickListColor ());
- PrintStringAt (Start + 2, Index2, StringPtr);
- gST->ConOut->SetAttribute (gST->ConOut, GetPopupColor ());
- } else {
- gST->ConOut->SetAttribute (gST->ConOut, GetPopupColor ());
- PrintStringAt (Start + 2, Index2, StringPtr);
- }
+ gST->ConOut->SetAttribute (gST->ConOut, GetPickListColor ());
+ PrintStringAt (Start + 2, Index2, StringPtr);
+ gST->ConOut->SetAttribute (gST->ConOut, GetPopupColor ());
+ } else {
+ gST->ConOut->SetAttribute (gST->ConOut, GetPopupColor ());
+ PrintStringAt (Start + 2, Index2, StringPtr);
+ }
Index2++;
FreePool (StringPtr);
@@ -1481,8 +1505,8 @@ GetSelectionInputPopUp (
//
Key.UnicodeChar = CHAR_NULL;
if ((gDirection == SCAN_UP) || (gDirection == SCAN_DOWN)) {
- Key.ScanCode = gDirection;
- gDirection = 0;
+ Key.ScanCode = gDirection;
+ gDirection = 0;
goto TheKey;
}
@@ -1490,62 +1514,8 @@ GetSelectionInputPopUp (
TheKey:
switch (Key.UnicodeChar) {
- case '+':
- if (OrderedList) {
- if ((TopOptionIndex > 0) && (TopOptionIndex == HighlightOptionIndex)) {
- //
- // Highlight reaches the top of the popup window, scroll one menu item.
- //
- TopOptionIndex--;
- ShowDownArrow = TRUE;
- }
-
- if (TopOptionIndex == 0) {
- ShowUpArrow = FALSE;
- }
-
- if (HighlightOptionIndex > 0) {
- HighlightOptionIndex--;
-
- ASSERT (CurrentOption != NULL);
- SwapListEntries (CurrentOption->Link.BackLink, &CurrentOption->Link);
- }
- }
- break;
-
- case '-':
- //
- // If an ordered list op-code, we will allow for a popup of +/- keys
- // to create an ordered list of items
- //
- if (OrderedList) {
- if (((TopOptionIndex + MenuLinesInView) < PopUpMenuLines) &&
- (HighlightOptionIndex == (TopOptionIndex + MenuLinesInView - 1))) {
- //
- // Highlight reaches the bottom of the popup window, scroll one menu item.
- //
- TopOptionIndex++;
- ShowUpArrow = TRUE;
- }
-
- if ((TopOptionIndex + MenuLinesInView) == PopUpMenuLines) {
- ShowDownArrow = FALSE;
- }
-
- if (HighlightOptionIndex < (PopUpMenuLines - 1)) {
- HighlightOptionIndex++;
-
- ASSERT (CurrentOption != NULL);
- SwapListEntries (&CurrentOption->Link, CurrentOption->Link.ForwardLink);
- }
- }
- break;
-
- case CHAR_NULL:
- switch (Key.ScanCode) {
- case SCAN_UP:
- case SCAN_DOWN:
- if (Key.ScanCode == SCAN_UP) {
+ case '+':
+ if (OrderedList) {
if ((TopOptionIndex > 0) && (TopOptionIndex == HighlightOptionIndex)) {
//
// Highlight reaches the top of the popup window, scroll one menu item.
@@ -1560,10 +1530,23 @@ TheKey:
if (HighlightOptionIndex > 0) {
HighlightOptionIndex--;
+
+ ASSERT (CurrentOption != NULL);
+ SwapListEntries (CurrentOption->Link.BackLink, &CurrentOption->Link);
}
- } else {
+ }
+
+ break;
+
+ case '-':
+ //
+ // If an ordered list op-code, we will allow for a popup of +/- keys
+ // to create an ordered list of items
+ //
+ if (OrderedList) {
if (((TopOptionIndex + MenuLinesInView) < PopUpMenuLines) &&
- (HighlightOptionIndex == (TopOptionIndex + MenuLinesInView - 1))) {
+ (HighlightOptionIndex == (TopOptionIndex + MenuLinesInView - 1)))
+ {
//
// Highlight reaches the bottom of the popup window, scroll one menu item.
//
@@ -1577,88 +1560,133 @@ TheKey:
if (HighlightOptionIndex < (PopUpMenuLines - 1)) {
HighlightOptionIndex++;
+
+ ASSERT (CurrentOption != NULL);
+ SwapListEntries (&CurrentOption->Link, CurrentOption->Link.ForwardLink);
}
}
+
break;
- case SCAN_ESC:
- gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);
+ case CHAR_NULL:
+ switch (Key.ScanCode) {
+ case SCAN_UP:
+ case SCAN_DOWN:
+ if (Key.ScanCode == SCAN_UP) {
+ if ((TopOptionIndex > 0) && (TopOptionIndex == HighlightOptionIndex)) {
+ //
+ // Highlight reaches the top of the popup window, scroll one menu item.
+ //
+ TopOptionIndex--;
+ ShowDownArrow = TRUE;
+ }
- //
- // Restore link list order for orderedlist
- //
- if (OrderedList) {
- HiiValue.Type = ValueType;
- HiiValue.Value.u64 = 0;
- for (Index = 0; Index < OrderList->MaxContainers; Index++) {
- HiiValue.Value.u64 = GetArrayData (ValueArray, ValueType, Index);
- if (HiiValue.Value.u64 == 0) {
- break;
+ if (TopOptionIndex == 0) {
+ ShowUpArrow = FALSE;
+ }
+
+ if (HighlightOptionIndex > 0) {
+ HighlightOptionIndex--;
+ }
+ } else {
+ if (((TopOptionIndex + MenuLinesInView) < PopUpMenuLines) &&
+ (HighlightOptionIndex == (TopOptionIndex + MenuLinesInView - 1)))
+ {
+ //
+ // Highlight reaches the bottom of the popup window, scroll one menu item.
+ //
+ TopOptionIndex++;
+ ShowUpArrow = TRUE;
+ }
+
+ if ((TopOptionIndex + MenuLinesInView) == PopUpMenuLines) {
+ ShowDownArrow = FALSE;
+ }
+
+ if (HighlightOptionIndex < (PopUpMenuLines - 1)) {
+ HighlightOptionIndex++;
+ }
}
- OneOfOption = ValueToOption (Question, &HiiValue);
- if (OneOfOption == NULL) {
- return EFI_NOT_FOUND;
+ break;
+
+ case SCAN_ESC:
+ gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);
+
+ //
+ // Restore link list order for orderedlist
+ //
+ if (OrderedList) {
+ HiiValue.Type = ValueType;
+ HiiValue.Value.u64 = 0;
+ for (Index = 0; Index < OrderList->MaxContainers; Index++) {
+ HiiValue.Value.u64 = GetArrayData (ValueArray, ValueType, Index);
+ if (HiiValue.Value.u64 == 0) {
+ break;
+ }
+
+ OneOfOption = ValueToOption (Question, &HiiValue);
+ if (OneOfOption == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ RemoveEntryList (&OneOfOption->Link);
+ InsertTailList (&Question->OptionListHead, &OneOfOption->Link);
+ }
}
- RemoveEntryList (&OneOfOption->Link);
- InsertTailList (&Question->OptionListHead, &OneOfOption->Link);
- }
- }
+ return EFI_DEVICE_ERROR;
- return EFI_DEVICE_ERROR;
+ default:
+ break;
+ }
- default:
break;
- }
- break;
+ case CHAR_CARRIAGE_RETURN:
+ //
+ // return the current selection
+ //
+ if (OrderedList) {
+ ReturnValue = AllocateZeroPool (Question->CurrentValue.BufferLen);
+ ASSERT (ReturnValue != NULL);
+ Index = 0;
+ Link = GetFirstNode (&Question->OptionListHead);
+ while (!IsNull (&Question->OptionListHead, Link)) {
+ OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
+ Link = GetNextNode (&Question->OptionListHead, Link);
+
+ SetArrayData (ReturnValue, ValueType, Index, OneOfOption->OptionOpCode->Value.u64);
+
+ Index++;
+ if (Index > OrderList->MaxContainers) {
+ break;
+ }
+ }
- case CHAR_CARRIAGE_RETURN:
- //
- // return the current selection
- //
- if (OrderedList) {
- ReturnValue = AllocateZeroPool (Question->CurrentValue.BufferLen);
- ASSERT (ReturnValue != NULL);
- Index = 0;
- Link = GetFirstNode (&Question->OptionListHead);
- while (!IsNull (&Question->OptionListHead, Link)) {
- OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
- Link = GetNextNode (&Question->OptionListHead, Link);
-
- SetArrayData (ReturnValue, ValueType, Index, OneOfOption->OptionOpCode->Value.u64);
-
- Index++;
- if (Index > OrderList->MaxContainers) {
- break;
+ if (CompareMem (ReturnValue, ValueArray, Question->CurrentValue.BufferLen) == 0) {
+ FreePool (ReturnValue);
+ return EFI_DEVICE_ERROR;
+ } else {
+ gUserInput->InputValue.Buffer = ReturnValue;
+ gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
}
- }
- if (CompareMem (ReturnValue, ValueArray, Question->CurrentValue.BufferLen) == 0) {
- FreePool (ReturnValue);
- return EFI_DEVICE_ERROR;
} else {
- gUserInput->InputValue.Buffer = ReturnValue;
- gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
- }
- } else {
- ASSERT (CurrentOption != NULL);
- gUserInput->InputValue.Type = CurrentOption->OptionOpCode->Type;
- if (IsValuesEqual (&Question->CurrentValue.Value, &CurrentOption->OptionOpCode->Value, gUserInput->InputValue.Type)) {
- return EFI_DEVICE_ERROR;
- } else {
- SetValuesByType (&gUserInput->InputValue.Value, &CurrentOption->OptionOpCode->Value, gUserInput->InputValue.Type);
+ ASSERT (CurrentOption != NULL);
+ gUserInput->InputValue.Type = CurrentOption->OptionOpCode->Type;
+ if (IsValuesEqual (&Question->CurrentValue.Value, &CurrentOption->OptionOpCode->Value, gUserInput->InputValue.Type)) {
+ return EFI_DEVICE_ERROR;
+ } else {
+ SetValuesByType (&gUserInput->InputValue.Value, &CurrentOption->OptionOpCode->Value, gUserInput->InputValue.Type);
+ }
}
- }
- gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);
+ gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);
- return EFI_SUCCESS;
+ return EFI_SUCCESS;
- default:
- break;
+ default:
+ break;
}
} while (TRUE);
-
}
-
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/Popup.c b/MdeModulePkg/Universal/DisplayEngineDxe/Popup.c
index a597a5d8ac..9954c4e4d5 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/Popup.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/Popup.c
@@ -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;
-
- Status = EFI_SUCCESS;
- EndCol = gPopupDimensions.RightColumn;
- StartCol = gPopupDimensions.LeftColumn;
- OptionRow = gPopupDimensions.BottomRow - POPUP_BORDER;
+ 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;
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;
+ 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;
- default:
- break;
- }
- break;
- 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;
- return;
- } else if ((KeyValue.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (*gConfirmOptNo| UPPER_LOWER_CASE_OFFSET) &&
- (PopupType == EfiHiiPopupTypeYesNo || PopupType == EfiHiiPopupTypeYesNoCancel)){
- *UserSelection = EfiHiiPopupSelectionNo;
+ case CHAR_CARRIAGE_RETURN:
+ *UserSelection = HighlightOption->OptionType;
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;
-
- EndCol = gPopupDimensions.RightColumn;
- TopRow = gPopupDimensions.TopRow;
- StartCol = gPopupDimensions.LeftColumn;
- BottomRow = gPopupDimensions.BottomRow;
- ColDimension = EndCol - StartCol + 1;
+ 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;
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;
}
-
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
index c02e36a63a..dca3c1df07 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
@@ -22,15 +22,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
NewStrCat (
- IN OUT CHAR16 *Destination,
- IN UINTN DestMax,
- IN CHAR16 *Source
+ IN OUT CHAR16 *Destination,
+ IN UINTN DestMax,
+ IN CHAR16 *Source
)
{
- UINTN Length;
+ UINTN Length;
- for (Length = 0; Destination[Length] != 0; Length++)
- ;
+ for (Length = 0; Destination[Length] != 0; Length++) {
+ }
//
// We now have the length of the original string
@@ -54,7 +54,7 @@ NewStrCat (
**/
UINT64
HiiValueToUINT64 (
- IN EFI_HII_VALUE *Value
+ IN EFI_HII_VALUE *Value
)
{
UINT64 RetVal;
@@ -62,33 +62,33 @@ HiiValueToUINT64 (
RetVal = 0;
switch (Value->Type) {
- case EFI_IFR_TYPE_NUM_SIZE_8:
- RetVal = Value->Value.u8;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ RetVal = Value->Value.u8;
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_16:
- RetVal = Value->Value.u16;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ RetVal = Value->Value.u16;
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_32:
- RetVal = Value->Value.u32;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ RetVal = Value->Value.u32;
+ break;
- case EFI_IFR_TYPE_BOOLEAN:
- RetVal = Value->Value.b;
- break;
+ case EFI_IFR_TYPE_BOOLEAN:
+ RetVal = Value->Value.b;
+ break;
- case EFI_IFR_TYPE_DATE:
- RetVal = *(UINT64*) &Value->Value.date;
- break;
+ case EFI_IFR_TYPE_DATE:
+ RetVal = *(UINT64 *)&Value->Value.date;
+ break;
- case EFI_IFR_TYPE_TIME:
- RetVal = (*(UINT64*) &Value->Value.time) & 0xffffff;
- break;
+ case EFI_IFR_TYPE_TIME:
+ RetVal = (*(UINT64 *)&Value->Value.time) & 0xffffff;
+ break;
- default:
- RetVal = Value->Value.u64;
- break;
+ default:
+ RetVal = Value->Value.u64;
+ break;
}
return RetVal;
@@ -108,18 +108,18 @@ HiiValueToUINT64 (
**/
BOOLEAN
IsTypeInBuffer (
- IN EFI_HII_VALUE *Value
+ IN EFI_HII_VALUE *Value
)
{
switch (Value->Type) {
- case EFI_IFR_TYPE_BUFFER:
- case EFI_IFR_TYPE_DATE:
- case EFI_IFR_TYPE_TIME:
- case EFI_IFR_TYPE_REF:
- return TRUE;
-
- default:
- return FALSE;
+ case EFI_IFR_TYPE_BUFFER:
+ case EFI_IFR_TYPE_DATE:
+ case EFI_IFR_TYPE_TIME:
+ case EFI_IFR_TYPE_REF:
+ return TRUE;
+
+ default:
+ return FALSE;
}
}
@@ -134,19 +134,19 @@ IsTypeInBuffer (
**/
BOOLEAN
IsTypeInUINT64 (
- IN EFI_HII_VALUE *Value
+ IN EFI_HII_VALUE *Value
)
{
switch (Value->Type) {
- case EFI_IFR_TYPE_NUM_SIZE_8:
- case EFI_IFR_TYPE_NUM_SIZE_16:
- case EFI_IFR_TYPE_NUM_SIZE_32:
- case EFI_IFR_TYPE_NUM_SIZE_64:
- case EFI_IFR_TYPE_BOOLEAN:
- return TRUE;
-
- default:
- return FALSE;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ case EFI_IFR_TYPE_BOOLEAN:
+ return TRUE;
+
+ default:
+ return FALSE;
}
}
@@ -163,35 +163,35 @@ IsTypeInUINT64 (
**/
VOID
GetBufAndLenForValue (
- IN EFI_HII_VALUE *Value,
- OUT UINT8 **Buf,
- OUT UINT16 *BufLen
+ IN EFI_HII_VALUE *Value,
+ OUT UINT8 **Buf,
+ OUT UINT16 *BufLen
)
{
switch (Value->Type) {
- case EFI_IFR_TYPE_BUFFER:
- *Buf = Value->Buffer;
- *BufLen = Value->BufferLen;
- break;
-
- case EFI_IFR_TYPE_DATE:
- *Buf = (UINT8 *) (&Value->Value.date);
- *BufLen = (UINT16) sizeof (EFI_HII_DATE);
- break;
-
- case EFI_IFR_TYPE_TIME:
- *Buf = (UINT8 *) (&Value->Value.time);
- *BufLen = (UINT16) sizeof (EFI_HII_TIME);
- break;
-
- case EFI_IFR_TYPE_REF:
- *Buf = (UINT8 *) (&Value->Value.ref);
- *BufLen = (UINT16) sizeof (EFI_HII_REF);
- break;
-
- default:
- *Buf = NULL;
- *BufLen = 0;
+ case EFI_IFR_TYPE_BUFFER:
+ *Buf = Value->Buffer;
+ *BufLen = Value->BufferLen;
+ break;
+
+ case EFI_IFR_TYPE_DATE:
+ *Buf = (UINT8 *)(&Value->Value.date);
+ *BufLen = (UINT16)sizeof (EFI_HII_DATE);
+ break;
+
+ case EFI_IFR_TYPE_TIME:
+ *Buf = (UINT8 *)(&Value->Value.time);
+ *BufLen = (UINT16)sizeof (EFI_HII_TIME);
+ break;
+
+ case EFI_IFR_TYPE_REF:
+ *Buf = (UINT8 *)(&Value->Value.ref);
+ *BufLen = (UINT16)sizeof (EFI_HII_REF);
+ break;
+
+ default:
+ *Buf = NULL;
+ *BufLen = 0;
}
}
@@ -227,8 +227,8 @@ CompareHiiValue (
UINT8 *Buf2;
UINT16 Buf2Len;
- if (Value1->Type == EFI_IFR_TYPE_STRING && Value2->Type == EFI_IFR_TYPE_STRING) {
- if (Value1->Value.string == 0 || Value2->Value.string == 0) {
+ if ((Value1->Type == EFI_IFR_TYPE_STRING) && (Value2->Type == EFI_IFR_TYPE_STRING)) {
+ if ((Value1->Value.string == 0) || (Value2->Value.string == 0)) {
//
// StringId 0 is reserved
//
@@ -265,11 +265,11 @@ CompareHiiValue (
//
// Take types(date, time, ref, buffer) as buffer
//
- if (IsTypeInBuffer(Value1) && IsTypeInBuffer(Value2)) {
- GetBufAndLenForValue(Value1, &Buf1, &Buf1Len);
- GetBufAndLenForValue(Value2, &Buf2, &Buf2Len);
+ if (IsTypeInBuffer (Value1) && IsTypeInBuffer (Value2)) {
+ GetBufAndLenForValue (Value1, &Buf1, &Buf1Len);
+ GetBufAndLenForValue (Value2, &Buf2, &Buf2Len);
- Len = Buf1Len > Buf2Len ? Buf2Len : Buf1Len;
+ Len = Buf1Len > Buf2Len ? Buf2Len : Buf1Len;
*Result = CompareMem (Buf1, Buf2, Len);
if ((*Result == 0) && (Buf1Len != Buf2Len)) {
//
@@ -278,14 +278,15 @@ CompareHiiValue (
//
*Result = Buf1Len > Buf2Len ? 1 : -1;
}
+
return EFI_SUCCESS;
}
//
// Take remain types(integer, boolean, date/time) as integer
//
- if (IsTypeInUINT64(Value1) && IsTypeInUINT64(Value2)) {
- Temp64 = HiiValueToUINT64(Value1) - HiiValueToUINT64(Value2);
+ if (IsTypeInUINT64 (Value1) && IsTypeInUINT64 (Value2)) {
+ Temp64 = HiiValueToUINT64 (Value1) - HiiValueToUINT64 (Value2);
if (Temp64 > 0) {
*Result = 1;
} else if (Temp64 < 0) {
@@ -293,6 +294,7 @@ CompareHiiValue (
} else {
*Result = 0;
}
+
return EFI_SUCCESS;
}
@@ -311,8 +313,8 @@ CompareHiiValue (
**/
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
)
{
LIST_ENTRY *Link;
@@ -338,7 +340,6 @@ ValueToOption (
return NULL;
}
-
/**
Return data element in an Array by its Index.
@@ -351,41 +352,40 @@ ValueToOption (
**/
UINT64
GetArrayData (
- IN VOID *Array,
- IN UINT8 Type,
- IN UINTN Index
+ IN VOID *Array,
+ IN UINT8 Type,
+ IN UINTN Index
)
{
- UINT64 Data;
+ UINT64 Data;
ASSERT (Array != NULL);
Data = 0;
switch (Type) {
- case EFI_IFR_TYPE_NUM_SIZE_8:
- Data = (UINT64) *(((UINT8 *) Array) + Index);
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ Data = (UINT64)*(((UINT8 *)Array) + Index);
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_16:
- Data = (UINT64) *(((UINT16 *) Array) + Index);
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ Data = (UINT64)*(((UINT16 *)Array) + Index);
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_32:
- Data = (UINT64) *(((UINT32 *) Array) + Index);
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ Data = (UINT64)*(((UINT32 *)Array) + Index);
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_64:
- Data = (UINT64) *(((UINT64 *) Array) + Index);
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ Data = (UINT64)*(((UINT64 *)Array) + Index);
+ break;
- default:
- break;
+ default:
+ break;
}
return Data;
}
-
/**
Set value of a data element in an Array by its Index.
@@ -397,34 +397,33 @@ GetArrayData (
**/
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
)
{
-
ASSERT (Array != NULL);
switch (Type) {
- case EFI_IFR_TYPE_NUM_SIZE_8:
- *(((UINT8 *) Array) + Index) = (UINT8) Value;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ *(((UINT8 *)Array) + Index) = (UINT8)Value;
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_16:
- *(((UINT16 *) Array) + Index) = (UINT16) Value;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ *(((UINT16 *)Array) + Index) = (UINT16)Value;
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_32:
- *(((UINT32 *) Array) + Index) = (UINT32) Value;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ *(((UINT32 *)Array) + Index) = (UINT32)Value;
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_64:
- *(((UINT64 *) Array) + Index) = (UINT64) Value;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ *(((UINT64 *)Array) + Index) = (UINT64)Value;
+ break;
- default:
- break;
+ default:
+ break;
}
}
@@ -442,15 +441,15 @@ SetArrayData (
**/
BOOLEAN
FindArrayData (
- IN VOID *Array,
- IN UINT8 Type,
- IN UINT64 Value,
- OUT UINTN *Index OPTIONAL
+ IN VOID *Array,
+ IN UINT8 Type,
+ IN UINT64 Value,
+ OUT UINTN *Index OPTIONAL
)
{
- UINTN Count;
- UINT64 TmpValue;
- UINT64 ValueComp;
+ UINTN Count;
+ UINT64 TmpValue;
+ UINT64 ValueComp;
ASSERT (Array != NULL);
@@ -458,25 +457,25 @@ FindArrayData (
TmpValue = 0;
switch (Type) {
- case EFI_IFR_TYPE_NUM_SIZE_8:
- ValueComp = (UINT8) Value;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ ValueComp = (UINT8)Value;
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_16:
- ValueComp = (UINT16) Value;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ ValueComp = (UINT16)Value;
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_32:
- ValueComp = (UINT32) Value;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ ValueComp = (UINT32)Value;
+ break;
- case EFI_IFR_TYPE_NUM_SIZE_64:
- ValueComp = (UINT64) Value;
- break;
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ ValueComp = (UINT64)Value;
+ break;
- default:
- ValueComp = 0;
- break;
+ default:
+ ValueComp = 0;
+ break;
}
while ((TmpValue = GetArrayData (Array, Type, Count)) != 0) {
@@ -484,10 +483,11 @@ FindArrayData (
if (Index != NULL) {
*Index = Count;
}
+
return TRUE;
}
- Count ++;
+ Count++;
}
return FALSE;
@@ -506,62 +506,63 @@ FindArrayData (
**/
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
)
{
- INT64 Value;
- CHAR16 *Format;
- EFI_HII_VALUE *QuestionValue;
- EFI_IFR_NUMERIC *NumericOp;
+ INT64 Value;
+ CHAR16 *Format;
+ EFI_HII_VALUE *QuestionValue;
+ EFI_IFR_NUMERIC *NumericOp;
if (BufferSize < (21 * sizeof (CHAR16))) {
return EFI_BUFFER_TOO_SMALL;
}
QuestionValue = &Question->CurrentValue;
- NumericOp = (EFI_IFR_NUMERIC *) Question->OpCode;
+ NumericOp = (EFI_IFR_NUMERIC *)Question->OpCode;
- Value = (INT64) QuestionValue->Value.u64;
+ Value = (INT64)QuestionValue->Value.u64;
switch (NumericOp->Flags & EFI_IFR_DISPLAY) {
- case EFI_IFR_DISPLAY_INT_DEC:
- switch (QuestionValue->Type) {
- case EFI_IFR_NUMERIC_SIZE_1:
- Value = (INT64) ((INT8) QuestionValue->Value.u8);
- break;
+ case EFI_IFR_DISPLAY_INT_DEC:
+ switch (QuestionValue->Type) {
+ case EFI_IFR_NUMERIC_SIZE_1:
+ Value = (INT64)((INT8)QuestionValue->Value.u8);
+ break;
- case EFI_IFR_NUMERIC_SIZE_2:
- Value = (INT64) ((INT16) QuestionValue->Value.u16);
- break;
+ case EFI_IFR_NUMERIC_SIZE_2:
+ Value = (INT64)((INT16)QuestionValue->Value.u16);
+ break;
- case EFI_IFR_NUMERIC_SIZE_4:
- Value = (INT64) ((INT32) QuestionValue->Value.u32);
- break;
+ case EFI_IFR_NUMERIC_SIZE_4:
+ Value = (INT64)((INT32)QuestionValue->Value.u32);
+ break;
+
+ case EFI_IFR_NUMERIC_SIZE_8:
+ default:
+ break;
+ }
+
+ if (Value < 0) {
+ Value = -Value;
+ Format = L"-%ld";
+ } else {
+ Format = L"%ld";
+ }
- case EFI_IFR_NUMERIC_SIZE_8:
- default:
break;
- }
- if (Value < 0) {
- Value = -Value;
- Format = L"-%ld";
- } else {
+ case EFI_IFR_DISPLAY_UINT_DEC:
Format = L"%ld";
- }
- break;
-
- case EFI_IFR_DISPLAY_UINT_DEC:
- Format = L"%ld";
- break;
+ break;
- case EFI_IFR_DISPLAY_UINT_HEX:
- Format = L"%lx";
- break;
+ case EFI_IFR_DISPLAY_UINT_HEX:
+ Format = L"%lx";
+ break;
- default:
- return EFI_UNSUPPORTED;
+ default:
+ return EFI_UNSUPPORTED;
}
UnicodeSPrint (FormattedNumber, BufferSize, Format, Value);
@@ -569,7 +570,6 @@ PrintFormattedNumber (
return EFI_SUCCESS;
}
-
/**
Draw a pop up windows based on the dimension, number of lines and
strings specified.
@@ -581,9 +581,9 @@ PrintFormattedNumber (
**/
VOID
CreateSharedPopUp (
- IN UINTN RequestedWidth,
- IN UINTN NumberOfLines,
- IN VA_LIST Marker
+ IN UINTN RequestedWidth,
+ IN UINTN NumberOfLines,
+ IN VA_LIST Marker
)
{
UINTN Index;
@@ -597,8 +597,8 @@ CreateSharedPopUp (
UINTN DimensionsWidth;
UINTN DimensionsHeight;
- DimensionsWidth = gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn;
- DimensionsHeight = gStatementDimensions.BottomRow - gStatementDimensions.TopRow;
+ DimensionsWidth = gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn;
+ DimensionsHeight = gStatementDimensions.BottomRow - gStatementDimensions.TopRow;
gST->ConOut->SetAttribute (gST->ConOut, GetPopupColor ());
@@ -610,11 +610,11 @@ CreateSharedPopUp (
// Subtract the PopUp width from total Columns, allow for one space extra on
// each end plus a border.
//
- Start = (DimensionsWidth - RequestedWidth - 2) / 2 + gStatementDimensions.LeftColumn + 1;
- End = Start + RequestedWidth + 1;
+ Start = (DimensionsWidth - RequestedWidth - 2) / 2 + gStatementDimensions.LeftColumn + 1;
+ End = Start + RequestedWidth + 1;
- Top = ((DimensionsHeight - NumberOfLines - 2) / 2) + gStatementDimensions.TopRow - 1;
- Bottom = Top + NumberOfLines + 2;
+ Top = ((DimensionsHeight - NumberOfLines - 2) / 2) + gStatementDimensions.TopRow - 1;
+ Bottom = Top + NumberOfLines + 2;
Character = BOXDRAW_DOWN_RIGHT;
PrintCharAt (Start, Top, Character);
@@ -629,7 +629,7 @@ CreateSharedPopUp (
Count = 0;
for (Index = Top; Index + 2 < Bottom; Index++, Count++) {
- String = VA_ARG (Marker, CHAR16*);
+ String = VA_ARG (Marker, CHAR16 *);
//
// This will clear the background of the line - we never know who might have been
@@ -687,12 +687,12 @@ CreateSharedPopUp (
VOID
EFIAPI
CreateMultiStringPopUp (
- IN UINTN RequestedWidth,
- IN UINTN NumberOfLines,
+ IN UINTN RequestedWidth,
+ IN UINTN NumberOfLines,
...
)
{
- VA_LIST Marker;
+ VA_LIST Marker;
VA_START (Marker, NumberOfLines);
@@ -711,8 +711,8 @@ CreateMultiStringPopUp (
VOID
EFIAPI
EmptyEventProcess (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
}
@@ -727,14 +727,14 @@ EmptyEventProcess (
VOID
EFIAPI
RefreshTimeOutProcess (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- WARNING_IF_CONTEXT *EventInfo;
- CHAR16 TimeOutString[MAX_TIME_OUT_LEN];
+ WARNING_IF_CONTEXT *EventInfo;
+ CHAR16 TimeOutString[MAX_TIME_OUT_LEN];
- EventInfo = (WARNING_IF_CONTEXT *) Context;
+ EventInfo = (WARNING_IF_CONTEXT *)Context;
if (*(EventInfo->TimeOut) == 0) {
gBS->CloseEvent (Event);
@@ -743,7 +743,7 @@ RefreshTimeOutProcess (
return;
}
- UnicodeSPrint(TimeOutString, MAX_TIME_OUT_LEN, L"%d", *(EventInfo->TimeOut));
+ UnicodeSPrint (TimeOutString, MAX_TIME_OUT_LEN, L"%d", *(EventInfo->TimeOut));
CreateDialog (NULL, gEmptyString, EventInfo->ErrorInfo, gPressEnter, gEmptyString, TimeOutString, NULL);
@@ -780,19 +780,19 @@ PasswordInvalid (
**/
EFI_STATUS
PasswordProcess (
- IN UI_MENU_OPTION *MenuOption
+ IN UI_MENU_OPTION *MenuOption
)
{
- CHAR16 *StringPtr;
- CHAR16 *TempString;
- UINTN Maximum;
- EFI_STATUS Status;
- EFI_IFR_PASSWORD *PasswordInfo;
- FORM_DISPLAY_ENGINE_STATEMENT *Question;
- EFI_INPUT_KEY Key;
+ CHAR16 *StringPtr;
+ CHAR16 *TempString;
+ UINTN Maximum;
+ EFI_STATUS Status;
+ EFI_IFR_PASSWORD *PasswordInfo;
+ FORM_DISPLAY_ENGINE_STATEMENT *Question;
+ EFI_INPUT_KEY Key;
Question = MenuOption->ThisTag;
- PasswordInfo = (EFI_IFR_PASSWORD *) Question->OpCode;
+ PasswordInfo = (EFI_IFR_PASSWORD *)Question->OpCode;
Maximum = PasswordInfo->MaxSize;
Status = EFI_SUCCESS;
@@ -803,8 +803,8 @@ PasswordProcess (
// Use a NULL password to test whether old password is required
//
*StringPtr = 0;
- Status = Question->PasswordCheck (gFormData, Question, StringPtr);
- if (Status == EFI_NOT_AVAILABLE_YET || Status == EFI_UNSUPPORTED) {
+ Status = Question->PasswordCheck (gFormData, Question, StringPtr);
+ if ((Status == EFI_NOT_AVAILABLE_YET) || (Status == EFI_UNSUPPORTED)) {
//
// Password can't be set now.
//
@@ -813,6 +813,7 @@ PasswordProcess (
CreateDialog (&Key, gEmptyString, gPasswordUnsupported, gPressEnter, gEmptyString, NULL);
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
}
+
FreePool (StringPtr);
return EFI_SUCCESS;
}
@@ -841,6 +842,7 @@ PasswordProcess (
} else {
Status = EFI_SUCCESS;
}
+
ZeroMem (StringPtr, (Maximum + 1) * sizeof (CHAR16));
FreePool (StringPtr);
return Status;
@@ -884,10 +886,10 @@ PasswordProcess (
// Compare two typed-in new passwords
//
if (StrCmp (StringPtr, TempString) == 0) {
- gUserInput->InputValue.Buffer = AllocateCopyPool (Question->CurrentValue.BufferLen, StringPtr);
- gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
- gUserInput->InputValue.Type = Question->CurrentValue.Type;
- gUserInput->InputValue.Value.string = HiiSetString(gFormData->HiiHandle, gUserInput->InputValue.Value.string, StringPtr, NULL);
+ gUserInput->InputValue.Buffer = AllocateCopyPool (Question->CurrentValue.BufferLen, StringPtr);
+ gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
+ gUserInput->InputValue.Type = Question->CurrentValue.Type;
+ gUserInput->InputValue.Value.string = HiiSetString (gFormData->HiiHandle, gUserInput->InputValue.Value.string, StringPtr, NULL);
Status = EFI_SUCCESS;
} else {
@@ -905,6 +907,7 @@ PasswordProcess (
Status = EFI_INVALID_PARAMETER;
}
+
ZeroMem (TempString, (Maximum + 1) * sizeof (CHAR16));
ZeroMem (StringPtr, (Maximum + 1) * sizeof (CHAR16));
FreePool (TempString);
@@ -921,69 +924,69 @@ PasswordProcess (
**/
VOID
PrintMismatchMenuInfo (
- IN UI_MENU_OPTION *MenuOption
-)
+ IN UI_MENU_OPTION *MenuOption
+ )
{
- CHAR16 *FormTitleStr;
- CHAR16 *FormSetTitleStr;
- CHAR16 *OneOfOptionStr;
- CHAR16 *QuestionName;
- LIST_ENTRY *Link;
- FORM_DISPLAY_ENGINE_STATEMENT *Question;
- EFI_IFR_ORDERED_LIST *OrderList;
- UINT8 Index;
- EFI_HII_VALUE HiiValue;
- EFI_HII_VALUE *QuestionValue;
- DISPLAY_QUESTION_OPTION *Option;
- UINT8 *ValueArray;
- UINT8 ValueType;
- EFI_IFR_FORM_SET *FormsetBuffer;
- UINTN FormsetBufferSize;
+ CHAR16 *FormTitleStr;
+ CHAR16 *FormSetTitleStr;
+ CHAR16 *OneOfOptionStr;
+ CHAR16 *QuestionName;
+ LIST_ENTRY *Link;
+ FORM_DISPLAY_ENGINE_STATEMENT *Question;
+ EFI_IFR_ORDERED_LIST *OrderList;
+ UINT8 Index;
+ EFI_HII_VALUE HiiValue;
+ EFI_HII_VALUE *QuestionValue;
+ DISPLAY_QUESTION_OPTION *Option;
+ UINT8 *ValueArray;
+ UINT8 ValueType;
+ EFI_IFR_FORM_SET *FormsetBuffer;
+ UINTN FormsetBufferSize;
Question = MenuOption->ThisTag;
HiiGetFormSetFromHiiHandle (gFormData->HiiHandle, &FormsetBuffer, &FormsetBufferSize);
FormSetTitleStr = GetToken (FormsetBuffer->FormSetTitle, gFormData->HiiHandle);
- FormTitleStr = GetToken (gFormData->FormTitle, gFormData->HiiHandle);
+ FormTitleStr = GetToken (gFormData->FormTitle, gFormData->HiiHandle);
DEBUG ((DEBUG_ERROR, "\n[%a]: Mismatch Formset : Formset Guid = %g, FormSet title = %s\n", gEfiCallerBaseName, &gFormData->FormSetGuid, FormSetTitleStr));
DEBUG ((DEBUG_ERROR, "[%a]: Mismatch Form : FormId = %d, Form title = %s.\n", gEfiCallerBaseName, gFormData->FormId, FormTitleStr));
if (Question->OpCode->OpCode == EFI_IFR_ORDERED_LIST_OP) {
- QuestionName = GetToken (((EFI_IFR_ORDERED_LIST*)MenuOption->ThisTag->OpCode)->Question.Header.Prompt, gFormData->HiiHandle);
- Link = GetFirstNode (&Question->OptionListHead);
- Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
- ValueType = Option->OptionOpCode->Type;
+ QuestionName = GetToken (((EFI_IFR_ORDERED_LIST *)MenuOption->ThisTag->OpCode)->Question.Header.Prompt, gFormData->HiiHandle);
+ Link = GetFirstNode (&Question->OptionListHead);
+ Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
+ ValueType = Option->OptionOpCode->Type;
DEBUG ((DEBUG_ERROR, "[%a]: Mismatch Error : OrderedList value in the array doesn't match with option value.\n", gEfiCallerBaseName));
DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OrderedList: Name = %s.\n", gEfiCallerBaseName, QuestionName));
DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OrderedList: OrderedList array value :\n", gEfiCallerBaseName));
- OrderList = (EFI_IFR_ORDERED_LIST *) Question->OpCode;
+ OrderList = (EFI_IFR_ORDERED_LIST *)Question->OpCode;
for (Index = 0; Index < OrderList->MaxContainers; Index++) {
- ValueArray = Question->CurrentValue.Buffer;
+ ValueArray = Question->CurrentValue.Buffer;
HiiValue.Value.u64 = GetArrayData (ValueArray, ValueType, Index);
DEBUG ((DEBUG_ERROR, " Value[%d] =%ld.\n", Index, HiiValue.Value.u64));
}
} else if (Question->OpCode->OpCode == EFI_IFR_ONE_OF_OP) {
- QuestionName = GetToken (((EFI_IFR_ONE_OF*)MenuOption->ThisTag->OpCode)->Question.Header.Prompt, gFormData->HiiHandle);
+ QuestionName = GetToken (((EFI_IFR_ONE_OF *)MenuOption->ThisTag->OpCode)->Question.Header.Prompt, gFormData->HiiHandle);
QuestionValue = &Question->CurrentValue;
DEBUG ((DEBUG_ERROR, "[%a]: Mismatch Error : OneOf value doesn't match with option value.\n", gEfiCallerBaseName));
DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : Name = %s.\n", gEfiCallerBaseName, QuestionName));
switch (QuestionValue->Type) {
case EFI_IFR_TYPE_NUM_SIZE_64:
- DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = %ld.\n",gEfiCallerBaseName, QuestionValue->Value.u64));
+ DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = %ld.\n", gEfiCallerBaseName, QuestionValue->Value.u64));
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
- DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = %d.\n",gEfiCallerBaseName, QuestionValue->Value.u32));
+ DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = %d.\n", gEfiCallerBaseName, QuestionValue->Value.u32));
break;
case EFI_IFR_TYPE_NUM_SIZE_16:
- DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = %d.\n",gEfiCallerBaseName, QuestionValue->Value.u16));
+ DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = %d.\n", gEfiCallerBaseName, QuestionValue->Value.u16));
break;
case EFI_IFR_TYPE_NUM_SIZE_8:
- DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = %d.\n",gEfiCallerBaseName, QuestionValue->Value.u8));
+ DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = %d.\n", gEfiCallerBaseName, QuestionValue->Value.u8));
break;
default:
@@ -993,31 +996,32 @@ PrintMismatchMenuInfo (
}
Index = 0;
- Link = GetFirstNode (&Question->OptionListHead);
+ Link = GetFirstNode (&Question->OptionListHead);
while (!IsNull (&Question->OptionListHead, Link)) {
- Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
+ Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
OneOfOptionStr = GetToken (Option->OptionOpCode->Option, gFormData->HiiHandle);
switch (Option->OptionOpCode->Type) {
case EFI_IFR_TYPE_NUM_SIZE_64:
- DEBUG ((DEBUG_ERROR, "[%a]: Option %d : Option Value = %ld, Option Name = %s.\n",gEfiCallerBaseName, Index, Option->OptionOpCode->Value.u64, OneOfOptionStr));
+ DEBUG ((DEBUG_ERROR, "[%a]: Option %d : Option Value = %ld, Option Name = %s.\n", gEfiCallerBaseName, Index, Option->OptionOpCode->Value.u64, OneOfOptionStr));
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
- DEBUG ((DEBUG_ERROR, "[%a]: Option %d : Option Value = %d, Option Name = %s.\n",gEfiCallerBaseName, Index, Option->OptionOpCode->Value.u32, OneOfOptionStr));
+ DEBUG ((DEBUG_ERROR, "[%a]: Option %d : Option Value = %d, Option Name = %s.\n", gEfiCallerBaseName, Index, Option->OptionOpCode->Value.u32, OneOfOptionStr));
break;
case EFI_IFR_TYPE_NUM_SIZE_16:
- DEBUG ((DEBUG_ERROR, "[%a]: Option %d : Option Value = %d, Option Name = %s.\n",gEfiCallerBaseName, Index, Option->OptionOpCode->Value.u16, OneOfOptionStr));
+ DEBUG ((DEBUG_ERROR, "[%a]: Option %d : Option Value = %d, Option Name = %s.\n", gEfiCallerBaseName, Index, Option->OptionOpCode->Value.u16, OneOfOptionStr));
break;
case EFI_IFR_TYPE_NUM_SIZE_8:
- DEBUG ((DEBUG_ERROR, "[%a]: Option %d : Option Value = %d, Option Name = %s.\n",gEfiCallerBaseName, Index, Option->OptionOpCode->Value.u8, OneOfOptionStr));
+ DEBUG ((DEBUG_ERROR, "[%a]: Option %d : Option Value = %d, Option Name = %s.\n", gEfiCallerBaseName, Index, Option->OptionOpCode->Value.u8, OneOfOptionStr));
break;
default:
ASSERT (FALSE);
break;
}
+
Link = GetNextNode (&Question->OptionListHead, Link);
Index++;
}
@@ -1037,34 +1041,34 @@ PrintMismatchMenuInfo (
**/
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
)
{
- EFI_STATUS Status;
- CHAR16 *StringPtr;
- UINTN Index;
- FORM_DISPLAY_ENGINE_STATEMENT *Question;
- CHAR16 FormattedNumber[21];
- UINT16 Number;
- CHAR16 Character[2];
- EFI_INPUT_KEY Key;
- UINTN BufferSize;
- DISPLAY_QUESTION_OPTION *OneOfOption;
- LIST_ENTRY *Link;
- EFI_HII_VALUE HiiValue;
- EFI_HII_VALUE *QuestionValue;
- DISPLAY_QUESTION_OPTION *Option;
- UINTN Index2;
- UINT8 *ValueArray;
- UINT8 ValueType;
- EFI_IFR_ORDERED_LIST *OrderList;
- BOOLEAN ValueInvalid;
- UINTN MaxLen;
-
- Status = EFI_SUCCESS;
+ EFI_STATUS Status;
+ CHAR16 *StringPtr;
+ UINTN Index;
+ FORM_DISPLAY_ENGINE_STATEMENT *Question;
+ CHAR16 FormattedNumber[21];
+ UINT16 Number;
+ CHAR16 Character[2];
+ EFI_INPUT_KEY Key;
+ UINTN BufferSize;
+ DISPLAY_QUESTION_OPTION *OneOfOption;
+ LIST_ENTRY *Link;
+ EFI_HII_VALUE HiiValue;
+ EFI_HII_VALUE *QuestionValue;
+ DISPLAY_QUESTION_OPTION *Option;
+ UINTN Index2;
+ UINT8 *ValueArray;
+ UINT8 ValueType;
+ EFI_IFR_ORDERED_LIST *OrderList;
+ BOOLEAN ValueInvalid;
+ UINTN MaxLen;
+
+ Status = EFI_SUCCESS;
StringPtr = NULL;
Character[1] = L'\0';
@@ -1074,54 +1078,132 @@ ProcessOptions (
ZeroMem (FormattedNumber, 21 * sizeof (CHAR16));
BufferSize = (gOptionBlockWidth + 1) * 2 * gStatementDimensions.BottomRow;
- Question = MenuOption->ThisTag;
+ Question = MenuOption->ThisTag;
QuestionValue = &Question->CurrentValue;
switch (Question->OpCode->OpCode) {
- case EFI_IFR_ORDERED_LIST_OP:
+ case EFI_IFR_ORDERED_LIST_OP:
- //
- // Check whether there are Options of this OrderedList
- //
- if (IsListEmpty (&Question->OptionListHead)) {
- break;
- }
+ //
+ // Check whether there are Options of this OrderedList
+ //
+ if (IsListEmpty (&Question->OptionListHead)) {
+ break;
+ }
- OrderList = (EFI_IFR_ORDERED_LIST *) Question->OpCode;
+ OrderList = (EFI_IFR_ORDERED_LIST *)Question->OpCode;
- Link = GetFirstNode (&Question->OptionListHead);
- OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
+ Link = GetFirstNode (&Question->OptionListHead);
+ OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
- ValueType = OneOfOption->OptionOpCode->Type;
- ValueArray = Question->CurrentValue.Buffer;
+ ValueType = OneOfOption->OptionOpCode->Type;
+ ValueArray = Question->CurrentValue.Buffer;
- if (Selected) {
- //
- // Go ask for input
- //
- Status = GetSelectionInputPopUp (MenuOption);
- } else {
- //
- // We now know how many strings we will have, so we can allocate the
- // space required for the array or strings.
- //
- MaxLen = OrderList->MaxContainers * BufferSize / sizeof (CHAR16);
- *OptionString = AllocateZeroPool (MaxLen * sizeof (CHAR16));
- ASSERT (*OptionString);
-
- HiiValue.Type = ValueType;
- HiiValue.Value.u64 = 0;
- for (Index = 0; Index < OrderList->MaxContainers; Index++) {
- HiiValue.Value.u64 = GetArrayData (ValueArray, ValueType, Index);
- if (HiiValue.Value.u64 == 0) {
- //
- // Values for the options in ordered lists should never be a 0
- //
+ if (Selected) {
+ //
+ // Go ask for input
+ //
+ Status = GetSelectionInputPopUp (MenuOption);
+ } else {
+ //
+ // We now know how many strings we will have, so we can allocate the
+ // space required for the array or strings.
+ //
+ MaxLen = OrderList->MaxContainers * BufferSize / sizeof (CHAR16);
+ *OptionString = AllocateZeroPool (MaxLen * sizeof (CHAR16));
+ ASSERT (*OptionString);
+
+ HiiValue.Type = ValueType;
+ HiiValue.Value.u64 = 0;
+ for (Index = 0; Index < OrderList->MaxContainers; Index++) {
+ HiiValue.Value.u64 = GetArrayData (ValueArray, ValueType, Index);
+ if (HiiValue.Value.u64 == 0) {
+ //
+ // Values for the options in ordered lists should never be a 0
+ //
+ break;
+ }
+
+ OneOfOption = ValueToOption (Question, &HiiValue);
+ if (OneOfOption == NULL) {
+ //
+ // Print debug msg for the mistach menu.
+ //
+ PrintMismatchMenuInfo (MenuOption);
+
+ if (SkipErrorValue) {
+ //
+ // Just try to get the option string, skip the value which not has option.
+ //
+ continue;
+ }
+
+ //
+ // Show error message
+ //
+ do {
+ CreateDialog (&Key, gEmptyString, gOptionMismatch, gPressEnter, gEmptyString, NULL);
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+
+ //
+ // The initial value of the orderedlist is invalid, force to be valid value
+ // Exit current DisplayForm with new value.
+ //
+ gUserInput->SelectedStatement = Question;
+ gMisMatch = TRUE;
+ ValueArray = AllocateZeroPool (Question->CurrentValue.BufferLen);
+ ASSERT (ValueArray != NULL);
+ gUserInput->InputValue.Buffer = ValueArray;
+ gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
+ gUserInput->InputValue.Type = Question->CurrentValue.Type;
+
+ Link = GetFirstNode (&Question->OptionListHead);
+ Index2 = 0;
+ while (!IsNull (&Question->OptionListHead, Link) && Index2 < OrderList->MaxContainers) {
+ Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
+ Link = GetNextNode (&Question->OptionListHead, Link);
+ SetArrayData (ValueArray, ValueType, Index2, Option->OptionOpCode->Value.u64);
+ Index2++;
+ }
+
+ SetArrayData (ValueArray, ValueType, Index2, 0);
+
+ FreePool (*OptionString);
+ *OptionString = NULL;
+ return EFI_NOT_FOUND;
+ }
+
+ Character[0] = LEFT_ONEOF_DELIMITER;
+ NewStrCat (OptionString[0], MaxLen, Character);
+ StringPtr = GetToken (OneOfOption->OptionOpCode->Option, gFormData->HiiHandle);
+ ASSERT (StringPtr != NULL);
+ NewStrCat (OptionString[0], MaxLen, StringPtr);
+ Character[0] = RIGHT_ONEOF_DELIMITER;
+ NewStrCat (OptionString[0], MaxLen, Character);
+ Character[0] = CHAR_CARRIAGE_RETURN;
+ NewStrCat (OptionString[0], MaxLen, Character);
+ FreePool (StringPtr);
+ }
+
+ //
+ // If valid option more than the max container, skip these options.
+ //
+ if (Index >= OrderList->MaxContainers) {
break;
}
- OneOfOption = ValueToOption (Question, &HiiValue);
- if (OneOfOption == NULL) {
+ //
+ // Search the other options, try to find the one not in the container.
+ //
+ Link = GetFirstNode (&Question->OptionListHead);
+ while (!IsNull (&Question->OptionListHead, Link)) {
+ OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
+ Link = GetNextNode (&Question->OptionListHead, Link);
+
+ if (FindArrayData (ValueArray, ValueType, OneOfOption->OptionOpCode->Value.u64, NULL)) {
+ continue;
+ }
+
//
// Print debug msg for the mistach menu.
//
@@ -1129,400 +1211,340 @@ ProcessOptions (
if (SkipErrorValue) {
//
- // Just try to get the option string, skip the value which not has option.
+ // Not report error, just get the correct option string info.
//
+ Character[0] = LEFT_ONEOF_DELIMITER;
+ NewStrCat (OptionString[0], MaxLen, Character);
+ StringPtr = GetToken (OneOfOption->OptionOpCode->Option, gFormData->HiiHandle);
+ ASSERT (StringPtr != NULL);
+ NewStrCat (OptionString[0], MaxLen, StringPtr);
+ Character[0] = RIGHT_ONEOF_DELIMITER;
+ NewStrCat (OptionString[0], MaxLen, Character);
+ Character[0] = CHAR_CARRIAGE_RETURN;
+ NewStrCat (OptionString[0], MaxLen, Character);
+ FreePool (StringPtr);
+
continue;
}
- //
- // Show error message
- //
- do {
- CreateDialog (&Key, gEmptyString, gOptionMismatch, gPressEnter, gEmptyString, NULL);
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ if (!ValueInvalid) {
+ ValueInvalid = TRUE;
+ //
+ // Show error message
+ //
+ do {
+ CreateDialog (&Key, gEmptyString, gOptionMismatch, gPressEnter, gEmptyString, NULL);
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- //
- // The initial value of the orderedlist is invalid, force to be valid value
- // Exit current DisplayForm with new value.
- //
- gUserInput->SelectedStatement = Question;
- gMisMatch = TRUE;
- ValueArray = AllocateZeroPool (Question->CurrentValue.BufferLen);
- ASSERT (ValueArray != NULL);
- gUserInput->InputValue.Buffer = ValueArray;
- gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
- gUserInput->InputValue.Type = Question->CurrentValue.Type;
-
- Link = GetFirstNode (&Question->OptionListHead);
- Index2 = 0;
- while (!IsNull (&Question->OptionListHead, Link) && Index2 < OrderList->MaxContainers) {
- Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
- Link = GetNextNode (&Question->OptionListHead, Link);
- SetArrayData (ValueArray, ValueType, Index2, Option->OptionOpCode->Value.u64);
- Index2++;
+ //
+ // The initial value of the orderedlist is invalid, force to be valid value
+ // Exit current DisplayForm with new value.
+ //
+ gUserInput->SelectedStatement = Question;
+ gMisMatch = TRUE;
+ ValueArray = AllocateCopyPool (Question->CurrentValue.BufferLen, Question->CurrentValue.Buffer);
+ ASSERT (ValueArray != NULL);
+ gUserInput->InputValue.Buffer = ValueArray;
+ gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
+ gUserInput->InputValue.Type = Question->CurrentValue.Type;
}
- SetArrayData (ValueArray, ValueType, Index2, 0);
+ SetArrayData (ValueArray, ValueType, Index++, OneOfOption->OptionOpCode->Value.u64);
+ }
+
+ if (ValueInvalid) {
FreePool (*OptionString);
*OptionString = NULL;
return EFI_NOT_FOUND;
}
-
- Character[0] = LEFT_ONEOF_DELIMITER;
- NewStrCat (OptionString[0], MaxLen, Character);
- StringPtr = GetToken (OneOfOption->OptionOpCode->Option, gFormData->HiiHandle);
- ASSERT (StringPtr != NULL);
- NewStrCat (OptionString[0], MaxLen, StringPtr);
- Character[0] = RIGHT_ONEOF_DELIMITER;
- NewStrCat (OptionString[0], MaxLen, Character);
- Character[0] = CHAR_CARRIAGE_RETURN;
- NewStrCat (OptionString[0], MaxLen, Character);
- FreePool (StringPtr);
}
+ break;
+
+ case EFI_IFR_ONE_OF_OP:
//
- // If valid option more than the max container, skip these options.
+ // Check whether there are Options of this OneOf
//
- if (Index >= OrderList->MaxContainers) {
+ if (IsListEmpty (&Question->OptionListHead)) {
break;
}
- //
- // Search the other options, try to find the one not in the container.
- //
- Link = GetFirstNode (&Question->OptionListHead);
- while (!IsNull (&Question->OptionListHead, Link)) {
- OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
- Link = GetNextNode (&Question->OptionListHead, Link);
-
- if (FindArrayData (ValueArray, ValueType, OneOfOption->OptionOpCode->Value.u64, NULL)) {
- continue;
- }
-
+ if (Selected) {
//
- // Print debug msg for the mistach menu.
+ // Go ask for input
//
- PrintMismatchMenuInfo (MenuOption);
+ Status = GetSelectionInputPopUp (MenuOption);
+ } else {
+ MaxLen = BufferSize / sizeof (CHAR16);
+ *OptionString = AllocateZeroPool (BufferSize);
+ ASSERT (*OptionString);
- if (SkipErrorValue) {
+ OneOfOption = ValueToOption (Question, QuestionValue);
+ if (OneOfOption == NULL) {
//
- // Not report error, just get the correct option string info.
+ // Print debug msg for the mistach menu.
//
- Character[0] = LEFT_ONEOF_DELIMITER;
- NewStrCat (OptionString[0], MaxLen, Character);
- StringPtr = GetToken (OneOfOption->OptionOpCode->Option, gFormData->HiiHandle);
- ASSERT (StringPtr != NULL);
- NewStrCat (OptionString[0], MaxLen, StringPtr);
- Character[0] = RIGHT_ONEOF_DELIMITER;
- NewStrCat (OptionString[0], MaxLen, Character);
- Character[0] = CHAR_CARRIAGE_RETURN;
- NewStrCat (OptionString[0], MaxLen, Character);
- FreePool (StringPtr);
+ PrintMismatchMenuInfo (MenuOption);
- continue;
- }
+ if (SkipErrorValue) {
+ //
+ // Not report error, just get the correct option string info.
+ //
+ Link = GetFirstNode (&Question->OptionListHead);
+ OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
+ } else {
+ //
+ // Show error message
+ //
+ do {
+ CreateDialog (&Key, gEmptyString, gOptionMismatch, gPressEnter, gEmptyString, NULL);
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- if (!ValueInvalid) {
- ValueInvalid = TRUE;
- //
- // Show error message
- //
- do {
- CreateDialog (&Key, gEmptyString, gOptionMismatch, gPressEnter, gEmptyString, NULL);
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ //
+ // Force the Question value to be valid
+ // Exit current DisplayForm with new value.
+ //
+ Link = GetFirstNode (&Question->OptionListHead);
+ Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
- //
- // The initial value of the orderedlist is invalid, force to be valid value
- // Exit current DisplayForm with new value.
- //
- gUserInput->SelectedStatement = Question;
- gMisMatch = TRUE;
- ValueArray = AllocateCopyPool (Question->CurrentValue.BufferLen, Question->CurrentValue.Buffer);
- ASSERT (ValueArray != NULL);
- gUserInput->InputValue.Buffer = ValueArray;
- gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
- gUserInput->InputValue.Type = Question->CurrentValue.Type;
+ gUserInput->InputValue.Type = Option->OptionOpCode->Type;
+ switch (gUserInput->InputValue.Type) {
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ gUserInput->InputValue.Value.u8 = Option->OptionOpCode->Value.u8;
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ CopyMem (&gUserInput->InputValue.Value.u16, &Option->OptionOpCode->Value.u16, sizeof (UINT16));
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ CopyMem (&gUserInput->InputValue.Value.u32, &Option->OptionOpCode->Value.u32, sizeof (UINT32));
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ CopyMem (&gUserInput->InputValue.Value.u64, &Option->OptionOpCode->Value.u64, sizeof (UINT64));
+ break;
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+
+ gUserInput->SelectedStatement = Question;
+ gMisMatch = TRUE;
+ FreePool (*OptionString);
+ *OptionString = NULL;
+ return EFI_NOT_FOUND;
+ }
}
- SetArrayData (ValueArray, ValueType, Index++, OneOfOption->OptionOpCode->Value.u64);
- }
+ Character[0] = LEFT_ONEOF_DELIMITER;
+ NewStrCat (OptionString[0], MaxLen, Character);
+ StringPtr = GetToken (OneOfOption->OptionOpCode->Option, gFormData->HiiHandle);
+ ASSERT (StringPtr != NULL);
+ NewStrCat (OptionString[0], MaxLen, StringPtr);
+ Character[0] = RIGHT_ONEOF_DELIMITER;
+ NewStrCat (OptionString[0], MaxLen, Character);
- if (ValueInvalid) {
- FreePool (*OptionString);
- *OptionString = NULL;
- return EFI_NOT_FOUND;
+ FreePool (StringPtr);
}
- }
- break;
- case EFI_IFR_ONE_OF_OP:
- //
- // Check whether there are Options of this OneOf
- //
- if (IsListEmpty (&Question->OptionListHead)) {
break;
- }
- if (Selected) {
- //
- // Go ask for input
- //
- Status = GetSelectionInputPopUp (MenuOption);
- } else {
- MaxLen = BufferSize / sizeof(CHAR16);
- *OptionString = AllocateZeroPool (BufferSize);
- ASSERT (*OptionString);
- OneOfOption = ValueToOption (Question, QuestionValue);
- if (OneOfOption == NULL) {
+ case EFI_IFR_CHECKBOX_OP:
+ if (Selected) {
//
- // Print debug msg for the mistach menu.
+ // Since this is a BOOLEAN operation, flip it upon selection
//
- PrintMismatchMenuInfo (MenuOption);
+ gUserInput->InputValue.Type = QuestionValue->Type;
+ gUserInput->InputValue.Value.b = (BOOLEAN)(QuestionValue->Value.b ? FALSE : TRUE);
- if (SkipErrorValue) {
- //
- // Not report error, just get the correct option string info.
- //
- Link = GetFirstNode (&Question->OptionListHead);
- OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
- } else {
- //
- // Show error message
- //
- do {
- CreateDialog (&Key, gEmptyString, gOptionMismatch, gPressEnter, gEmptyString, NULL);
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+ //
+ // Perform inconsistent check
+ //
+ return EFI_SUCCESS;
+ } else {
+ *OptionString = AllocateZeroPool (BufferSize);
+ ASSERT (*OptionString);
- //
- // Force the Question value to be valid
- // Exit current DisplayForm with new value.
- //
- Link = GetFirstNode (&Question->OptionListHead);
- Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
+ *OptionString[0] = LEFT_CHECKBOX_DELIMITER;
- gUserInput->InputValue.Type = Option->OptionOpCode->Type;
- switch (gUserInput->InputValue.Type) {
- case EFI_IFR_TYPE_NUM_SIZE_8:
- gUserInput->InputValue.Value.u8 = Option->OptionOpCode->Value.u8;
- break;
- case EFI_IFR_TYPE_NUM_SIZE_16:
- CopyMem (&gUserInput->InputValue.Value.u16, &Option->OptionOpCode->Value.u16, sizeof (UINT16));
- break;
- case EFI_IFR_TYPE_NUM_SIZE_32:
- CopyMem (&gUserInput->InputValue.Value.u32, &Option->OptionOpCode->Value.u32, sizeof (UINT32));
- break;
- case EFI_IFR_TYPE_NUM_SIZE_64:
- CopyMem (&gUserInput->InputValue.Value.u64, &Option->OptionOpCode->Value.u64, sizeof (UINT64));
- break;
- default:
- ASSERT (FALSE);
- break;
- }
- gUserInput->SelectedStatement = Question;
- gMisMatch = TRUE;
- FreePool (*OptionString);
- *OptionString = NULL;
- return EFI_NOT_FOUND;
+ if (QuestionValue->Value.b) {
+ *(OptionString[0] + 1) = CHECK_ON;
+ } else {
+ *(OptionString[0] + 1) = CHECK_OFF;
}
- }
- Character[0] = LEFT_ONEOF_DELIMITER;
- NewStrCat (OptionString[0], MaxLen, Character);
- StringPtr = GetToken (OneOfOption->OptionOpCode->Option, gFormData->HiiHandle);
- ASSERT (StringPtr != NULL);
- NewStrCat (OptionString[0], MaxLen, StringPtr);
- Character[0] = RIGHT_ONEOF_DELIMITER;
- NewStrCat (OptionString[0], MaxLen, Character);
+ *(OptionString[0] + 2) = RIGHT_CHECKBOX_DELIMITER;
+ }
- FreePool (StringPtr);
- }
- break;
+ break;
- case EFI_IFR_CHECKBOX_OP:
- if (Selected) {
- //
- // Since this is a BOOLEAN operation, flip it upon selection
- //
- gUserInput->InputValue.Type = QuestionValue->Type;
- gUserInput->InputValue.Value.b = (BOOLEAN) (QuestionValue->Value.b ? FALSE : TRUE);
+ case EFI_IFR_NUMERIC_OP:
+ if (Selected) {
+ //
+ // Go ask for input
+ //
+ Status = GetNumericInput (MenuOption);
+ } else {
+ *OptionString = AllocateZeroPool (BufferSize);
+ ASSERT (*OptionString);
- //
- // Perform inconsistent check
- //
- return EFI_SUCCESS;
- } else {
- *OptionString = AllocateZeroPool (BufferSize);
- ASSERT (*OptionString);
+ *OptionString[0] = LEFT_NUMERIC_DELIMITER;
- *OptionString[0] = LEFT_CHECKBOX_DELIMITER;
+ //
+ // Formatted print
+ //
+ PrintFormattedNumber (Question, FormattedNumber, 21 * sizeof (CHAR16));
+ Number = (UINT16)GetStringWidth (FormattedNumber);
+ CopyMem (OptionString[0] + 1, FormattedNumber, Number);
- if (QuestionValue->Value.b) {
- *(OptionString[0] + 1) = CHECK_ON;
- } else {
- *(OptionString[0] + 1) = CHECK_OFF;
+ *(OptionString[0] + Number / 2) = RIGHT_NUMERIC_DELIMITER;
}
- *(OptionString[0] + 2) = RIGHT_CHECKBOX_DELIMITER;
- }
- break;
- case EFI_IFR_NUMERIC_OP:
- if (Selected) {
- //
- // Go ask for input
- //
- Status = GetNumericInput (MenuOption);
- } else {
- *OptionString = AllocateZeroPool (BufferSize);
- ASSERT (*OptionString);
+ break;
- *OptionString[0] = LEFT_NUMERIC_DELIMITER;
+ case EFI_IFR_DATE_OP:
+ if (Selected) {
+ //
+ // This is similar to numerics
+ //
+ Status = GetNumericInput (MenuOption);
+ } else {
+ *OptionString = AllocateZeroPool (BufferSize);
+ ASSERT (*OptionString);
+
+ switch (MenuOption->Sequence) {
+ case 0:
+ *OptionString[0] = LEFT_NUMERIC_DELIMITER;
+ if (QuestionValue->Value.date.Month == 0xff) {
+ UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"??");
+ } else {
+ UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.date.Month);
+ }
+
+ *(OptionString[0] + 3) = DATE_SEPARATOR;
+ break;
- //
- // Formatted print
- //
- PrintFormattedNumber (Question, FormattedNumber, 21 * sizeof (CHAR16));
- Number = (UINT16) GetStringWidth (FormattedNumber);
- CopyMem (OptionString[0] + 1, FormattedNumber, Number);
+ case 1:
+ SetUnicodeMem (OptionString[0], 4, L' ');
+ if (QuestionValue->Value.date.Day == 0xff) {
+ UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"??");
+ } else {
+ UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.date.Day);
+ }
- *(OptionString[0] + Number / 2) = RIGHT_NUMERIC_DELIMITER;
- }
- break;
+ *(OptionString[0] + 6) = DATE_SEPARATOR;
+ break;
- case EFI_IFR_DATE_OP:
- if (Selected) {
- //
- // This is similar to numerics
- //
- Status = GetNumericInput (MenuOption);
- } else {
- *OptionString = AllocateZeroPool (BufferSize);
- ASSERT (*OptionString);
+ case 2:
+ SetUnicodeMem (OptionString[0], 7, L' ');
+ if (QuestionValue->Value.date.Year == 0xff) {
+ UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"????");
+ } else {
+ UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"%04d", QuestionValue->Value.date.Year);
+ }
- switch (MenuOption->Sequence) {
- case 0:
- *OptionString[0] = LEFT_NUMERIC_DELIMITER;
- if (QuestionValue->Value.date.Month == 0xff){
- UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"??");
- } else {
- UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.date.Month);
+ *(OptionString[0] + 11) = RIGHT_NUMERIC_DELIMITER;
+ break;
}
- *(OptionString[0] + 3) = DATE_SEPARATOR;
- break;
+ }
- case 1:
- SetUnicodeMem (OptionString[0], 4, L' ');
- if (QuestionValue->Value.date.Day == 0xff){
- UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"??");
- } else {
- UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.date.Day);
- }
- *(OptionString[0] + 6) = DATE_SEPARATOR;
- break;
+ break;
- case 2:
- SetUnicodeMem (OptionString[0], 7, L' ');
- if (QuestionValue->Value.date.Year == 0xff){
- UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"????");
- } else {
- UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"%04d", QuestionValue->Value.date.Year);
- }
- *(OptionString[0] + 11) = RIGHT_NUMERIC_DELIMITER;
- break;
- }
- }
- break;
+ case EFI_IFR_TIME_OP:
+ if (Selected) {
+ //
+ // This is similar to numerics
+ //
+ Status = GetNumericInput (MenuOption);
+ } else {
+ *OptionString = AllocateZeroPool (BufferSize);
+ ASSERT (*OptionString);
+
+ switch (MenuOption->Sequence) {
+ case 0:
+ *OptionString[0] = LEFT_NUMERIC_DELIMITER;
+ if (QuestionValue->Value.time.Hour == 0xff) {
+ UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"??");
+ } else {
+ UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.time.Hour);
+ }
+
+ *(OptionString[0] + 3) = TIME_SEPARATOR;
+ break;
- case EFI_IFR_TIME_OP:
- if (Selected) {
- //
- // This is similar to numerics
- //
- Status = GetNumericInput (MenuOption);
- } else {
- *OptionString = AllocateZeroPool (BufferSize);
- ASSERT (*OptionString);
+ case 1:
+ SetUnicodeMem (OptionString[0], 4, L' ');
+ if (QuestionValue->Value.time.Minute == 0xff) {
+ UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"??");
+ } else {
+ UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.time.Minute);
+ }
- switch (MenuOption->Sequence) {
- case 0:
- *OptionString[0] = LEFT_NUMERIC_DELIMITER;
- if (QuestionValue->Value.time.Hour == 0xff){
- UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"??");
- } else {
- UnicodeSPrint (OptionString[0] + 1, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.time.Hour);
- }
- *(OptionString[0] + 3) = TIME_SEPARATOR;
- break;
+ *(OptionString[0] + 6) = TIME_SEPARATOR;
+ break;
- case 1:
- SetUnicodeMem (OptionString[0], 4, L' ');
- if (QuestionValue->Value.time.Minute == 0xff){
- UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"??");
- } else {
- UnicodeSPrint (OptionString[0] + 4, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.time.Minute);
- }
- *(OptionString[0] + 6) = TIME_SEPARATOR;
- break;
+ case 2:
+ SetUnicodeMem (OptionString[0], 7, L' ');
+ if (QuestionValue->Value.time.Second == 0xff) {
+ UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"??");
+ } else {
+ UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.time.Second);
+ }
- case 2:
- SetUnicodeMem (OptionString[0], 7, L' ');
- if (QuestionValue->Value.time.Second == 0xff){
- UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"??");
- } else {
- UnicodeSPrint (OptionString[0] + 7, 21 * sizeof (CHAR16), L"%02d", QuestionValue->Value.time.Second);
+ *(OptionString[0] + 9) = RIGHT_NUMERIC_DELIMITER;
+ break;
}
- *(OptionString[0] + 9) = RIGHT_NUMERIC_DELIMITER;
- break;
}
- }
- break;
- case EFI_IFR_STRING_OP:
- if (Selected) {
- StringPtr = AllocateZeroPool (Question->CurrentValue.BufferLen + sizeof (CHAR16));
- ASSERT (StringPtr);
- CopyMem(StringPtr, Question->CurrentValue.Buffer, Question->CurrentValue.BufferLen);
+ break;
- Status = ReadString (MenuOption, gPromptForData, StringPtr);
- if (EFI_ERROR (Status)) {
- FreePool (StringPtr);
- return Status;
- }
+ case EFI_IFR_STRING_OP:
+ if (Selected) {
+ StringPtr = AllocateZeroPool (Question->CurrentValue.BufferLen + sizeof (CHAR16));
+ ASSERT (StringPtr);
+ CopyMem (StringPtr, Question->CurrentValue.Buffer, Question->CurrentValue.BufferLen);
- gUserInput->InputValue.Buffer = AllocateCopyPool (Question->CurrentValue.BufferLen, StringPtr);
- gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
- gUserInput->InputValue.Type = Question->CurrentValue.Type;
- gUserInput->InputValue.Value.string = HiiSetString(gFormData->HiiHandle, gUserInput->InputValue.Value.string, StringPtr, NULL);
- FreePool (StringPtr);
- return EFI_SUCCESS;
- } else {
- *OptionString = AllocateZeroPool (BufferSize);
- ASSERT (*OptionString);
+ Status = ReadString (MenuOption, gPromptForData, StringPtr);
+ if (EFI_ERROR (Status)) {
+ FreePool (StringPtr);
+ return Status;
+ }
- if (((CHAR16 *) Question->CurrentValue.Buffer)[0] == 0x0000) {
- *(OptionString[0]) = '_';
+ gUserInput->InputValue.Buffer = AllocateCopyPool (Question->CurrentValue.BufferLen, StringPtr);
+ gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
+ gUserInput->InputValue.Type = Question->CurrentValue.Type;
+ gUserInput->InputValue.Value.string = HiiSetString (gFormData->HiiHandle, gUserInput->InputValue.Value.string, StringPtr, NULL);
+ FreePool (StringPtr);
+ return EFI_SUCCESS;
} else {
- if (Question->CurrentValue.BufferLen < BufferSize) {
- BufferSize = Question->CurrentValue.BufferLen;
+ *OptionString = AllocateZeroPool (BufferSize);
+ ASSERT (*OptionString);
+
+ if (((CHAR16 *)Question->CurrentValue.Buffer)[0] == 0x0000) {
+ *(OptionString[0]) = '_';
+ } else {
+ if (Question->CurrentValue.BufferLen < BufferSize) {
+ BufferSize = Question->CurrentValue.BufferLen;
+ }
+
+ CopyMem (OptionString[0], (CHAR16 *)Question->CurrentValue.Buffer, BufferSize);
}
- CopyMem (OptionString[0], (CHAR16 *) Question->CurrentValue.Buffer, BufferSize);
}
- }
- break;
- case EFI_IFR_PASSWORD_OP:
- if (Selected) {
- Status = PasswordProcess (MenuOption);
- }
- break;
+ break;
+
+ case EFI_IFR_PASSWORD_OP:
+ if (Selected) {
+ Status = PasswordProcess (MenuOption);
+ }
+
+ break;
- default:
- break;
+ default:
+ break;
}
return Status;
}
-
/**
Process the help string: Split StringPtr to several lines of strings stored in
FormattedString and the glyph width of each line cannot exceed gHelpBlockWidth.
@@ -1550,17 +1572,17 @@ ProcessHelpString (
UINT16 MaxStringLen;
UINT16 StringLen;
- TotalRowNum = 0;
- CheckedNum = 0;
- GlyphWidth = 1;
- Index = 0;
- MaxStringLen = 0;
- StringLen = 0;
+ TotalRowNum = 0;
+ CheckedNum = 0;
+ GlyphWidth = 1;
+ Index = 0;
+ MaxStringLen = 0;
+ StringLen = 0;
//
// Set default help string width.
//
- LineWidth = (UINT16) (gHelpBlockWidth - 1);
+ LineWidth = (UINT16)(gHelpBlockWidth - 1);
//
// Get row number of the String.
@@ -1570,9 +1592,10 @@ ProcessHelpString (
MaxStringLen = StringLen;
}
- TotalRowNum ++;
+ TotalRowNum++;
FreePool (OutputString);
}
+
*EachLineWidth = MaxStringLen;
*FormattedString = AllocateZeroPool (TotalRowNum * MaxStringLen * sizeof (CHAR16));
@@ -1581,11 +1604,11 @@ ProcessHelpString (
//
// Generate formatted help string array.
//
- GlyphWidth = 1;
- Index = 0;
- while((StringLen = GetLineByWidth (StringPtr, LineWidth, &GlyphWidth, &Index, &OutputString)) != 0) {
+ GlyphWidth = 1;
+ Index = 0;
+ while ((StringLen = GetLineByWidth (StringPtr, LineWidth, &GlyphWidth, &Index, &OutputString)) != 0) {
CopyMem (*FormattedString + CheckedNum * MaxStringLen, OutputString, StringLen * sizeof (CHAR16));
- CheckedNum ++;
+ CheckedNum++;
FreePool (OutputString);
}