diff options
Diffstat (limited to 'MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c')
-rw-r--r-- | MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c | 100 |
1 files changed, 67 insertions, 33 deletions
diff --git a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c index b6b4055b6d..82ab82bb34 100644 --- a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c +++ b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c @@ -144,6 +144,7 @@ PrintFramework ( CHAR16 *Buffer;
UINTN Row;
CHAR16 *TitleStr;
+ UINTN TitleColumn;
if (gClassOfVfr != FORMSET_CLASS_PLATFORM_SETUP) {
//
@@ -190,20 +191,15 @@ PrintFramework ( //
// 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);
ASSERT (TitleStr != NULL);
- PrintStringAt (
- (gScreenDimensions.RightColumn + gScreenDimensions.LeftColumn - LibGetStringWidth (TitleStr) / 2) / 2,
+ TitleColumn = (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,
- TitleStr
+ TitleStr,
+ gScreenDimensions.RightColumn - 1 - TitleColumn
);
FreePool (TitleStr);
@@ -524,29 +520,32 @@ LibGetStringWidth ( Show all registered HotKey help strings on bottom Rows.
@param FormData The curent input form data info.
+ @param SetState Set HotKey or Clear HotKey
**/
VOID
PrintHotKeyHelpString (
- IN FORM_DISPLAY_ENGINE_FORM *FormData
+ IN FORM_DISPLAY_ENGINE_FORM *FormData,
+ IN BOOLEAN SetState
)
{
UINTN CurrentCol;
UINTN CurrentRow;
UINTN BottomRowOfHotKeyHelp;
+ UINTN ColumnIndexWidth;
UINTN ColumnWidth;
+ UINTN ColumnIndex;
UINTN Index;
EFI_SCREEN_DESCRIPTOR LocalScreen;
LIST_ENTRY *Link;
BROWSER_HOT_KEY *HotKey;
-
- if (IsListEmpty (&FormData->HotKeyListHead)) {
- return;
- }
+ CHAR16 BakChar;
+ CHAR16 *ColumnStr;
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
ColumnWidth = (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3;
BottomRowOfHotKeyHelp = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 3;
+ ColumnStr = gLibEmptyString;
//
// Calculate total number of Register HotKeys.
@@ -556,25 +555,41 @@ PrintHotKeyHelpString ( while (!IsNull (&FormData->HotKeyListHead, 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.
//
- if ((Index % 3) != 2) {
- CurrentCol = LocalScreen.LeftColumn + (2 - Index % 3) * ColumnWidth;
+ ColumnIndex = Index % 3;
+ if (ColumnIndex == 0) {
+ CurrentCol = LocalScreen.LeftColumn + 2 * ColumnWidth;
+ ColumnIndexWidth = ColumnWidth - 1;
+ } else if (ColumnIndex == 1) {
+ CurrentCol = LocalScreen.LeftColumn + ColumnWidth;
+ ColumnIndexWidth = ColumnWidth;
} else {
- CurrentCol = LocalScreen.LeftColumn + 2;
+ CurrentCol = LocalScreen.LeftColumn + 2;
+ ColumnIndexWidth = ColumnWidth - 2;
}
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.
//
- 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.
//
@@ -582,6 +597,25 @@ PrintHotKeyHelpString ( 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;
}
@@ -788,6 +822,7 @@ PrintInternal ( UINTN Index;
UINTN PreviousIndex;
UINTN Count;
+ UINTN TotalCount;
UINTN PrintWidth;
UINTN CharWidth;
@@ -812,6 +847,7 @@ PrintInternal ( Index = 0;
PreviousIndex = 0;
Count = 0;
+ TotalCount = 0;
PrintWidth = 0;
CharWidth = 1;
@@ -823,17 +859,14 @@ PrintInternal ( if (Buffer[Index] == 0) {
break;
}
- //
- // Null-terminate the temporary string
- //
- BackupBuffer[Index] = 0;
//
// Print this out, we are about to switch widths
//
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
- Count += StrLen (&BackupBuffer[PreviousIndex]);
+ Count = StrLen (&BackupBuffer[PreviousIndex]);
PrintWidth += Count * CharWidth;
+ TotalCount += Count;
//
// 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
//
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
- Count += StrLen (&BackupBuffer[PreviousIndex]);
+ Count = StrLen (&BackupBuffer[PreviousIndex]);
PrintWidth += Count * CharWidth;
+ TotalCount += Count;
if (PrintWidth < Width) {
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
Out->SetAttribute (Out, Out->Mode->Attribute);
@@ -877,7 +911,7 @@ PrintInternal ( FreePool (Buffer);
FreePool (BackupBuffer);
- return Count;
+ return TotalCount;
}
/**
|