aboutsummaryrefslogtreecommitdiffstats
path: root/Library/UefiShellUfmCommandLib
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-12-01 19:23:01 +0300
committerJoursoir <chat@joursoir.net>2021-12-01 19:23:01 +0300
commitdbe8bd817e2db2294976457b1c272b6025ae3b61 (patch)
tree10c884eb470f1ee09056ff55fd21237544c70002 /Library/UefiShellUfmCommandLib
parentc1e685fc2adb9240b8eb948936cd7a20df3b0823 (diff)
downloadufm-dbe8bd817e2db2294976457b1c272b6025ae3b61.tar.gz
ufm-dbe8bd817e2db2294976457b1c272b6025ae3b61.tar.bz2
ufm-dbe8bd817e2db2294976457b1c272b6025ae3b61.zip
panel: make panel_mark_file()
Diffstat (limited to 'Library/UefiShellUfmCommandLib')
-rw-r--r--Library/UefiShellUfmCommandLib/panel.c22
-rw-r--r--Library/UefiShellUfmCommandLib/panel.h10
2 files changed, 32 insertions, 0 deletions
diff --git a/Library/UefiShellUfmCommandLib/panel.c b/Library/UefiShellUfmCommandLib/panel.c
index 450d73b..6ee1939 100644
--- a/Library/UefiShellUfmCommandLib/panel.c
+++ b/Library/UefiShellUfmCommandLib/panel.c
@@ -335,3 +335,25 @@ BOOLEAN panel_cd_to(struct panel_ctx *p, CONST CHAR16 *path)
return TRUE;
}
+BOOLEAN panel_mark_file(struct panel_ctx *p, UINTN line)
+{
+ UINTN idx = line - 1;
+
+ if(!p->cwd) // we can mark only files
+ return FALSE;
+
+ if(p->dirs->marked[idx]) {
+ UNHIGHLIGHT_LINE_AS_MARK(p, line);
+ p->marked--;
+ }
+ else {
+ HIGHLIGHT_LINE_AS_MARK(p, line);
+ p->marked++;
+ }
+
+ p->dirs->marked[idx] = !p->dirs->marked[idx];
+ update_marked_info(p);
+ wrefresh(p->wlist);
+ return TRUE;
+}
+
diff --git a/Library/UefiShellUfmCommandLib/panel.h b/Library/UefiShellUfmCommandLib/panel.h
index 908d260..8fdb19f 100644
--- a/Library/UefiShellUfmCommandLib/panel.h
+++ b/Library/UefiShellUfmCommandLib/panel.h
@@ -70,4 +70,14 @@ BOOLEAN panel_move_cursor(struct panel_ctx *p, UINTN line);
*/
BOOLEAN panel_cd_to(struct panel_ctx *p, CONST CHAR16 *path);
+/*
+ * Marks the file as selected. Supports work only with files.
+ *
+ * p: the panel on which to operate
+ * line: the line coordinate (starts from 1)
+ *
+ * return: FALSE upon failure and TRUE upon successful completion
+*/
+BOOLEAN panel_mark_file(struct panel_ctx *p, UINTN line);
+
#endif /* UFM_PANEL_H */