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,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;
}
/**