aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/UefiShellUfmCommandLib/panel.c17
-rw-r--r--Library/UefiShellUfmCommandLib/tbi/win.c30
-rw-r--r--Library/UefiShellUfmCommandLib/tbi/win.h26
3 files changed, 38 insertions, 35 deletions
diff --git a/Library/UefiShellUfmCommandLib/panel.c b/Library/UefiShellUfmCommandLib/panel.c
index e06a051..986f1fb 100644
--- a/Library/UefiShellUfmCommandLib/panel.c
+++ b/Library/UefiShellUfmCommandLib/panel.c
@@ -126,7 +126,6 @@ STATIC VOID display_files(struct panel_ctx *p, UINTN start_index)
STATIC VOID highlight_line(struct panel_ctx *p, UINTN line, INT32 fg, INT32 bg)
{
- CHAR16 *str;
INT32 attr;
UINTN ui_line;
@@ -137,12 +136,8 @@ STATIC VOID highlight_line(struct panel_ctx *p, UINTN line, INT32 fg, INT32 bg)
if(bg < 0x0)
bg = ((attr & 0xF0) >> 4);
attr = EFI_TEXT_ATTR(fg, bg);
-
- wattrset(p->wlist, attr);
- str = p->wlist->text[ui_line];
- mvwprintf(p->wlist, 0, ui_line, str);
- wattroff(p->wlist);
+ whline(p->wlist, 0, ui_line, 0, attr, 0);
wrefresh(p->wlist);
}
@@ -155,7 +150,7 @@ STATIC VOID set_cwd(struct panel_ctx *p, CONST CHAR16 *path)
if(path)
StrnCatGrow(&p->cwd, NULL, path, 0);
- mvwhline(p->wcwd, 0, 0, BOXDRAW_HORIZONTAL, p->wcwd->width);
+ whline(p->wcwd, 0, 0, BOXDRAW_HORIZONTAL, p->wcwd->cur_attr, p->wcwd->width);
wattrset(p->wcwd, EFI_TEXT_ATTR(EFI_WHITE, EFI_BLACK));
mvwprintf(p->wcwd, 0, 0, L" %s ", p->cwd ? p->cwd : L" ");
wattroff(p->wcwd);
@@ -180,7 +175,7 @@ STATIC VOID update_file_info(struct panel_ctx *p)
STATIC VOID update_marked_info(struct panel_ctx *p)
{
- mvwhline(p->wmarked, 0, 0, BOXDRAW_HORIZONTAL, p->wmarked->width);
+ whline(p->wmarked, 0, 0, BOXDRAW_HORIZONTAL, p->wmarked->cur_attr, p->wmarked->width);
if(p->marked) {
wattrset(p->wmarked, EFI_TEXT_ATTR(EFI_WHITE, EFI_BLACK));
mvwprintf(p->wmarked, 0, 0, L" Files: %d ", p->marked);
@@ -214,9 +209,9 @@ struct panel_ctx *panel_alloc(struct screen *scr, CONST CHAR16 *path,
BOXDRAW_UP_RIGHT, BOXDRAW_UP_LEFT
);
mvwprintf(panel->wbg, 1 + ((name_cols - 4) / 2), 1, L"Name");
- mvwvline(panel->wbg, 1 + name_cols, 1, BOXDRAW_VERTICAL, 1);
+ wvline(panel->wbg, 1 + name_cols, 1, BOXDRAW_VERTICAL, panel->wbg->cur_attr, 1);
mvwprintf(panel->wbg, 1 + name_cols + 1 + ((SIZE_COLS - 4) / 2), 1, L"Size");
- mvwvline(panel->wbg, cols - 1 - MODIFYTIME_COLS - 1, 1, BOXDRAW_VERTICAL, 1);
+ wvline(panel->wbg, cols - 1 - MODIFYTIME_COLS - 1, 1, BOXDRAW_VERTICAL, panel->wbg->cur_attr, 1);
mvwprintf(panel->wbg, 1 + name_cols + 1 + SIZE_COLS + 1 + ((MODIFYTIME_COLS - 11) / 2), 1, L"Modify Time");
panel->wcwd = newwin(scr, cols - 4, 1, x + 2, y);
@@ -227,7 +222,7 @@ struct panel_ctx *panel_alloc(struct screen *scr, CONST CHAR16 *path,
if(!panel->wlist)
break;
- mvwhline(panel->wbg, 1, lines - 3, BOXDRAW_HORIZONTAL, cols - 2);
+ whline(panel->wbg, 1, lines - 3, BOXDRAW_HORIZONTAL, -1, cols - 2);
panel->wfname = newwin(scr, cols - 2, 1, x + 1, lines - 1);
if(!panel->wfname)
break;
diff --git a/Library/UefiShellUfmCommandLib/tbi/win.c b/Library/UefiShellUfmCommandLib/tbi/win.c
index 5b3dd81..bada79e 100644
--- a/Library/UefiShellUfmCommandLib/tbi/win.c
+++ b/Library/UefiShellUfmCommandLib/tbi/win.c
@@ -176,36 +176,42 @@ BOOLEAN wborder(struct window *w, CHAR16 ls, CHAR16 rs, CHAR16 ts,
return TRUE;
}
-BOOLEAN mvwhline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 n)
+BOOLEAN wvline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 attr, UINTN n)
{
UINTN i, length;
ASSERT(w != NULL);
CHECK_POSITION(w, x, y);
- length = w->width - x;
- if(length > n)
+ length = w->height - y;
+ if(n != 0 && length > n)
length = n;
- length += x;
- for(i = x; i < length; i++) {
- SET_WINDOW_CHAR2(w, i, y, ch);
+ length += y;
+ for(i = y; i < length; i++) {
+ if(ch != 0)
+ w->text[i][x] = ch;
+ if(attr != -1)
+ w->attr[i][x] = attr;
}
return TRUE;
}
-BOOLEAN mvwvline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 n)
+BOOLEAN whline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 attr, UINTN n)
{
UINTN i, length;
ASSERT(w != NULL);
CHECK_POSITION(w, x, y);
- length = w->height - y;
- if(length > n)
+ length = w->width - x;
+ if(n != 0 && length > n)
length = n;
- length += y;
- for(i = y; i < length; i++) {
- SET_WINDOW_CHAR2(w, x, i, ch);
+ length += x;
+ for(i = x; i < length; i++) {
+ if(ch != 0)
+ w->text[y][i] = ch;
+ if(attr != -1)
+ w->attr[y][i] = attr;
}
return TRUE;
}
diff --git a/Library/UefiShellUfmCommandLib/tbi/win.h b/Library/UefiShellUfmCommandLib/tbi/win.h
index 0dfe41b..a5aacce 100644
--- a/Library/UefiShellUfmCommandLib/tbi/win.h
+++ b/Library/UefiShellUfmCommandLib/tbi/win.h
@@ -126,34 +126,36 @@ BOOLEAN wborder(struct window *w, CHAR16 ls, CHAR16 rs, CHAR16 ts,
CHAR16 bs, CHAR16 tl, CHAR16 tr, CHAR16 bl, CHAR16 br);
/*
- * Moves to specified coordinates, draws a horizontal line using ch
- * starting at (x, y) in the window. The current cursor position is
- * not changed.
+ * Draws a vertical line using ch and attr starting at (x, y) in the window.
+ * The current cursor position is not changed.
*
* w: the window on which to operate
* x: the X(column) coordinate for the start of the line
* y: the Y(row) coordinate for the start of the line
- * ch: the character used to draw the line
- * n: the maximum number of chars in the line
+ * ch: the character used to draw the line. If 0, then chars won't changed
+ * attr: the attributes used to draw the line. If -1, then attrs won't changed
+ * n: the maximum number of chars to draw. if 0, then the number of chars to
+ the end of the line
*
* return: FALSE upon failure and TRUE upon successful completion
*/
-BOOLEAN mvwhline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 n);
+BOOLEAN wvline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 attr, UINTN n);
/*
- * Moves to specified coordinates, draws a vertical line using ch
- * starting at (x, y) in the window. The current cursor position is
- * not changed.
+ * Draws a horizontal line using ch and attr starting at (x, y) in the window.
+ * The current cursor position is not changed.
*
* w: the window on which to operate
* x: the X(column) coordinate for the start of the line
* y: the Y(row) coordinate for the start of the line
- * ch: the character used to draw the line
- * n: the maximum number of chars in the line
+ * ch: the character used to draw the line. If 0, then chars won't changed
+ * attr: the attributes used to draw the line. If -1, then attrs won't changed
+ * n: the maximum number of chars to draw. if 0, then the number of chars to
+ the end of the line
*
* return: FALSE upon failure and TRUE upon successful completion
*/
-BOOLEAN mvwvline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 n);
+BOOLEAN whline(struct window *w, INT32 x, INT32 y, CHAR16 ch, INT32 attr, UINTN n);
/*
* Prints formatted output on the cursor coordinates