From 547e80784f8a4ff5fc558870121cb7da591891fb Mon Sep 17 00:00:00 2001 From: Joursoir Date: Wed, 1 Dec 2021 19:55:57 +0300 Subject: implement shortcuts and some actions --- Library/UefiShellUfmCommandLib/actions.c | 55 ++++++++++++++++++++++++++++++++ Library/UefiShellUfmCommandLib/actions.h | 28 ++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 Library/UefiShellUfmCommandLib/actions.c create mode 100644 Library/UefiShellUfmCommandLib/actions.h (limited to 'Library') diff --git a/Library/UefiShellUfmCommandLib/actions.c b/Library/UefiShellUfmCommandLib/actions.c new file mode 100644 index 0000000..8c75c67 --- /dev/null +++ b/Library/UefiShellUfmCommandLib/actions.c @@ -0,0 +1,55 @@ +#include +#include +#include +#include + +#include "dir.h" +#include "fs.h" + +#include "menu-bar.h" +#include "command-bar.h" +#include "panel.h" +#include "filemanager.h" +#include "actions.h" + +BOOLEAN jump_up(VOID) +{ + panel_move_cursor(fm_ctx.curpanel, fm_ctx.curpanel->curline - 1); + return TRUE; +} + +BOOLEAN jump_down(VOID) +{ + panel_move_cursor(fm_ctx.curpanel, fm_ctx.curpanel->curline + 1); + return TRUE; +} + +BOOLEAN change_panel(VOID) +{ + panel_set_active(fm_ctx.curpanel, FALSE); + fm_ctx.curpanel = (fm_ctx.curpanel == fm_ctx.left) ? fm_ctx.right : fm_ctx.left; + panel_set_active(fm_ctx.curpanel, TRUE); + return TRUE; +} + +BOOLEAN mark(VOID) +{ + panel_mark_file(fm_ctx.curpanel, fm_ctx.curpanel->curline); + return TRUE; +} + +BOOLEAN show_filesystems(VOID) +{ + return panel_cd_to(fm_ctx.curpanel, NULL); +} + +BOOLEAN do_nothing(VOID) +{ + return TRUE; +} + +BOOLEAN quit(VOID) +{ + fm_ctx.flag_run = FALSE; + return TRUE; +} diff --git a/Library/UefiShellUfmCommandLib/actions.h b/Library/UefiShellUfmCommandLib/actions.h new file mode 100644 index 0000000..4a6b113 --- /dev/null +++ b/Library/UefiShellUfmCommandLib/actions.h @@ -0,0 +1,28 @@ +#ifndef UFM_ACTIONS_H +#define UFM_ACTIONS_H + +#include + +enum ACTION_TYPE { + ACTION_ROUTINE = 0, + ACTION_CMD, + ACTION_LAST +}; + +struct shortcut { + enum ACTION_TYPE type; + EFI_INPUT_KEY key; + BOOLEAN (*action)(VOID); + CHAR16 *button_name; + CHAR16 *cmd_name; +}; + +BOOLEAN jump_up(VOID); +BOOLEAN jump_down(VOID); +BOOLEAN change_panel(VOID); +BOOLEAN mark(VOID); +BOOLEAN show_filesystems(VOID); +BOOLEAN do_nothing(VOID); +BOOLEAN quit(VOID); + +#endif /* UFM_ACTIONS_H */ -- cgit v1.2.3-18-g5258