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:
jcarsey
2011-07-20 20:10:45 +00:00
parent f7c8bd9f9d
commit 5a2beb745f
10 changed files with 363 additions and 61 deletions

View File

@ -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);