mirror of https://github.com/acidanthera/audk.git
ShellPkg: Added the Ctrl based hot key and changed text editor's UI.
* Add Ctrl-E hotkey for help * Add Ctrl based hotkey alternatives to function hotkeys * Don't show hotkey help on the main screen * Change the file buffer's row count for display to adjust the new screen format * Change the edit status bar location, the new edit status bar is in the last line * Change the location of the edit bar, the new edit input bar is in the last line Signed-off-by: kidzyoung reviewed-by: jcarsey reviewed-by: jljusten reviewed-by: jiang git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12036 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
f7c8bd9f9d
commit
5a2beb745f
|
@ -53,7 +53,7 @@ EFI_EDITOR_FILE_BUFFER FileBufferConst = {
|
|||
//
|
||||
// the whole edit area needs to be refreshed
|
||||
//
|
||||
STATIC BOOLEAN FileBufferNeedRefresh;
|
||||
BOOLEAN FileBufferNeedRefresh;
|
||||
|
||||
//
|
||||
// only the current line in edit area needs to be refresh
|
||||
|
@ -627,11 +627,11 @@ FileBufferRefresh (
|
|||
|
||||
Link = Link->ForwardLink;
|
||||
Row++;
|
||||
} while (Link != FileBuffer.ListHead && Row <= (MainEditor.ScreenSize.Row - 4));
|
||||
} while (Link != FileBuffer.ListHead && Row <= (MainEditor.ScreenSize.Row - 1));
|
||||
//
|
||||
// while not file end and not screen full
|
||||
//
|
||||
while (Row <= (MainEditor.ScreenSize.Row - 4)) {
|
||||
while (Row <= (MainEditor.ScreenSize.Row - 1)) {
|
||||
EditorClearLine (Row, MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row);
|
||||
Row++;
|
||||
}
|
||||
|
@ -2300,8 +2300,8 @@ FileBufferPageDown (
|
|||
//
|
||||
// has next page
|
||||
//
|
||||
if (FileBuffer.NumLines >= FRow + (MainEditor.ScreenSize.Row - 5)) {
|
||||
Gap = (MainEditor.ScreenSize.Row - 5);
|
||||
if (FileBuffer.NumLines >= FRow + (MainEditor.ScreenSize.Row - 2)) {
|
||||
Gap = (MainEditor.ScreenSize.Row - 2);
|
||||
} else {
|
||||
//
|
||||
// MOVE CURSOR TO LAST LINE
|
||||
|
@ -2352,8 +2352,8 @@ FileBufferPageUp (
|
|||
//
|
||||
// has previous page
|
||||
//
|
||||
if (FRow > (MainEditor.ScreenSize.Row - 5)) {
|
||||
Gap = (MainEditor.ScreenSize.Row - 5);
|
||||
if (FRow > (MainEditor.ScreenSize.Row - 2)) {
|
||||
Gap = (MainEditor.ScreenSize.Row - 2);
|
||||
} else {
|
||||
//
|
||||
// the first line of file will displayed on the first line of screen
|
||||
|
@ -2575,7 +2575,7 @@ UnderCurrentScreen (
|
|||
//
|
||||
// if is to the under of the screen
|
||||
//
|
||||
if (FileRow > FileBuffer.LowVisibleRange.Row + (MainEditor.ScreenSize.Row - 5) - 1) {
|
||||
if (FileRow > FileBuffer.LowVisibleRange.Row + (MainEditor.ScreenSize.Row - 2) - 1) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -3207,12 +3207,12 @@ FileBufferAdjustMousePosition (
|
|||
// check whether new mouse row position is beyond screen
|
||||
// if not, adjust it
|
||||
//
|
||||
if (CoordinateY >= 2 && CoordinateY <= (MainEditor.ScreenSize.Row - 4)) {
|
||||
if (CoordinateY >= 2 && CoordinateY <= (MainEditor.ScreenSize.Row - 1)) {
|
||||
FileBuffer.MousePosition.Row = CoordinateY;
|
||||
} else if (CoordinateY < 2) {
|
||||
FileBuffer.MousePosition.Row = 2;
|
||||
} else if (CoordinateY > (MainEditor.ScreenSize.Row - 4)) {
|
||||
FileBuffer.MousePosition.Row = (MainEditor.ScreenSize.Row - 4);
|
||||
} else if (CoordinateY > (MainEditor.ScreenSize.Row - 1)) {
|
||||
FileBuffer.MousePosition.Row = (MainEditor.ScreenSize.Row - 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,32 @@
|
|||
#include "TextEditor.h"
|
||||
#include "EditStatusBar.h"
|
||||
#include "EditInputBar.h"
|
||||
#include "EditMenuBar.h"
|
||||
|
||||
//
|
||||
// the first time editor launch
|
||||
//
|
||||
BOOLEAN EditorFirst;
|
||||
|
||||
//
|
||||
// it's time editor should exit
|
||||
//
|
||||
BOOLEAN EditorExit;
|
||||
|
||||
BOOLEAN EditorMouseAction;
|
||||
|
||||
extern EFI_EDITOR_FILE_BUFFER FileBuffer;
|
||||
|
||||
extern BOOLEAN FileBufferNeedRefresh;
|
||||
|
||||
extern BOOLEAN FileBufferOnlyLineNeedRefresh;
|
||||
|
||||
extern BOOLEAN FileBufferMouseNeedRefresh;
|
||||
|
||||
extern EFI_EDITOR_FILE_BUFFER FileBufferBackupVar;
|
||||
|
||||
EFI_EDITOR_GLOBAL_EDITOR MainEditor;
|
||||
|
||||
|
||||
/**
|
||||
Load a file from disk to editor
|
||||
|
@ -61,6 +87,16 @@ MainCommandSaveFile (
|
|||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
show help menu.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
MainCommandDisplayHelp (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
exit editor
|
||||
|
||||
|
@ -121,6 +157,66 @@ MainCommandPasteLine (
|
|||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Help info that will be displayed.
|
||||
**/
|
||||
EFI_STRING_ID MainMenuHelpInfo[] = {
|
||||
STRING_TOKEN(STR_EDIT_HELP_TITLE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_LIST_TITLE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_DIV),
|
||||
STRING_TOKEN(STR_EDIT_HELP_GO_TO_LINE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_SAVE_FILE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_EXIT),
|
||||
STRING_TOKEN(STR_EDIT_HELP_SEARCH),
|
||||
STRING_TOKEN(STR_EDIT_HELP_SEARCH_REPLACE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_CUT_LINE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_PASTE_LINE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_OPEN_FILE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_FILE_TYPE),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_EXIT_HELP),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_EDIT_HELP_DIV),
|
||||
0
|
||||
};
|
||||
|
||||
MENU_ITEM_FUNCTION MainControlBasedMenuFunctions[] = {
|
||||
NULL,
|
||||
NULL, /* Ctrl - A */
|
||||
NULL, /* Ctrl - B */
|
||||
NULL, /* Ctrl - C */
|
||||
NULL, /* Ctrl - D */
|
||||
MainCommandDisplayHelp, /* Ctrl - E */
|
||||
MainCommandSearch, /* Ctrl - F */
|
||||
MainCommandGotoLine, /* Ctrl - G */
|
||||
NULL, /* Ctrl - H */
|
||||
NULL, /* Ctrl - I */
|
||||
NULL, /* Ctrl - J */
|
||||
MainCommandCutLine, /* Ctrl - K */
|
||||
NULL, /* Ctrl - L */
|
||||
NULL, /* Ctrl - M */
|
||||
NULL, /* Ctrl - N */
|
||||
MainCommandOpenFile, /* Ctrl - O */
|
||||
NULL, /* Ctrl - P */
|
||||
MainCommandExit, /* Ctrl - Q */
|
||||
MainCommandSearchReplace, /* Ctrl - R */
|
||||
MainCommandSaveFile, /* Ctrl - S */
|
||||
MainCommandSwitchFileType, /* Ctrl - T */
|
||||
MainCommandPasteLine, /* Ctrl - U */
|
||||
NULL, /* Ctrl - V */
|
||||
NULL, /* Ctrl - W */
|
||||
NULL, /* Ctrl - X */
|
||||
NULL, /* Ctrl - Y */
|
||||
NULL, /* Ctrl - Z */
|
||||
};
|
||||
|
||||
EDITOR_MENU_ITEM MainMenuItems[] = {
|
||||
{
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_GO_TO_LINE),
|
||||
|
@ -169,6 +265,11 @@ EDITOR_MENU_ITEM MainMenuItems[] = {
|
|||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_F9),
|
||||
MainCommandSwitchFileType
|
||||
},
|
||||
{
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_FILE_TYPE),
|
||||
STRING_TOKEN(STR_EDIT_LIBMENUBAR_F11),
|
||||
MainCommandSwitchFileType
|
||||
},
|
||||
|
||||
{
|
||||
0,
|
||||
|
@ -1248,28 +1349,43 @@ MainCommandSaveFile (
|
|||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
show help menu.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
MainCommandDisplayHelp (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
INTN CurrentLine=0;
|
||||
CHAR16 * InfoString;
|
||||
EFI_INPUT_KEY Key;
|
||||
|
||||
// print helpInfo
|
||||
for (CurrentLine = 0; 0 != MainMenuHelpInfo[CurrentLine]; CurrentLine++) {
|
||||
InfoString = HiiGetString(gShellDebug1HiiHandle, MainMenuHelpInfo[CurrentLine], NULL);
|
||||
ShellPrintEx (0,CurrentLine+1,L"%E%s%N",InfoString);
|
||||
}
|
||||
|
||||
// scan for ctrl+w
|
||||
do {
|
||||
gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
} while(SCAN_CONTROL_W != Key.UnicodeChar);
|
||||
|
||||
// update screen with file buffer's info
|
||||
FileBufferRestorePosition ();
|
||||
FileBufferNeedRefresh = TRUE;
|
||||
FileBufferOnlyLineNeedRefresh = FALSE;
|
||||
FileBufferRefresh ();
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_EDITOR_COLOR_ATTRIBUTES OriginalColors;
|
||||
INTN OriginalMode;
|
||||
|
||||
//
|
||||
// the first time editor launch
|
||||
//
|
||||
BOOLEAN EditorFirst;
|
||||
|
||||
//
|
||||
// it's time editor should exit
|
||||
//
|
||||
BOOLEAN EditorExit;
|
||||
|
||||
BOOLEAN EditorMouseAction;
|
||||
|
||||
extern EFI_EDITOR_FILE_BUFFER FileBuffer;
|
||||
|
||||
extern BOOLEAN FileBufferMouseNeedRefresh;
|
||||
|
||||
extern EFI_EDITOR_FILE_BUFFER FileBufferBackupVar;
|
||||
|
||||
EFI_EDITOR_GLOBAL_EDITOR MainEditor;
|
||||
|
||||
//
|
||||
// basic initialization for MainEditor
|
||||
|
@ -1387,6 +1503,7 @@ MainEditorInit (
|
|||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
Status = ControlHotKeyInit (MainControlBasedMenuFunctions);
|
||||
Status = MenuBarInit (MainMenuItems);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBEDITOR_MAINMENU), gShellDebug1HiiHandle);
|
||||
|
@ -1508,7 +1625,6 @@ MainEditorRefresh (
|
|||
}
|
||||
|
||||
if (EditorFirst) {
|
||||
MenuBarRefresh (MainEditor.ScreenSize.Row, MainEditor.ScreenSize.Column);
|
||||
FileBufferRestorePosition ();
|
||||
}
|
||||
|
||||
|
@ -1730,15 +1846,17 @@ MainEditorKeyInput (
|
|||
//
|
||||
// dispatch to different components' key handling function
|
||||
//
|
||||
if ((Key.ScanCode == SCAN_NULL) || ((Key.ScanCode >= SCAN_UP) && (Key.ScanCode <= SCAN_PAGE_DOWN))) {
|
||||
if (EFI_NOT_FOUND != MenuBarDispatchControlHotKey(&Key)) {
|
||||
Status = EFI_SUCCESS;
|
||||
} else if ((Key.ScanCode == SCAN_NULL) || ((Key.ScanCode >= SCAN_UP) && (Key.ScanCode <= SCAN_PAGE_DOWN))) {
|
||||
Status = FileBufferHandleInput (&Key);
|
||||
} else if ((Key.ScanCode >= SCAN_F1) && (Key.ScanCode <= SCAN_F12)) {
|
||||
Status = MenuBarDispatchFunctionKey (&Key);
|
||||
} else {
|
||||
StatusBarSetStatusString (L"Unknown Command");
|
||||
FileBufferMouseNeedRefresh = FALSE;
|
||||
FileBufferMouseNeedRefresh = FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (Status != EFI_SUCCESS && Status != EFI_OUT_OF_RESOURCES) {
|
||||
//
|
||||
// not already has some error status
|
||||
|
|
Binary file not shown.
|
@ -87,18 +87,18 @@ InputBarPrintInput (
|
|||
|
||||
gST->ConOut->EnableCursor (gST->ConOut, FALSE);
|
||||
|
||||
ShellPrintEx (((INT32)mPromptLen), ((INT32)LastRow) - 4, L"%s", Buffer);
|
||||
ShellPrintEx (((INT32)mPromptLen), ((INT32)LastRow) - 1, L"%s", Buffer);
|
||||
Size = StrLen (Buffer);
|
||||
|
||||
//
|
||||
// print " " after mPrompt
|
||||
//
|
||||
for (Index = Size; Index < Limit; Index++) {
|
||||
ShellPrintEx ((INT32)(mPromptLen + Size), ((INT32)LastRow) - 4, L" ");
|
||||
ShellPrintEx ((INT32)(mPromptLen + Size), ((INT32)LastRow) - 1, L" ");
|
||||
}
|
||||
|
||||
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, Size + mPromptLen, LastRow - 4);
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, Size + mPromptLen, LastRow - 1);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
@ -159,9 +159,9 @@ InputBarRefresh (
|
|||
//
|
||||
// clear input bar
|
||||
//
|
||||
EditorClearLine (LastRow - 3, LastColumn, LastRow);
|
||||
EditorClearLine (LastRow , LastColumn, LastRow);
|
||||
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, LastRow - 4);
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, LastRow - 1);
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBINPUTBAR_MAININPUTBAR), gShellDebug1HiiHandle, mPrompt);
|
||||
|
||||
//
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
#include "UefiShellDebug1CommandsLib.h"
|
||||
#include "EditStatusBar.h"
|
||||
|
||||
EDITOR_MENU_ITEM *MenuItems;
|
||||
EDITOR_MENU_ITEM *MenuItems;
|
||||
MENU_ITEM_FUNCTION *ControlBasedMenuFunctions;
|
||||
UINTN NumItems;
|
||||
|
||||
/**
|
||||
|
@ -32,7 +33,7 @@ MenuBarCleanup (
|
|||
}
|
||||
|
||||
/**
|
||||
Initializa the menu bar with the specified items.
|
||||
Initialize the menu bar with the specified items.
|
||||
|
||||
@param[in] Items The items to display and their functions.
|
||||
|
||||
|
@ -57,6 +58,22 @@ MenuBarInit (
|
|||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize the control hot-key with the specified items.
|
||||
|
||||
@param[in] Items The hot-key functions.
|
||||
|
||||
@retval EFI_SUCCESS The initialization was correct.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ControlHotKeyInit (
|
||||
IN MENU_ITEM_FUNCTION *Items
|
||||
)
|
||||
{
|
||||
ControlBasedMenuFunctions = Items;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
/**
|
||||
Refresh function for the menu bar.
|
||||
|
||||
|
@ -150,3 +167,30 @@ MenuBarDispatchFunctionKey (
|
|||
return (MenuItems[Index].Function ());
|
||||
}
|
||||
|
||||
/**
|
||||
Function to dispatch the correct function based on a control-based key (ctrl+o...)
|
||||
|
||||
@param[in] Key The pressed key.
|
||||
|
||||
@retval EFI_NOT_FOUND The key was not a valid control-based key
|
||||
(an error was sent to the status bar).
|
||||
@return EFI_SUCCESS.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MenuBarDispatchControlHotKey (
|
||||
IN CONST EFI_INPUT_KEY *Key
|
||||
)
|
||||
{
|
||||
|
||||
if ((SCAN_CONTROL_Z < Key->UnicodeChar)
|
||||
||(NULL == ControlBasedMenuFunctions[Key->UnicodeChar]))
|
||||
{
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ControlBasedMenuFunctions[Key->UnicodeChar]();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,20 @@
|
|||
#ifndef _LIB_MENU_BAR_H_
|
||||
#define _LIB_MENU_BAR_H_
|
||||
|
||||
#define SCAN_CONTROL_E 5
|
||||
#define SCAN_CONTROL_F 6
|
||||
#define SCAN_CONTROL_G 7
|
||||
#define SCAN_CONTROL_K 11
|
||||
#define SCAN_CONTROL_O 15
|
||||
#define SCAN_CONTROL_Q 17
|
||||
#define SCAN_CONTROL_R 18
|
||||
#define SCAN_CONTROL_S 19
|
||||
#define SCAN_CONTROL_T 20
|
||||
#define SCAN_CONTROL_U 21
|
||||
#define SCAN_CONTROL_W 23
|
||||
#define SCAN_CONTROL_Z 26
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*MENU_ITEM_FUNCTION) (
|
||||
|
@ -41,6 +55,19 @@ MenuBarInit (
|
|||
IN CONST EDITOR_MENU_ITEM *Items
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize the control hot-key with the specified items.
|
||||
|
||||
@param[in] Items The hot-key functions.
|
||||
|
||||
@retval EFI_SUCCESS The initialization was correct.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ControlHotKeyInit (
|
||||
IN MENU_ITEM_FUNCTION *Items
|
||||
);
|
||||
|
||||
/**
|
||||
Cleanup function for a menu bar. frees all allocated memory.
|
||||
**/
|
||||
|
@ -80,4 +107,19 @@ MenuBarDispatchFunctionKey (
|
|||
IN CONST EFI_INPUT_KEY *Key
|
||||
);
|
||||
|
||||
/**
|
||||
Function to dispatch the correct function based on a control-based key (ctrl+o...)
|
||||
|
||||
@param[in] Key The pressed key.
|
||||
|
||||
@retval EFI_NOT_FOUND The key was not a valid control-based key
|
||||
(an error was sent to the status bar).
|
||||
@return EFI_SUCCESS.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MenuBarDispatchControlHotKey (
|
||||
IN CONST EFI_INPUT_KEY *Key
|
||||
);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -120,7 +120,7 @@ StatusBarRefresh (
|
|||
//
|
||||
// clear status bar
|
||||
//
|
||||
EditorClearLine (LastRow - 3, LastCol, LastRow);
|
||||
EditorClearLine (LastRow, LastCol, LastRow);
|
||||
|
||||
//
|
||||
// print row, column fields
|
||||
|
@ -128,8 +128,8 @@ StatusBarRefresh (
|
|||
if (FileRow != (UINTN)(-1) && FileCol != (UINTN)(-1)) {
|
||||
ShellPrintEx (
|
||||
0,
|
||||
(INT32)(LastRow) - 4,
|
||||
L" Row: %d Col: %d %s",
|
||||
(INT32)(LastRow) - 1,
|
||||
L" %d,%d %s",
|
||||
FileRow,
|
||||
FileCol,
|
||||
StatusString
|
||||
|
@ -137,7 +137,7 @@ StatusBarRefresh (
|
|||
} else {
|
||||
ShellPrintEx (
|
||||
0,
|
||||
(INT32)(LastRow) - 4,
|
||||
(INT32)(LastRow) - 1,
|
||||
L" %s",
|
||||
StatusString
|
||||
);
|
||||
|
@ -147,9 +147,9 @@ StatusBarRefresh (
|
|||
// print insert mode field
|
||||
//
|
||||
if (InsertMode) {
|
||||
ShellPrintEx ((INT32)(LastCol) - 10, (INT32)(LastRow) - 4, L"|%s|", L"INS");
|
||||
ShellPrintEx ((INT32)(LastCol) - 21, (INT32)(LastRow) - 1, L"|%s| Help: Ctrl-E", L"INS");
|
||||
} else {
|
||||
ShellPrintEx ((INT32)(LastCol) - 10, (INT32)(LastRow) - 4, L"|%s|", L"OVR");
|
||||
ShellPrintEx ((INT32)(LastCol) - 21, (INT32)(LastRow) - 1, L"|%s| Help: Ctrl-E", L"OVR");
|
||||
}
|
||||
//
|
||||
// restore the old screen attributes
|
||||
|
|
|
@ -832,7 +832,7 @@ HBufferImageRefresh (
|
|||
//
|
||||
FStartRow = HBufferImage.LowVisibleRow;
|
||||
StartRow = 2;
|
||||
EndRow = (HMainEditor.ScreenSize.Row - 4);
|
||||
EndRow = (HMainEditor.ScreenSize.Row - 1);
|
||||
}
|
||||
//
|
||||
// no line
|
||||
|
@ -1404,7 +1404,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 +1712,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
|
||||
|
@ -1764,8 +1764,8 @@ HBufferImagePageUp (
|
|||
//
|
||||
// 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
|
||||
|
@ -2392,12 +2392,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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -65,6 +65,71 @@ HEFI_EDITOR_GLOBAL_EDITOR HMainEditorConst = {
|
|||
1
|
||||
};
|
||||
|
||||
/**
|
||||
Help info that will be displayed.
|
||||
**/
|
||||
EFI_STRING_ID HexMainMenuHelpInfo[] = {
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_TITLE),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_LIST_TITLE),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_DIV),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_GO_TO_OFFSET),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_SAVE_BUFFER),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_EXIT),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_SELECT_START),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_SELECT_END),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_CUT),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_PASTE),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_OPEN_FILE),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_OPEN_DISK),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_OPEN_MEMORY),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_EXIT_HELP),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_BLANK),
|
||||
STRING_TOKEN(STR_HEXEDIT_HELP_DIV),
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
show help menu.
|
||||
|
||||
@retval EFI_SUCCESS The operation was successful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
HMainCommandDisplayHelp (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
INTN CurrentLine=0;
|
||||
CHAR16 * InfoString;
|
||||
EFI_INPUT_KEY Key;
|
||||
|
||||
// print helpInfo
|
||||
for (CurrentLine = 0; 0 != HexMainMenuHelpInfo[CurrentLine]; CurrentLine++) {
|
||||
InfoString = HiiGetString(gShellDebug1HiiHandle, HexMainMenuHelpInfo[CurrentLine]
|
||||
, NULL);
|
||||
ShellPrintEx (0,CurrentLine+1,L"%E%s%N",InfoString);
|
||||
}
|
||||
|
||||
// scan for ctrl+w
|
||||
do {
|
||||
gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
} while(SCAN_CONTROL_W != Key.UnicodeChar);
|
||||
|
||||
// update screen with buffer's info
|
||||
HBufferImageNeedRefresh = TRUE;
|
||||
HBufferImageOnlyLineNeedRefresh = FALSE;
|
||||
HBufferImageRefresh ();
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Move cursor to specified lines.
|
||||
|
||||
|
@ -1439,6 +1504,36 @@ HMainCommandOpenMemory (
|
|||
|
||||
}
|
||||
|
||||
MENU_ITEM_FUNCTION HexMainControlBasedMenuFunctions[] = {
|
||||
NULL,
|
||||
NULL, /* Ctrl - A */
|
||||
NULL, /* Ctrl - B */
|
||||
NULL, /* Ctrl - C */
|
||||
NULL, /* Ctrl - D */
|
||||
HMainCommandDisplayHelp, /* Ctrl - E */
|
||||
NULL, /* Ctrl - F */
|
||||
NULL, /* Ctrl - G */
|
||||
NULL, /* Ctrl - H */
|
||||
NULL, /* Ctrl - I */
|
||||
NULL, /* Ctrl - J */
|
||||
NULL, /* Ctrl - K */
|
||||
NULL, /* Ctrl - L */
|
||||
NULL, /* Ctrl - M */
|
||||
NULL, /* Ctrl - N */
|
||||
NULL, /* Ctrl - O */
|
||||
NULL, /* Ctrl - P */
|
||||
NULL, /* Ctrl - Q */
|
||||
NULL, /* Ctrl - R */
|
||||
NULL, /* Ctrl - S */
|
||||
NULL, /* Ctrl - T */
|
||||
NULL, /* Ctrl - U */
|
||||
NULL, /* Ctrl - V */
|
||||
NULL, /* Ctrl - W */
|
||||
NULL, /* Ctrl - X */
|
||||
NULL, /* Ctrl - Y */
|
||||
NULL, /* Ctrl - Z */
|
||||
};
|
||||
|
||||
CONST EDITOR_MENU_ITEM HexEditorMenuItems[] = {
|
||||
{
|
||||
STRING_TOKEN(STR_HEXEDIT_LIBMENUBAR_GO_TO_OFFSET),
|
||||
|
@ -1598,6 +1693,11 @@ HMainEditorInit (
|
|||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
Status = ControlHotKeyInit (HexMainControlBasedMenuFunctions);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU), gShellDebug1HiiHandle);
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
Status = MenuBarInit (HexEditorMenuItems);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_MAINMENU), gShellDebug1HiiHandle);
|
||||
|
@ -1777,9 +1877,6 @@ HMainEditorRefresh (
|
|||
}
|
||||
|
||||
if (HEditorFirst) {
|
||||
MenuBarRefresh (
|
||||
HMainEditor.ScreenSize.Row,
|
||||
HMainEditor.ScreenSize.Column);
|
||||
HBufferImageRefresh ();
|
||||
}
|
||||
|
||||
|
@ -2138,8 +2235,9 @@ HMainEditorKeyInput (
|
|||
// clear previous status string
|
||||
//
|
||||
StatusBarSetRefresh();
|
||||
|
||||
if (Key.ScanCode == SCAN_NULL) {
|
||||
if (EFI_SUCCESS == MenuBarDispatchControlHotKey(&Key)) {
|
||||
Status = EFI_SUCCESS;
|
||||
} else if (Key.ScanCode == SCAN_NULL) {
|
||||
Status = HBufferImageHandleInput (&Key);
|
||||
} else if (((Key.ScanCode >= SCAN_UP) && (Key.ScanCode <= SCAN_PAGE_DOWN))) {
|
||||
Status = HBufferImageHandleInput (&Key);
|
||||
|
|
Loading…
Reference in New Issue