diff options
author | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-07-24 15:40:46 -0400 |
---|---|---|
committer | Sam Ravnborg <sam@neptun.ravnborg.org> | 2006-09-30 05:19:19 -0400 |
commit | 98e5a1579e7d34fe3803240750a1c48efcd9cb15 (patch) | |
tree | 433f6b354eb0bb6fa01f325237f9f4651bf5ac9f /scripts/kconfig/lxdialog/textbox.c | |
parent | bf603625660b1742004bf86432ce3c210d14d4fd (diff) |
kconfig/lxdialog: refactor color support
Clean up and refactor color support. All color support are now
in util.c including color definitions.
In the process introduced a global variable named 'dlg' which is
used all over to set color - thats the reason why all files are changed.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/lxdialog/textbox.c')
-rw-r--r-- | scripts/kconfig/lxdialog/textbox.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c index 77848bb8e07f..336793b03954 100644 --- a/scripts/kconfig/lxdialog/textbox.c +++ b/scripts/kconfig/lxdialog/textbox.c | |||
@@ -87,20 +87,21 @@ int dialog_textbox(const char *title, const char *file, int height, int width) | |||
87 | 87 | ||
88 | /* Create window for text region, used for scrolling text */ | 88 | /* Create window for text region, used for scrolling text */ |
89 | text = subwin(dialog, height - 4, width - 2, y + 1, x + 1); | 89 | text = subwin(dialog, height - 4, width - 2, y + 1, x + 1); |
90 | wattrset(text, dialog_attr); | 90 | wattrset(text, dlg.dialog.atr); |
91 | wbkgdset(text, dialog_attr & A_COLOR); | 91 | wbkgdset(text, dlg.dialog.atr & A_COLOR); |
92 | 92 | ||
93 | keypad(text, TRUE); | 93 | keypad(text, TRUE); |
94 | 94 | ||
95 | /* register the new window, along with its borders */ | 95 | /* register the new window, along with its borders */ |
96 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | 96 | draw_box(dialog, 0, 0, height, width, |
97 | dlg.dialog.atr, dlg.border.atr); | ||
97 | 98 | ||
98 | wattrset(dialog, border_attr); | 99 | wattrset(dialog, dlg.border.atr); |
99 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | 100 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); |
100 | for (i = 0; i < width - 2; i++) | 101 | for (i = 0; i < width - 2; i++) |
101 | waddch(dialog, ACS_HLINE); | 102 | waddch(dialog, ACS_HLINE); |
102 | wattrset(dialog, dialog_attr); | 103 | wattrset(dialog, dlg.dialog.atr); |
103 | wbkgdset(dialog, dialog_attr & A_COLOR); | 104 | wbkgdset(dialog, dlg.dialog.atr & A_COLOR); |
104 | waddch(dialog, ACS_RTEE); | 105 | waddch(dialog, ACS_RTEE); |
105 | 106 | ||
106 | print_title(dialog, title, width); | 107 | print_title(dialog, title, width); |
@@ -110,7 +111,7 @@ int dialog_textbox(const char *title, const char *file, int height, int width) | |||
110 | getyx(dialog, cur_y, cur_x); /* Save cursor position */ | 111 | getyx(dialog, cur_y, cur_x); /* Save cursor position */ |
111 | 112 | ||
112 | /* Print first page of text */ | 113 | /* Print first page of text */ |
113 | attr_clear(text, height - 4, width - 2, dialog_attr); | 114 | attr_clear(text, height - 4, width - 2, dlg.dialog.atr); |
114 | print_page(text, height - 4, width - 2); | 115 | print_page(text, height - 4, width - 2); |
115 | print_position(dialog, height, width); | 116 | print_position(dialog, height, width); |
116 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | 117 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ |
@@ -524,8 +525,8 @@ static void print_position(WINDOW * win, int height, int width) | |||
524 | fprintf(stderr, "\nError moving file pointer in print_position().\n"); | 525 | fprintf(stderr, "\nError moving file pointer in print_position().\n"); |
525 | exit(-1); | 526 | exit(-1); |
526 | } | 527 | } |
527 | wattrset(win, position_indicator_attr); | 528 | wattrset(win, dlg.position_indicator.atr); |
528 | wbkgdset(win, position_indicator_attr & A_COLOR); | 529 | wbkgdset(win, dlg.position_indicator.atr & A_COLOR); |
529 | percent = !file_size ? | 530 | percent = !file_size ? |
530 | 100 : ((fpos - bytes_read + page - buf) * 100) / file_size; | 531 | 100 : ((fpos - bytes_read + page - buf) * 100) / file_size; |
531 | wmove(win, height - 3, width - 9); | 532 | wmove(win, height - 3, width - 9); |