X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ShellPkg%2FLibrary%2FUefiShellDebug1CommandsLib%2FHexEdit%2FBufferImage.c;h=68d2443d2e5ed7f57dfb2fc7782fd2d74d81221d;hb=c4e74e9b814cfb4b51cf832f3bb218cd2aba348b;hp=57c4a9c739f29e0a17dd637f1c5977f007a51a2e;hpb=e0c2cc6f8975adde2c8605ae7fd76237bbcc7539;p=mirror_edk2.git diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c index 57c4a9c739..68d2443d2e 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c @@ -2,7 +2,7 @@ Defines HBufferImage - the view of the file that is visible at any point, as well as the event handlers for editing the file - Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -184,7 +184,7 @@ HBufferImageBackup ( return EFI_SUCCESS; } -/** +/** Free all the lines in HBufferImage. Fields affected: Lines @@ -318,9 +318,9 @@ HBufferImagePrintLine ( } if (BeNewColor) { - gST->ConOut->SetAttribute (gST->ConOut, New.Data); + gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); } else { - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); + gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); } Pos = 10 + (Index * 3); @@ -337,7 +337,7 @@ HBufferImagePrintLine ( } - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); + gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); while (Index < 0x08) { Pos = 10 + (Index * 3); ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" "); @@ -355,9 +355,9 @@ HBufferImagePrintLine ( } if (BeNewColor) { - gST->ConOut->SetAttribute (gST->ConOut, New.Data); + gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); } else { - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); + gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); } Pos = 10 + (Index * 3) + 1; @@ -370,7 +370,7 @@ HBufferImagePrintLine ( Index++; } - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); + gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); while (Index < 0x10) { Pos = 10 + (Index * 3) + 1; ShellPrintEx ((INT32)Pos - 1, (INT32)Row - 1, L" "); @@ -379,7 +379,7 @@ HBufferImagePrintLine ( // // restore the original color // - gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); + gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); // // PRINT the buffer content @@ -580,8 +580,9 @@ HBufferImageRestoreMousePosition ( // backup the old screen attributes // Orig = HMainEditor.ColorAttributes; - New.Colors.Foreground = Orig.Colors.Background; - New.Colors.Background = Orig.Colors.Foreground; + New.Data = 0; + New.Colors.Foreground = Orig.Colors.Background & 0xF; + New.Colors.Background = Orig.Colors.Foreground & 0x7; // // if in selected area, @@ -593,7 +594,7 @@ HBufferImageRestoreMousePosition ( )) { gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); } else { - gST->ConOut->SetAttribute (gST->ConOut, New.Data); + gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); } // // clear the old mouse position @@ -645,7 +646,7 @@ HBufferImageRestoreMousePosition ( HBufferImage.MousePosition.Row, HBufferImage.MousePosition.Column )) { - gST->ConOut->SetAttribute (gST->ConOut, New.Data); + gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); } else { gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); } @@ -731,7 +732,7 @@ HBufferImageRestorePosition ( return EFI_SUCCESS; } -/** +/** Refresh function for HBufferImage. @retval EFI_SUCCESS The operation was successful. @@ -752,10 +753,10 @@ HBufferImageRefresh ( UINTN StartRow; UINTN EndRow; UINTN FStartRow; - UINTN FEndRow; UINTN Tmp; Orig = HMainEditor.ColorAttributes; + New.Data = 0; New.Colors.Foreground = Orig.Colors.Background; New.Colors.Background = Orig.Colors.Foreground; @@ -821,7 +822,6 @@ HBufferImageRefresh ( } FStartRow = StartRow; - FEndRow = EndRow; StartRow = 2 + StartRow - HBufferImage.LowVisibleRow; EndRow = 2 + EndRow - HBufferImage.LowVisibleRow; @@ -832,7 +832,7 @@ HBufferImageRefresh ( // FStartRow = HBufferImage.LowVisibleRow; StartRow = 2; - EndRow = (HMainEditor.ScreenSize.Row - 4); + EndRow = (HMainEditor.ScreenSize.Row - 1); } // // no line @@ -906,7 +906,6 @@ HBufferImageRefresh ( @return EFI_SUCCESS The operation was successful. **/ EFI_STATUS -EFIAPI HBufferImageRead ( IN CONST CHAR16 *FileName, IN CONST CHAR16 *DiskName, @@ -1027,7 +1026,7 @@ HBufferImageSave ( return Status; } -/** +/** Create a new line and append it to the line list. Fields affected: NumLines @@ -1074,7 +1073,7 @@ HBufferImageCreateLine ( return Line; } -/** +/** Free the current image. @retval EFI_SUCCESS The operation was successful. @@ -1092,7 +1091,7 @@ HBufferImageFree ( return EFI_SUCCESS; } -/** +/** change char to int value based on Hex. @param[in] Char The input char. @@ -1101,7 +1100,6 @@ HBufferImageFree ( @retval -1 The operation failed. **/ INTN -EFIAPI HBufferImageCharToHex ( IN CHAR16 Char ) @@ -1133,7 +1131,6 @@ HBufferImageCharToHex ( @retval EFI_OUT_OF_RESOURCES A memory allocation failed. **/ EFI_STATUS -EFIAPI HBufferImageAddChar ( IN CHAR16 Char ) @@ -1264,7 +1261,6 @@ HBufferImageAddChar ( @retval EFI_SUCCESS The operationw as successful. **/ EFI_STATUS -EFIAPI HBufferImageDoBackspace ( VOID ) @@ -1328,7 +1324,6 @@ HBufferImageDoBackspace ( @retval EFI_OUT_OF_RESOURCES A memory allocation failed. **/ EFI_STATUS -EFIAPI HBufferImageDoCharInput ( IN CHAR16 Char ) @@ -1404,7 +1399,7 @@ HUnderCurrentScreen ( IN UINTN FileRow ) { - if (FileRow > HBufferImage.LowVisibleRow + (HMainEditor.ScreenSize.Row - 5) - 1) { + if (FileRow > HBufferImage.LowVisibleRow + (HMainEditor.ScreenSize.Row - 2) - 1) { return TRUE; } @@ -1712,8 +1707,8 @@ HBufferImagePageDown ( // // has next page // - if (HBufferImage.NumLines >= FRow + (HMainEditor.ScreenSize.Row - 5)) { - Gap = (HMainEditor.ScreenSize.Row - 5); + if (HBufferImage.NumLines >= FRow + (HMainEditor.ScreenSize.Row - 2)) { + Gap = (HMainEditor.ScreenSize.Row - 2); } else { // // MOVE CURSOR TO LAST LINE @@ -1750,22 +1745,19 @@ HBufferImagePageUp ( VOID ) { - HEFI_EDITOR_LINE *Line; UINTN FRow; UINTN FCol; UINTN Gap; INTN Retreat; - Line = HBufferImage.CurrentLine; - FRow = HBufferImage.BufferPosition.Row; FCol = HBufferImage.BufferPosition.Column; // // has previous page // - if (FRow > (HMainEditor.ScreenSize.Row - 5)) { - Gap = (HMainEditor.ScreenSize.Row - 5); + if (FRow > (HMainEditor.ScreenSize.Row - 2)) { + Gap = (HMainEditor.ScreenSize.Row - 2); } else { // // the first line of file will displayed on the first line of screen @@ -1776,11 +1768,6 @@ HBufferImagePageUp ( Retreat = Gap; Retreat = -Retreat; - // - // get correct line - // - Line = HMoveLine (Retreat); - FRow -= Gap; HBufferImageMovePosition (FRow, FCol, HBufferImage.HighBits); @@ -1798,13 +1785,10 @@ HBufferImageHome ( VOID ) { - HEFI_EDITOR_LINE *Line; UINTN FRow; UINTN FCol; BOOLEAN HighBits; - Line = HBufferImage.CurrentLine; - // // curosr will at the high bit // @@ -1918,7 +1902,6 @@ HBufferImageDeleteCharacterFromBuffer ( HEFI_EDITOR_LINE *Line; LIST_ENTRY *Link; - UINTN StartRow; UINTN OldFCol; UINTN OldFRow; @@ -1928,11 +1911,6 @@ HBufferImageDeleteCharacterFromBuffer ( EFI_STATUS Status; - // - // get the line that start position is at - // - StartRow = Pos / 0x10; - Size = HBufferImageGetTotalSize (); if (Size < Count) { @@ -2054,7 +2032,6 @@ HBufferImageAddCharacterToBuffer ( HEFI_EDITOR_LINE *Line; LIST_ENTRY *Link; - UINTN StartRow; UINTN OldFCol; UINTN OldFRow; @@ -2062,11 +2039,6 @@ HBufferImageAddCharacterToBuffer ( UINTN NewPos; - // - // get the line that start position is at - // - StartRow = Pos / 0x10; - Size = HBufferImageGetTotalSize (); // @@ -2142,7 +2114,6 @@ HBufferImageAddCharacterToBuffer ( @retval EFI_SUCCESS The operationw as successful. **/ EFI_STATUS -EFIAPI HBufferImageDoDelete ( VOID ) @@ -2203,7 +2174,6 @@ HBufferImageDoDelete ( @retval EFI_OUT_OF_RESOURCES A memory allocation failed. **/ EFI_STATUS -EFIAPI HBufferImageBufferToList ( IN VOID *Buffer, IN UINTN Bytes @@ -2268,7 +2238,6 @@ HBufferImageBufferToList ( @retval EFI_SUCCESS The operation was successful. **/ EFI_STATUS -EFIAPI HBufferImageListToBuffer ( IN VOID *Buffer, IN UINTN Bytes @@ -2323,7 +2292,6 @@ HBufferImageListToBuffer ( @param[in] TextY The y-coordinate. **/ VOID -EFIAPI HBufferImageAdjustMousePosition ( IN INT32 TextX, IN INT32 TextY @@ -2392,12 +2360,12 @@ HBufferImageAdjustMousePosition ( // check whether new mouse row position is beyond screen // if not, adjust it // - if (TempY >= 2 && TempY <= (HMainEditor.ScreenSize.Row - 4)) { + if (TempY >= 2 && TempY <= (HMainEditor.ScreenSize.Row - 1)) { HBufferImage.MousePosition.Row = TempY; } else if (TempY < 2) { HBufferImage.MousePosition.Row = 2; - } else if (TempY > (HMainEditor.ScreenSize.Row - 4)) { - HBufferImage.MousePosition.Row = (HMainEditor.ScreenSize.Row - 4); + } else if (TempY > (HMainEditor.ScreenSize.Row - 1)) { + HBufferImage.MousePosition.Row = (HMainEditor.ScreenSize.Row - 1); } }