Fix form flash issue.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14735 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Eric Dong
2013-09-27 12:19:51 +00:00
committed by ydong10
parent e5a9b63cdf
commit af047db78d
5 changed files with 632 additions and 358 deletions

View File

@ -144,6 +144,12 @@ RefreshKeyHelp (
EFI_IFR_DATE *DateOp; EFI_IFR_DATE *DateOp;
EFI_IFR_TIME *TimeOp; EFI_IFR_TIME *TimeOp;
BOOLEAN HexDisplay; BOOLEAN HexDisplay;
UINTN ColumnWidth1;
UINTN ColumnWidth2;
UINTN ColumnWidth3;
CHAR16 *ColumnStr1;
CHAR16 *ColumnStr2;
CHAR16 *ColumnStr3;
ASSERT (FormData != NULL); ASSERT (FormData != NULL);
if (FormData == NULL) { if (FormData == NULL) {
@ -161,17 +167,27 @@ RefreshKeyHelp (
StartColumnOfHelp = gScreenDimensions.LeftColumn + 2; StartColumnOfHelp = gScreenDimensions.LeftColumn + 2;
LeftColumnOfHelp = gScreenDimensions.LeftColumn + 1; LeftColumnOfHelp = gScreenDimensions.LeftColumn + 1;
RightColumnOfHelp = gScreenDimensions.RightColumn - 2; RightColumnOfHelp = gScreenDimensions.RightColumn - 1;
TopRowOfHelp = gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight + 1; TopRowOfHelp = gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - gFooterHeight + 1;
BottomRowOfHelp = gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - 2; BottomRowOfHelp = gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - 2;
ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND); ColumnWidth1 = SecCol - StartColumnOfHelp;
ColumnWidth2 = ThdCol - SecCol;
ColumnWidth3 = RightColumnOfHelp - ThdCol;
ColumnStr1 = gLibEmptyString;
ColumnStr2 = gLibEmptyString;
ColumnStr3 = gLibEmptyString;
if (Statement == NULL) { if (Statement == NULL) {
// //
// Print Key for Form without showable statement. // Print Key for Form without showable statement.
// //
PrintHotKeyHelpString (FormData); PrintHotKeyHelpString (FormData, TRUE);
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString); PrintStringAtWithWidth (StartColumnOfHelp, BottomRowOfHelp, gLibEmptyString, ColumnWidth1);
PrintStringAtWithWidth (SecCol, BottomRowOfHelp, gLibEmptyString, ColumnWidth2);
PrintStringAtWithWidth (StartColumnOfHelp, TopRowOfHelp, gLibEmptyString, ColumnWidth1);
PrintStringAtWithWidth (ThdCol, BottomRowOfHelp, gEscapeString, ColumnWidth3);
return; return;
} }
@ -196,16 +212,17 @@ RefreshKeyHelp (
case EFI_IFR_TIME_OP: case EFI_IFR_TIME_OP:
case EFI_IFR_DATE_OP: case EFI_IFR_DATE_OP:
if (!Selected) { if (!Selected) {
PrintHotKeyHelpString (FormData); PrintHotKeyHelpString (FormData, TRUE);
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) { if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString); ColumnStr3 = gEscapeString;
} }
PrintStringAtWithWidth (ThdCol, BottomRowOfHelp, ColumnStr3, ColumnWidth3);
if ((Statement->OpCode->OpCode == EFI_IFR_DATE_OP) || if ((Statement->OpCode->OpCode == EFI_IFR_DATE_OP) ||
(Statement->OpCode->OpCode == EFI_IFR_TIME_OP)) { (Statement->OpCode->OpCode == EFI_IFR_TIME_OP)) {
PrintAt ( PrintAt (
0, ColumnWidth1,
StartColumnOfHelp, StartColumnOfHelp,
BottomRowOfHelp, BottomRowOfHelp,
L"%c%c%c%c%s", L"%c%c%c%c%s",
@ -215,17 +232,19 @@ RefreshKeyHelp (
ARROW_LEFT, ARROW_LEFT,
gMoveHighlight gMoveHighlight
); );
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString); PrintStringAtWithWidth (SecCol, BottomRowOfHelp, gEnterString, ColumnWidth2);
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gAdjustNumber); PrintStringAtWithWidth (StartColumnOfHelp, TopRowOfHelp, gAdjustNumber, ColumnWidth1);
} else { } else {
PrintAt (0, StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight); PrintAt (ColumnWidth1, StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
if (Statement->OpCode->OpCode == EFI_IFR_NUMERIC_OP && NumericOp != NULL && LibGetFieldFromNum(Statement->OpCode) != 0) { if (Statement->OpCode->OpCode == EFI_IFR_NUMERIC_OP && NumericOp != NULL && LibGetFieldFromNum(Statement->OpCode) != 0) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gAdjustNumber); ColumnStr1 = gAdjustNumber;
} }
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString); PrintStringAtWithWidth (StartColumnOfHelp, TopRowOfHelp, ColumnStr1, ColumnWidth1);
PrintStringAtWithWidth (SecCol, BottomRowOfHelp, gEnterString, ColumnWidth2);
} }
} else { } else {
PrintStringAt (SecCol, BottomRowOfHelp, gEnterCommitString); PrintHotKeyHelpString (FormData, FALSE);
PrintStringAtWithWidth (SecCol, BottomRowOfHelp, gEnterCommitString, ColumnWidth2);
// //
// If it is a selected numeric with manual input, display different message // If it is a selected numeric with manual input, display different message
@ -233,33 +252,35 @@ RefreshKeyHelp (
if ((Statement->OpCode->OpCode == EFI_IFR_NUMERIC_OP) || if ((Statement->OpCode->OpCode == EFI_IFR_NUMERIC_OP) ||
(Statement->OpCode->OpCode == EFI_IFR_DATE_OP) || (Statement->OpCode->OpCode == EFI_IFR_DATE_OP) ||
(Statement->OpCode->OpCode == EFI_IFR_TIME_OP)) { (Statement->OpCode->OpCode == EFI_IFR_TIME_OP)) {
PrintStringAt ( ColumnStr2 = HexDisplay ? gHexNumericInput : gDecNumericInput;
SecCol, PrintStringAtWithWidth (StartColumnOfHelp, BottomRowOfHelp, gLibEmptyString, ColumnWidth1);
TopRowOfHelp, } else {
HexDisplay ? gHexNumericInput : gDecNumericInput PrintAt (ColumnWidth1, StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
);
} else if (Statement->OpCode->OpCode != EFI_IFR_ORDERED_LIST_OP) {
PrintAt (0, StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
} }
if (Statement->OpCode->OpCode == EFI_IFR_ORDERED_LIST_OP) { if (Statement->OpCode->OpCode == EFI_IFR_ORDERED_LIST_OP) {
PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gPlusString); ColumnStr1 = gPlusString;
PrintStringAt (ThdCol, TopRowOfHelp, gMinusString); ColumnStr3 = gMinusString;
} }
PrintStringAtWithWidth (StartColumnOfHelp, TopRowOfHelp, ColumnStr1, ColumnWidth1);
PrintStringAtWithWidth (ThdCol, TopRowOfHelp, ColumnStr3, ColumnWidth3);
PrintStringAtWithWidth (SecCol, TopRowOfHelp, ColumnStr2, ColumnWidth2);
PrintStringAt (ThdCol, BottomRowOfHelp, gEnterEscapeString); PrintStringAtWithWidth (ThdCol, BottomRowOfHelp, gEnterEscapeString, ColumnWidth3);
} }
break; break;
case EFI_IFR_CHECKBOX_OP: case EFI_IFR_CHECKBOX_OP:
PrintHotKeyHelpString (FormData); PrintHotKeyHelpString (FormData, TRUE);
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) { if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString); ColumnStr3 = gEscapeString;
} }
PrintStringAtWithWidth (ThdCol, BottomRowOfHelp, ColumnStr3, ColumnWidth3);
PrintAt (0, StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight); PrintAt (ColumnWidth1, StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
PrintStringAt (SecCol, BottomRowOfHelp, gToggleCheckBox); PrintStringAtWithWidth (SecCol, BottomRowOfHelp, gToggleCheckBox, ColumnWidth2);
PrintStringAtWithWidth (StartColumnOfHelp, TopRowOfHelp, gLibEmptyString, ColumnWidth1);
break; break;
case EFI_IFR_REF_OP: case EFI_IFR_REF_OP:
@ -270,25 +291,29 @@ RefreshKeyHelp (
case EFI_IFR_RESET_BUTTON_OP: case EFI_IFR_RESET_BUTTON_OP:
case EFI_IFR_SUBTITLE_OP: case EFI_IFR_SUBTITLE_OP:
if (!Selected) { if (!Selected) {
PrintHotKeyHelpString (FormData); PrintHotKeyHelpString (FormData, TRUE);
if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) { if (gClassOfVfr == FORMSET_CLASS_PLATFORM_SETUP) {
PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString); ColumnStr3 = gEscapeString;
} }
PrintStringAtWithWidth (ThdCol, BottomRowOfHelp, ColumnStr3, ColumnWidth3);
PrintAt (0, StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight); PrintAt (ColumnWidth1, StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
if (Statement->OpCode->OpCode != EFI_IFR_TEXT_OP && Statement->OpCode->OpCode != EFI_IFR_SUBTITLE_OP) { if (Statement->OpCode->OpCode != EFI_IFR_TEXT_OP && Statement->OpCode->OpCode != EFI_IFR_SUBTITLE_OP) {
PrintStringAt (SecCol, BottomRowOfHelp, gEnterString); ColumnStr2 = gEnterString;
} }
PrintStringAtWithWidth (SecCol, BottomRowOfHelp, ColumnStr2, ColumnWidth2);
PrintStringAtWithWidth (StartColumnOfHelp, TopRowOfHelp, ColumnStr1, ColumnWidth1);
} else { } else {
if (Statement->OpCode->OpCode != EFI_IFR_REF_OP) { PrintHotKeyHelpString (FormData, FALSE);
PrintStringAt ( if (Statement->OpCode->OpCode != EFI_IFR_REF_OP) {
(gScreenDimensions.RightColumn - LibGetStringWidth (gEnterCommitString) / 2) / 2, ColumnStr2 = gEnterCommitString;
BottomRowOfHelp, ColumnStr3 = gEnterEscapeString;
gEnterCommitString
);
PrintStringAt (ThdCol, BottomRowOfHelp, gEnterEscapeString);
} }
PrintStringAtWithWidth (StartColumnOfHelp, TopRowOfHelp, ColumnStr1, ColumnWidth1);
PrintStringAtWithWidth (StartColumnOfHelp, BottomRowOfHelp, ColumnStr1, ColumnWidth1);
PrintStringAtWithWidth (SecCol, BottomRowOfHelp, ColumnStr2, ColumnWidth2);
PrintStringAtWithWidth (ThdCol, BottomRowOfHelp, ColumnStr3, ColumnWidth3);
} }
break; break;

View File

@ -1,27 +1,16 @@
##
# This file contains an 'Intel Peripheral Driver' and is
# licensed for Intel CPUs and chipsets under the terms of your
# license agreement with Intel or your vendor. This file may
# be modified by the user, subject to additional terms of the
# license agreement
##
## @file ## @file
# # Customize display library used by display engine.
# General BDS defines and produce general interfaces for platform BDS driver including: #
# 1) BDS boot policy interface; # Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
# 2) BDS boot device connect interface; #
# 3) BDS Misc interfaces for mainting boot variable, ouput string, etc. # This program and the accompanying materials
# # are licensed and made available under the terms and conditions of the BSD License
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR> # which accompanies this distribution. The full text of the license may be found at
# This software and associated documentation (if any) is furnished # http://opensource.org/licenses/bsd-license.php
# under a license and may only be used or copied in accordance # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# with the terms of the license. Except as permitted by such # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# license, no part of this software or documentation may be #
# reproduced, stored in a retrieval system, or transmitted in any #
# form or by any means without the express written consent of
# Intel Corporation.
#
##
[Defines] [Defines]
INF_VERSION = 0x00010005 INF_VERSION = 0x00010005

View File

@ -144,6 +144,7 @@ PrintFramework (
CHAR16 *Buffer; CHAR16 *Buffer;
UINTN Row; UINTN Row;
CHAR16 *TitleStr; CHAR16 *TitleStr;
UINTN TitleColumn;
if (gClassOfVfr != FORMSET_CLASS_PLATFORM_SETUP) { if (gClassOfVfr != FORMSET_CLASS_PLATFORM_SETUP) {
// //
@ -190,20 +191,15 @@ PrintFramework (
// //
// Print Form Title // Print Form Title
// //
ClearLines (
gScreenDimensions.LeftColumn + 1,
gScreenDimensions.RightColumn - 1,
gScreenDimensions.TopRow + 1,
gScreenDimensions.TopRow + 1,
TITLE_TEXT | TITLE_BACKGROUND
);
TitleStr = LibGetToken (FormData->FormTitle, FormData->HiiHandle); TitleStr = LibGetToken (FormData->FormTitle, FormData->HiiHandle);
ASSERT (TitleStr != NULL); ASSERT (TitleStr != NULL);
PrintStringAt ( TitleColumn = (gScreenDimensions.RightColumn + gScreenDimensions.LeftColumn - LibGetStringWidth (TitleStr) / 2) / 2;
(gScreenDimensions.RightColumn + gScreenDimensions.LeftColumn - LibGetStringWidth (TitleStr) / 2) / 2, PrintStringAtWithWidth (gScreenDimensions.LeftColumn + 1, gScreenDimensions.TopRow + 1, gLibEmptyString, TitleColumn - gScreenDimensions.LeftColumn - 1);
PrintStringAtWithWidth (
TitleColumn,
gScreenDimensions.TopRow + 1, gScreenDimensions.TopRow + 1,
TitleStr TitleStr,
gScreenDimensions.RightColumn - 1 - TitleColumn
); );
FreePool (TitleStr); FreePool (TitleStr);
@ -524,29 +520,32 @@ LibGetStringWidth (
Show all registered HotKey help strings on bottom Rows. Show all registered HotKey help strings on bottom Rows.
@param FormData The curent input form data info. @param FormData The curent input form data info.
@param SetState Set HotKey or Clear HotKey
**/ **/
VOID VOID
PrintHotKeyHelpString ( PrintHotKeyHelpString (
IN FORM_DISPLAY_ENGINE_FORM *FormData IN FORM_DISPLAY_ENGINE_FORM *FormData,
IN BOOLEAN SetState
) )
{ {
UINTN CurrentCol; UINTN CurrentCol;
UINTN CurrentRow; UINTN CurrentRow;
UINTN BottomRowOfHotKeyHelp; UINTN BottomRowOfHotKeyHelp;
UINTN ColumnIndexWidth;
UINTN ColumnWidth; UINTN ColumnWidth;
UINTN ColumnIndex;
UINTN Index; UINTN Index;
EFI_SCREEN_DESCRIPTOR LocalScreen; EFI_SCREEN_DESCRIPTOR LocalScreen;
LIST_ENTRY *Link; LIST_ENTRY *Link;
BROWSER_HOT_KEY *HotKey; BROWSER_HOT_KEY *HotKey;
CHAR16 BakChar;
if (IsListEmpty (&FormData->HotKeyListHead)) { CHAR16 *ColumnStr;
return;
}
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR)); CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
ColumnWidth = (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3; ColumnWidth = (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3;
BottomRowOfHotKeyHelp = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 3; BottomRowOfHotKeyHelp = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 3;
ColumnStr = gLibEmptyString;
// //
// Calculate total number of Register HotKeys. // Calculate total number of Register HotKeys.
@ -556,25 +555,41 @@ PrintHotKeyHelpString (
while (!IsNull (&FormData->HotKeyListHead, Link)) { while (!IsNull (&FormData->HotKeyListHead, Link)) {
HotKey = BROWSER_HOT_KEY_FROM_LINK (Link); HotKey = BROWSER_HOT_KEY_FROM_LINK (Link);
// //
// Help string can't exceed ColumnWidth. One Row will show three Help information.
//
if (StrLen (HotKey->HelpString) > ColumnWidth) {
HotKey->HelpString[ColumnWidth] = L'\0';
}
//
// Calculate help information Column and Row. // Calculate help information Column and Row.
// //
if ((Index % 3) != 2) { ColumnIndex = Index % 3;
CurrentCol = LocalScreen.LeftColumn + (2 - Index % 3) * ColumnWidth; if (ColumnIndex == 0) {
CurrentCol = LocalScreen.LeftColumn + 2 * ColumnWidth;
ColumnIndexWidth = ColumnWidth - 1;
} else if (ColumnIndex == 1) {
CurrentCol = LocalScreen.LeftColumn + ColumnWidth;
ColumnIndexWidth = ColumnWidth;
} else { } else {
CurrentCol = LocalScreen.LeftColumn + 2; CurrentCol = LocalScreen.LeftColumn + 2;
ColumnIndexWidth = ColumnWidth - 2;
} }
CurrentRow = BottomRowOfHotKeyHelp - Index / 3; CurrentRow = BottomRowOfHotKeyHelp - Index / 3;
//
// Help string can't exceed ColumnWidth. One Row will show three Help information.
//
BakChar = L'\0';
if (StrLen (HotKey->HelpString) > ColumnIndexWidth) {
BakChar = HotKey->HelpString[ColumnIndexWidth];
HotKey->HelpString[ColumnIndexWidth] = L'\0';
}
// //
// Print HotKey help string on bottom Row. // Print HotKey help string on bottom Row.
// //
PrintStringAt (CurrentCol, CurrentRow, HotKey->HelpString); if (SetState) {
ColumnStr = HotKey->HelpString;
}
PrintStringAtWithWidth (CurrentCol, CurrentRow, ColumnStr, ColumnIndexWidth);
if (BakChar != L'\0') {
HotKey->HelpString[ColumnIndexWidth] = BakChar;
}
// //
// Get Next Hot Key. // Get Next Hot Key.
// //
@ -582,6 +597,25 @@ PrintHotKeyHelpString (
Index ++; Index ++;
} }
if (SetState) {
//
// Clear KeyHelp
//
CurrentRow = BottomRowOfHotKeyHelp - Index / 3;
ColumnIndex = Index % 3;
if (ColumnIndex == 0) {
CurrentCol = LocalScreen.LeftColumn + 2 * ColumnWidth;
ColumnIndexWidth = ColumnWidth - 1;
ColumnIndex ++;
PrintStringAtWithWidth (CurrentCol, CurrentRow, gLibEmptyString, ColumnIndexWidth);
}
if (ColumnIndex == 1) {
CurrentCol = LocalScreen.LeftColumn + ColumnWidth;
ColumnIndexWidth = ColumnWidth;
PrintStringAtWithWidth (CurrentCol, CurrentRow, gLibEmptyString, ColumnIndexWidth);
}
}
return; return;
} }
@ -788,6 +822,7 @@ PrintInternal (
UINTN Index; UINTN Index;
UINTN PreviousIndex; UINTN PreviousIndex;
UINTN Count; UINTN Count;
UINTN TotalCount;
UINTN PrintWidth; UINTN PrintWidth;
UINTN CharWidth; UINTN CharWidth;
@ -812,6 +847,7 @@ PrintInternal (
Index = 0; Index = 0;
PreviousIndex = 0; PreviousIndex = 0;
Count = 0; Count = 0;
TotalCount = 0;
PrintWidth = 0; PrintWidth = 0;
CharWidth = 1; CharWidth = 1;
@ -823,17 +859,14 @@ PrintInternal (
if (Buffer[Index] == 0) { if (Buffer[Index] == 0) {
break; break;
} }
//
// Null-terminate the temporary string
//
BackupBuffer[Index] = 0;
// //
// Print this out, we are about to switch widths // Print this out, we are about to switch widths
// //
Out->OutputString (Out, &BackupBuffer[PreviousIndex]); Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
Count += StrLen (&BackupBuffer[PreviousIndex]); Count = StrLen (&BackupBuffer[PreviousIndex]);
PrintWidth += Count * CharWidth; PrintWidth += Count * CharWidth;
TotalCount += Count;
// //
// Preserve the current index + 1, since this is where we will start printing from next // Preserve the current index + 1, since this is where we will start printing from next
@ -867,8 +900,9 @@ PrintInternal (
// We hit the end of the string - print it // We hit the end of the string - print it
// //
Out->OutputString (Out, &BackupBuffer[PreviousIndex]); Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
Count += StrLen (&BackupBuffer[PreviousIndex]); Count = StrLen (&BackupBuffer[PreviousIndex]);
PrintWidth += Count * CharWidth; PrintWidth += Count * CharWidth;
TotalCount += Count;
if (PrintWidth < Width) { if (PrintWidth < Width) {
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f; Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
Out->SetAttribute (Out, Out->Mode->Attribute); Out->SetAttribute (Out, Out->Mode->Attribute);
@ -877,7 +911,7 @@ PrintInternal (
FreePool (Buffer); FreePool (Buffer);
FreePool (BackupBuffer); FreePool (BackupBuffer);
return Count; return TotalCount;
} }
/** /**

View File

@ -193,11 +193,13 @@ LibGetStringWidth (
Show all registered HotKey help strings on bottom Rows. Show all registered HotKey help strings on bottom Rows.
@param FormData The curent input form data info. @param FormData The curent input form data info.
@param SetState Set HotKey or Clear HotKey
**/ **/
VOID VOID
PrintHotKeyHelpString ( PrintHotKeyHelpString (
IN FORM_DISPLAY_ENGINE_FORM *FormData IN FORM_DISPLAY_ENGINE_FORM *FormData,
IN BOOLEAN SetState
); );
/** /**

View File

@ -130,6 +130,7 @@ CHAR16 *gOptionMismatch;
CHAR16 *gFormSuppress; CHAR16 *gFormSuppress;
CHAR16 *gProtocolNotFound; CHAR16 *gProtocolNotFound;
CHAR16 gModalSkipColumn;
CHAR16 gPromptBlockWidth; CHAR16 gPromptBlockWidth;
CHAR16 gOptionBlockWidth; CHAR16 gOptionBlockWidth;
CHAR16 gHelpBlockWidth; CHAR16 gHelpBlockWidth;
@ -259,20 +260,28 @@ GetPrompt (
Get the supported width for a particular op-code Get the supported width for a particular op-code
@param Statement The curent statement. @param Statement The curent statement.
@param AdjustWidth The width which is saved for the space.
@return Returns the number of CHAR16 characters that is support. @return Returns the number of CHAR16 characters that is support.
**/ **/
UINT16 UINT16
GetWidth ( GetWidth (
IN FORM_DISPLAY_ENGINE_STATEMENT *Statement IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,
OUT UINT16 *AdjustWidth
) )
{ {
CHAR16 *String; CHAR16 *String;
UINTN Size; UINTN Size;
UINT16 Width;
EFI_IFR_TEXT *TestOp; EFI_IFR_TEXT *TestOp;
//
// For modal form, clean the entire row.
//
if ((gFormData->Attribute & HII_DISPLAY_MODAL) != 0) {
return (UINT16)(gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - gModalSkipColumn - SCROLL_ARROW_HEIGHT);
}
Size = 0; Size = 0;
// //
@ -297,12 +306,23 @@ GetWidth (
// //
((Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) && (Size == 0)) ((Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) && (Size == 0))
) { ) {
Width = (UINT16) (gPromptBlockWidth + gOptionBlockWidth);
} else { //
Width = (UINT16) gPromptBlockWidth; // Return the space width.
//
if (AdjustWidth != NULL) {
*AdjustWidth = 2;
}
//
// Keep consistent with current behavior.
//
return (UINT16) (gPromptBlockWidth + gOptionBlockWidth - 2);
} }
return (UINT16) (Width - LEFT_SKIPPED_COLUMNS); if (AdjustWidth != NULL) {
*AdjustWidth = 1;
}
return (UINT16) (gPromptBlockWidth - 1);
} }
/** /**
@ -516,7 +536,7 @@ UiAddMenuOption (
String = GetToken (PromptId, gFormData->HiiHandle); String = GetToken (PromptId, gFormData->HiiHandle);
ASSERT (String != NULL); ASSERT (String != NULL);
Width = GetWidth (Statement); Width = GetWidth (Statement, NULL);
for (; GetLineByWidth (String, Width, &GlyphWidth,&ArrayEntry, &OutputString) != 0x0000;) { for (; GetLineByWidth (String, Width, &GlyphWidth,&ArrayEntry, &OutputString) != 0x0000;) {
// //
// If there is more string to process print on the next row and increment the Skip value // If there is more string to process print on the next row and increment the Skip value
@ -1437,6 +1457,379 @@ FindTopMenu (
} }
} }
/**
Update highlight menu info.
@param MenuOption The menu opton which is highlight.
**/
VOID
UpdateHighlightMenuInfo (
IN UI_MENU_OPTION *MenuOption
)
{
FORM_DISPLAY_ENGINE_STATEMENT *Statement;
//
// This is the current selected statement
//
Statement = MenuOption->ThisTag;
//
// Get the highlight statement.
//
gUserInput->SelectedStatement = Statement;
gSequence = (UINT16) MenuOption->Sequence;
//
// Record highlight row info for date/time opcode.
//
if (Statement->OpCode->OpCode == EFI_IFR_DATE_OP || Statement->OpCode->OpCode == EFI_IFR_TIME_OP) {
gHighligthMenuInfo.QuestionId = GetQuestionIdInfo(Statement->OpCode);
gHighligthMenuInfo.DisplayRow = (UINT16) MenuOption->Row;
} else {
gHighligthMenuInfo.QuestionId = 0;
gHighligthMenuInfo.DisplayRow = 0;
}
RefreshKeyHelp(gFormData, Statement, FALSE);
}
/**
Update attribut for this menu.
@param MenuOption The menu opton which this attribut used to.
@param Highlight Whether this menu will be highlight.
**/
VOID
SetDisplayAttribute (
IN UI_MENU_OPTION *MenuOption,
IN BOOLEAN Highlight
)
{
FORM_DISPLAY_ENGINE_STATEMENT *Statement;
Statement = MenuOption->ThisTag;
if (Highlight) {
gST->ConOut->SetAttribute (gST->ConOut, GetHighlightTextColor ());
return;
}
if (MenuOption->GrayOut) {
gST->ConOut->SetAttribute (gST->ConOut, GetGrayedTextColor ());
} else {
if (Statement->OpCode->OpCode == EFI_IFR_SUBTITLE_OP) {
gST->ConOut->SetAttribute (gST->ConOut, GetSubTitleTextColor ());
} else {
gST->ConOut->SetAttribute (gST->ConOut, GetFieldTextColor ());
}
}
}
/**
Print string for this menu option.
@param MenuOption The menu opton which this attribut used to.
@param Col The column that this string will be print at.
@param Row The row that this string will be print at.
@param String The string which need to print.
@param Width The width need to print, if string is less than the
width, the block space will be used.
@param Highlight Whether this menu will be highlight.
**/
VOID
DisplayMenuString (
IN UI_MENU_OPTION *MenuOption,
IN UINTN Col,
IN UINTN Row,
IN CHAR16 *String,
IN UINTN Width,
IN BOOLEAN Highlight
)
{
UINTN Length;
//
// Print string with normal color.
//
if (!Highlight) {
PrintStringAtWithWidth (Col, Row, String, Width);
return;
}
//
// Print the highlight menu string.
// First print the highlight string.
//
SetDisplayAttribute(MenuOption, TRUE);
Length = PrintStringAt (Col, Row, String);
//
// Second, clean the empty after the string.
//
SetDisplayAttribute(MenuOption, FALSE);
PrintStringAtWithWidth (Col + Length, Row, L"", Width - Length);
}
/**
Print string for this menu option.
@param MenuOption The menu opton which this attribut used to.
@param SkipWidth The skip width between the left to the start of the prompt.
@param BeginCol The begin column for one menu.
@param SkipLine The skip line for this menu.
@param BottomRow The bottom row for this form.
@param Highlight Whether this menu will be highlight.
@retval EFI_SUCESSS Process the user selection success.
**/
EFI_STATUS
DisplayOneMenu (
IN UI_MENU_OPTION *MenuOption,
IN UINTN SkipWidth,
IN UINTN BeginCol,
IN UINTN SkipLine,
IN UINTN BottomRow,
IN BOOLEAN Highlight
)
{
FORM_DISPLAY_ENGINE_STATEMENT *Statement;
UINTN Index;
UINT16 Width;
UINT16 PromptWidth;
CHAR16 *StringPtr;
CHAR16 *OptionString;
CHAR16 *OutputString;
UINTN OriginalRow;
UINT16 GlyphWidth;
UINTN Temp;
UINTN Temp2;
UINTN Temp3;
EFI_STATUS Status;
UINTN Row;
UINTN Col;
UINTN PromptLineNum;
CHAR16 AdjustValue;
Statement = MenuOption->ThisTag;
Col = MenuOption->Col;
Row = MenuOption->Row;
Temp = SkipLine;
Temp2 = SkipLine;
Temp3 = SkipLine;
AdjustValue = 0;
//
// Set default color.
//
SetDisplayAttribute (MenuOption, FALSE);
//
// 1. Paint the option string.
//
Status = ProcessOptions (MenuOption, FALSE, &OptionString, FALSE);
if (EFI_ERROR (Status)) {
return Status;
}
if (OptionString != NULL) {
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, TRUE);
}
Width = (UINT16) gOptionBlockWidth - 1;
OriginalRow = Row;
GlyphWidth = 1;
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) {
//
// 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
// with skip value is 1.
//
if (MenuOption->Skip != 0) {
//
// 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);
} else {
//
// For date/ time, print the first and second past (year for date and second for time)
//
DisplayMenuString (MenuOption, MenuOption->OptCol, Row, OutputString, StrLen (OutputString), Highlight);
}
} else {
DisplayMenuString (MenuOption, MenuOption->OptCol, Row, OutputString, Width + 1, Highlight);
}
}
//
// If there is more string to process print on the next row and increment the Skip value
//
if (StrLen (&OptionString[Index]) != 0) {
if (Temp2 == 0) {
Row++;
//
// Since the Number of lines for this menu entry may or may not be reflected accurately
// since the prompt might be 1 lines and option might be many, and vice versa, we need to do
// some testing to ensure we are keeping this in-sync.
//
// If the difference in rows is greater than or equal to the skip value, increase the skip value
//
if ((Row - OriginalRow) >= MenuOption->Skip) {
MenuOption->Skip++;
}
}
}
FreePool (OutputString);
if (Temp2 != 0) {
Temp2--;
}
}
Row = OriginalRow;
Highlight = FALSE;
FreePool (OptionString);
}
Temp2 = 0;
//
// 2. Pre calculate the skip value.
//
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;
OriginalRow = Row;
GlyphWidth = 1;
for (Index = 0; GetLineByWidth (StringPtr, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
if (StrLen (&StringPtr[Index]) != 0) {
Row++;
if ((Row - OriginalRow) >= MenuOption->Skip) {
MenuOption->Skip++;
}
}
FreePool (OutputString);
}
Row = OriginalRow;
FreePool (StringPtr);
}
//
// 3. Paint the description.
//
PromptWidth = GetWidth (Statement, &AdjustValue);
OriginalRow = Row;
GlyphWidth = 1;
PromptLineNum = 0;
if (MenuOption->Description == NULL || MenuOption->Description[0] == '\0') {
while (Temp++ < MenuOption->Skip) {
PrintStringAtWithWidth (BeginCol, Row++, L"", PromptWidth + AdjustValue + SkipWidth);
}
} else {
for (Index = 0; GetLineByWidth (MenuOption->Description, PromptWidth, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
if ((Temp == 0) && (Row <= BottomRow)) {
//
// 1.Clean the start LEFT_SKIPPED_COLUMNS
//
PrintStringAtWithWidth (BeginCol, Row, L"", SkipWidth);
if (Statement->OpCode->OpCode == EFI_IFR_REF_OP && MenuOption->Col >= 2) {
//
// Print Arrow for Goto button.
//
PrintCharAt (
MenuOption->Col - 2,
Row,
GEOMETRICSHAPE_RIGHT_TRIANGLE
);
}
DisplayMenuString (MenuOption, MenuOption->Col, Row, OutputString, PromptWidth + AdjustValue, Highlight);
PromptLineNum ++;
}
//
// If there is more string to process print on the next row and increment the Skip value
//
if (StrLen (&MenuOption->Description[Index]) != 0) {
if (Temp == 0) {
Row++;
}
}
FreePool (OutputString);
if (Temp != 0) {
Temp--;
}
}
Highlight = FALSE;
//
// Clean the empty prompt line.
// These line is used by option string but not prompt, so clean them here.
//
Row = OriginalRow + PromptLineNum;
while (PromptLineNum + SkipLine < MenuOption->Skip && Row <= BottomRow) {
PrintStringAtWithWidth (BeginCol, Row, L"", PromptWidth + AdjustValue + SkipWidth);
PromptLineNum ++;
Row ++;
}
}
Row = OriginalRow;
//
// 4. 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);
Width = (UINT16) gOptionBlockWidth - 1;
OriginalRow = Row;
GlyphWidth = 1;
for (Index = 0; GetLineByWidth (StringPtr, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
if ((Temp3 == 0) && (Row <= BottomRow)) {
DisplayMenuString (MenuOption, MenuOption->OptCol, Row, OutputString, Width + 1, Highlight);
}
//
// If there is more string to process print on the next row and increment the Skip value
//
if (StrLen (&StringPtr[Index]) != 0) {
if (Temp3 == 0) {
Row++;
}
}
FreePool (OutputString);
if (Temp3 != 0) {
Temp3--;
}
}
Row = OriginalRow;
FreePool (StringPtr);
}
return EFI_SUCCESS;
}
/** /**
Display menu and wait for user to select one menu option, then return it. Display menu and wait for user to select one menu option, then return it.
If AutoBoot is enabled, then if user doesn't select any option, If AutoBoot is enabled, then if user doesn't select any option,
@ -1458,10 +1851,8 @@ UiDisplayMenu (
UINTN DistanceValue; UINTN DistanceValue;
UINTN Row; UINTN Row;
UINTN Col; UINTN Col;
UINTN TempRightCol;
UINTN Temp; UINTN Temp;
UINTN Temp2; UINTN Temp2;
UINTN Temp3;
UINTN TopRow; UINTN TopRow;
UINTN BottomRow; UINTN BottomRow;
UINTN OriginalRow; UINTN OriginalRow;
@ -1491,7 +1882,6 @@ UiDisplayMenu (
UI_SCREEN_OPERATION ScreenOperation; UI_SCREEN_OPERATION ScreenOperation;
UINT16 DefaultId; UINT16 DefaultId;
FORM_DISPLAY_ENGINE_STATEMENT *Statement; FORM_DISPLAY_ENGINE_STATEMENT *Statement;
UINTN ModalSkipColumn;
BROWSER_HOT_KEY *HotKey; BROWSER_HOT_KEY *HotKey;
UINTN HelpPageIndex; UINTN HelpPageIndex;
UINTN HelpPageCount; UINTN HelpPageCount;
@ -1507,6 +1897,7 @@ UiDisplayMenu (
EFI_STRING_ID HelpInfo; EFI_STRING_ID HelpInfo;
UI_EVENT_TYPE EventType; UI_EVENT_TYPE EventType;
FORM_DISPLAY_ENGINE_STATEMENT *InitialHighlight; FORM_DISPLAY_ENGINE_STATEMENT *InitialHighlight;
BOOLEAN SkipHighLight;
EventType = UIEventNone; EventType = UIEventNone;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
@ -1531,6 +1922,7 @@ UiDisplayMenu (
UpArrow = FALSE; UpArrow = FALSE;
DownArrow = FALSE; DownArrow = FALSE;
SkipValue = 0; SkipValue = 0;
SkipHighLight = FALSE;
NextMenuOption = NULL; NextMenuOption = NULL;
PreviousMenuOption = NULL; PreviousMenuOption = NULL;
@ -1538,21 +1930,27 @@ UiDisplayMenu (
HotKey = NULL; HotKey = NULL;
Repaint = TRUE; Repaint = TRUE;
MenuOption = NULL; MenuOption = NULL;
ModalSkipColumn = (gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn) / 6; gModalSkipColumn = (CHAR16) (gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn) / 6;
InitialHighlight = gFormData->HighLightedStatement; InitialHighlight = gFormData->HighLightedStatement;
ZeroMem (&Key, sizeof (EFI_INPUT_KEY)); ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
gOptionBlockWidth = (CHAR16) ((gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn) / 3); //
gPromptBlockWidth = (CHAR16) (gOptionBlockWidth + LEFT_SKIPPED_COLUMNS); // Left right
gHelpBlockWidth = (CHAR16) (gOptionBlockWidth - LEFT_SKIPPED_COLUMNS); // |<-.->|<-.........->|<- .........->|<-...........->|
// Skip Prompt Option Help
//
Width = (CHAR16) ((gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn) / 3);
gOptionBlockWidth = Width + 1;
gHelpBlockWidth = (CHAR16) (Width - LEFT_SKIPPED_COLUMNS);
gPromptBlockWidth = (CHAR16) (gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - 2 * Width - 1);
TopRow = gStatementDimensions.TopRow + SCROLL_ARROW_HEIGHT; TopRow = gStatementDimensions.TopRow + SCROLL_ARROW_HEIGHT;
BottomRow = gStatementDimensions.BottomRow - SCROLL_ARROW_HEIGHT - 1; BottomRow = gStatementDimensions.BottomRow - SCROLL_ARROW_HEIGHT - 1;
Row = TopRow; Row = TopRow;
if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) { if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
Col = gStatementDimensions.LeftColumn + LEFT_SKIPPED_COLUMNS + ModalSkipColumn; Col = gStatementDimensions.LeftColumn + LEFT_SKIPPED_COLUMNS + gModalSkipColumn;
} else { } else {
Col = gStatementDimensions.LeftColumn + LEFT_SKIPPED_COLUMNS; Col = gStatementDimensions.LeftColumn + LEFT_SKIPPED_COLUMNS;
} }
@ -1565,30 +1963,21 @@ UiDisplayMenu (
while (TRUE) { while (TRUE) {
switch (ControlFlag) { switch (ControlFlag) {
case CfInitialization: case CfInitialization:
if (IsListEmpty (&gMenuOption)) { if ((gOldFormEntry.HiiHandle != FormData->HiiHandle) ||
(!CompareGuid (&gOldFormEntry.FormSetGuid, &FormData->FormSetGuid))) {
if ((FormData->Attribute & HII_DISPLAY_MODAL) == 0) { //
// // Clear Statement range if different formset is painted.
// Clear Statement range. //
// ClearLines (
ClearLines ( gStatementDimensions.LeftColumn,
gStatementDimensions.LeftColumn, gStatementDimensions.RightColumn,
gStatementDimensions.RightColumn, TopRow - SCROLL_ARROW_HEIGHT,
TopRow - SCROLL_ARROW_HEIGHT, BottomRow + SCROLL_ARROW_HEIGHT,
BottomRow + SCROLL_ARROW_HEIGHT, GetFieldTextColor ()
GetFieldTextColor () );
);
//
// Clear Key Range
//
RefreshKeyHelp (gFormData, NULL, FALSE);
}
ControlFlag = CfReadKey;
} else {
ControlFlag = CfRepaint;
} }
ControlFlag = CfRepaint;
break; break;
case CfRepaint: case CfRepaint:
@ -1602,47 +1991,25 @@ UiDisplayMenu (
UpArrow = FALSE; UpArrow = FALSE;
Row = TopRow; Row = TopRow;
Temp = (UINTN) SkipValue; gST->ConOut->SetAttribute (gST->ConOut, GetFieldTextColor ());
Temp2 = (UINTN) SkipValue;
Temp3 = (UINTN) SkipValue; //
// 1. Check whether need to print the arrow up.
//
if (!ValueIsScroll (TRUE, TopOfScreen)) {
UpArrow = TRUE;
}
PrintStringAtWithWidth(gStatementDimensions.LeftColumn, TopRow - 1, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn);
// if (UpArrow) {
// 1. Clear the screen. gST->ConOut->SetAttribute (gST->ConOut, GetArrowColor ());
// PrintCharAt (
if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) { gStatementDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + 1,
ClearLines (
gStatementDimensions.LeftColumn + ModalSkipColumn,
gStatementDimensions.LeftColumn + ModalSkipColumn + gPromptBlockWidth + gOptionBlockWidth,
TopRow - SCROLL_ARROW_HEIGHT, TopRow - SCROLL_ARROW_HEIGHT,
BottomRow + SCROLL_ARROW_HEIGHT, ARROW_UP
GetFieldTextColor ()
);
} else {
TempRightCol = gStatementDimensions.RightColumn;
if (!mStatementLayoutIsChanged) {
TempRightCol = gStatementDimensions.RightColumn - gHelpBlockWidth;
}
ClearLines (
gStatementDimensions.LeftColumn,
gStatementDimensions.RightColumn,
TopRow - SCROLL_ARROW_HEIGHT,
TopRow - 1,
GetFieldTextColor ()
);
ClearLines (
gStatementDimensions.LeftColumn,
TempRightCol,
TopRow,
BottomRow,
GetFieldTextColor ()
);
ClearLines (
gStatementDimensions.LeftColumn,
gStatementDimensions.RightColumn,
BottomRow + 1,
BottomRow + SCROLL_ARROW_HEIGHT,
GetFieldTextColor ()
); );
gST->ConOut->SetAttribute (gST->ConOut, GetFieldTextColor ());
} }
// //
@ -1653,168 +2020,30 @@ UiDisplayMenu (
MenuOption->Row = Row; MenuOption->Row = Row;
MenuOption->Col = Col; MenuOption->Col = Col;
if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) { if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
MenuOption->OptCol = gPromptBlockWidth + 1 + gStatementDimensions.LeftColumn + ModalSkipColumn; MenuOption->OptCol = gStatementDimensions.LeftColumn + LEFT_SKIPPED_COLUMNS + gPromptBlockWidth + gModalSkipColumn;
} else { } else {
MenuOption->OptCol = gPromptBlockWidth + 1 + gStatementDimensions.LeftColumn; MenuOption->OptCol = gStatementDimensions.LeftColumn + LEFT_SKIPPED_COLUMNS + gPromptBlockWidth;
} }
Statement = MenuOption->ThisTag;
if (MenuOption->NestInStatement) { if (MenuOption->NestInStatement) {
MenuOption->Col += SUBTITLE_INDENT; MenuOption->Col += SUBTITLE_INDENT;
} }
if (MenuOption->GrayOut) { //
gST->ConOut->SetAttribute (gST->ConOut, GetGrayedTextColor ()); // Save the highlight menu, will be used in CfRefreshHighLight case.
} else { //
if (Statement->OpCode->OpCode == EFI_IFR_SUBTITLE_OP) { if (Link == NewPos) {
gST->ConOut->SetAttribute (gST->ConOut, GetSubTitleTextColor ()); SavedMenuOption = MenuOption;
} SkipHighLight = TRUE;
} }
Width = GetWidth (Statement); DisplayOneMenu (MenuOption,
OriginalRow = Row; ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) ? LEFT_SKIPPED_COLUMNS + gModalSkipColumn : LEFT_SKIPPED_COLUMNS,
GlyphWidth = 1; gStatementDimensions.LeftColumn,
Link == TopOfScreen ? SkipValue : 0,
if (Statement->OpCode->OpCode == EFI_IFR_REF_OP && MenuOption->Col >= 2) { BottomRow,
// Link == NewPos && IsSelectable(MenuOption)
// Print Arrow for Goto button. );
//
PrintCharAt (
MenuOption->Col - 2,
Row,
GEOMETRICSHAPE_RIGHT_TRIANGLE
);
}
//
// 2.1. Paint the description.
//
for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
//
// Temp means need to skip how many lines from the start.
//
if ((Temp == 0) && (Row <= BottomRow)) {
PrintStringAt (MenuOption->Col, Row, OutputString);
}
//
// If there is more string to process print on the next row and increment the Skip value
//
if (StrLen (&MenuOption->Description[Index]) != 0) {
if (Temp == 0) {
Row++;
}
}
FreePool (OutputString);
if (Temp != 0) {
Temp--;
}
}
Temp = 0;
Row = OriginalRow;
//
// 2.2. Paint the option string.
//
Status = ProcessOptions (MenuOption, FALSE, &OptionString, FALSE);
//
// If Error occur, question value update in ProcessOptions.
// Exit current FormDisplay with new question value.
//
if (EFI_ERROR (Status)) {
return Status;
}
if (OptionString != NULL) {
if (Statement->OpCode->OpCode == EFI_IFR_DATE_OP || Statement->OpCode->OpCode == EFI_IFR_TIME_OP) {
ProcessStringForDateTime(MenuOption, OptionString, TRUE);
}
Width = (UINT16) gOptionBlockWidth;
OriginalRow = Row;
GlyphWidth = 1;
for (Index = 0; GetLineByWidth (OptionString, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
if ((Temp2 == 0) && (Row <= BottomRow)) {
PrintStringAt (MenuOption->OptCol, Row, OutputString);
}
//
// If there is more string to process print on the next row and increment the Skip value
//
if (StrLen (&OptionString[Index]) != 0) {
if (Temp2 == 0) {
Row++;
//
// Since the Number of lines for this menu entry may or may not be reflected accurately
// since the prompt might be 1 lines and option might be many, and vice versa, we need to do
// some testing to ensure we are keeping this in-sync.
//
// If the difference in rows is greater than or equal to the skip value, increase the skip value
//
if ((Row - OriginalRow) >= MenuOption->Skip) {
MenuOption->Skip++;
}
}
}
FreePool (OutputString);
if (Temp2 != 0) {
Temp2--;
}
}
Row = OriginalRow;
FreePool (OptionString);
}
Temp2 = 0;
//
// 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);
Width = (UINT16) gOptionBlockWidth;
OriginalRow = Row;
GlyphWidth = 1;
for (Index = 0; GetLineByWidth (StringPtr, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
if ((Temp3 == 0) && (Row <= BottomRow)) {
PrintStringAt (MenuOption->OptCol, Row, OutputString);
}
//
// If there is more string to process print on the next row and increment the Skip value
//
if (StrLen (&StringPtr[Index]) != 0) {
if (Temp3 == 0) {
Row++;
//
// Since the Number of lines for this menu entry may or may not be reflected accurately
// since the prompt might be 1 lines and option might be many, and vice versa, we need to do
// some testing to ensure we are keeping this in-sync.
//
// If the difference in rows is greater than or equal to the skip value, increase the skip value
//
if ((Row - OriginalRow) >= MenuOption->Skip) {
MenuOption->Skip++;
}
}
}
FreePool (OutputString);
if (Temp3 != 0) {
Temp3--;
}
}
Row = OriginalRow;
FreePool (StringPtr);
}
Temp3 = 0;
gST->ConOut->SetAttribute (gST->ConOut, GetFieldTextColor ());
// //
// 3. Update the row info which will be used by next menu. // 3. Update the row info which will be used by next menu.
@ -1835,20 +2064,22 @@ UiDisplayMenu (
} }
} }
if (!ValueIsScroll (TRUE, TopOfScreen)) { //
UpArrow = TRUE; // 3. Menus in this form may not cover all form, clean the remain field.
} //
while (Row <= BottomRow) {
if (UpArrow) { if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {
gST->ConOut->SetAttribute (gST->ConOut, GetArrowColor ()); PrintStringAtWithWidth(gStatementDimensions.LeftColumn, Row++, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn);
PrintCharAt ( } else {
gStatementDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + 1, PrintStringAtWithWidth(gStatementDimensions.LeftColumn, Row++, L"", gStatementDimensions.RightColumn - gHelpBlockWidth - gStatementDimensions.LeftColumn);
TopRow - SCROLL_ARROW_HEIGHT, }
ARROW_UP
);
gST->ConOut->SetAttribute (gST->ConOut, GetFieldTextColor ());
} }
//
// 4. Print the down arrow row.
//
PrintStringAtWithWidth(gStatementDimensions.LeftColumn, BottomRow + 1, L"", gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn);
if (DownArrow) { if (DownArrow) {
gST->ConOut->SetAttribute (gST->ConOut, GetArrowColor ()); gST->ConOut->SetAttribute (gST->ConOut, GetArrowColor ());
PrintCharAt ( PrintCharAt (
@ -1860,6 +2091,10 @@ UiDisplayMenu (
} }
MenuOption = NULL; MenuOption = NULL;
if (IsListEmpty (&gMenuOption)) {
ControlFlag = CfReadKey;
}
} }
break; break;
@ -1872,6 +2107,13 @@ UiDisplayMenu (
// //
ControlFlag = CfUpdateHelpString; ControlFlag = CfUpdateHelpString;
if (SkipHighLight) {
MenuOption = SavedMenuOption;
SkipHighLight = FALSE;
UpdateHighlightMenuInfo (MenuOption);
break;
}
if (MenuOption != NULL && TopOfScreen == &MenuOption->Link) { if (MenuOption != NULL && TopOfScreen == &MenuOption->Link) {
Temp = SkipValue; Temp = SkipValue;
} else { } else {
@ -1933,7 +2175,7 @@ UiDisplayMenu (
} }
OriginalRow = MenuOption->Row; OriginalRow = MenuOption->Row;
Width = GetWidth (MenuOption->ThisTag); Width = GetWidth (MenuOption->ThisTag, NULL);
GlyphWidth = 1; GlyphWidth = 1;
for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) { for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
@ -1967,25 +2209,9 @@ UiDisplayMenu (
MenuOption = MENU_OPTION_FROM_LINK (NewPos); MenuOption = MENU_OPTION_FROM_LINK (NewPos);
Statement = MenuOption->ThisTag; Statement = MenuOption->ThisTag;
// UpdateHighlightMenuInfo (MenuOption);
// Get the highlight statement.
//
gUserInput->SelectedStatement = Statement;
gSequence = (UINT16) MenuOption->Sequence;
//
// Record highlight row info for date/time opcode.
//
if (Statement->OpCode->OpCode == EFI_IFR_DATE_OP || Statement->OpCode->OpCode == EFI_IFR_TIME_OP) {
gHighligthMenuInfo.QuestionId = GetQuestionIdInfo(Statement->OpCode);
gHighligthMenuInfo.DisplayRow = (UINT16) MenuOption->Row;
} else {
gHighligthMenuInfo.QuestionId = 0;
gHighligthMenuInfo.DisplayRow = 0;
}
if (!IsSelectable (MenuOption)) { if (!IsSelectable (MenuOption)) {
RefreshKeyHelp(gFormData, Statement, FALSE);
break; break;
} }
@ -2031,7 +2257,7 @@ UiDisplayMenu (
if (NewLine) { if (NewLine) {
OriginalRow = MenuOption->Row; OriginalRow = MenuOption->Row;
Width = GetWidth (Statement); Width = GetWidth (Statement, NULL);
GlyphWidth = 1; GlyphWidth = 1;
for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) { for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
@ -2058,8 +2284,6 @@ UiDisplayMenu (
} }
} }
RefreshKeyHelp(gFormData, MenuOption->ThisTag, FALSE);
// //
// Clear reverse attribute // Clear reverse attribute
// //