aboutsummaryrefslogtreecommitdiffstats
path: root/Library/UefiShellUfmCommandLib/tbi
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-12-08 20:27:47 +0300
committerJoursoir <chat@joursoir.net>2021-12-08 20:28:43 +0300
commitac500ff44d8dae723bfba9f1e4a9687ab16b3f03 (patch)
tree3c30c5500b0220aac666f3ab2a41b8091e297d7c /Library/UefiShellUfmCommandLib/tbi
parente5d7e68afd344769ca0d294c520af47b90fcfcfa (diff)
downloadufm-ac500ff44d8dae723bfba9f1e4a9687ab16b3f03.tar.gz
ufm-ac500ff44d8dae723bfba9f1e4a9687ab16b3f03.tar.bz2
ufm-ac500ff44d8dae723bfba9f1e4a9687ab16b3f03.zip
tbi/win: add the possibility to change line attributes
Diffstat (limited to 'Library/UefiShellUfmCommandLib/tbi')
-rw-r--r--Library/UefiShellUfmCommandLib/tbi/win.c30
-rw-r--r--Library/UefiShellUfmCommandLib/tbi/win.h26
2 files changed, 32 insertions, 24 deletions
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