aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/lxdialog/menubox.c
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2006-07-24 15:40:46 -0400
committerSam Ravnborg <sam@neptun.ravnborg.org>2006-09-30 05:19:19 -0400
commit98e5a1579e7d34fe3803240750a1c48efcd9cb15 (patch)
tree433f6b354eb0bb6fa01f325237f9f4651bf5ac9f /scripts/kconfig/lxdialog/menubox.c
parentbf603625660b1742004bf86432ce3c210d14d4fd (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/menubox.c')
-rw-r--r--scripts/kconfig/lxdialog/menubox.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index bf8052f4fd4a..ff991db827bd 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -74,7 +74,7 @@ static void do_print_item(WINDOW * win, const char *item, int choice,
74 j = first_alpha(menu_item, "YyNnMmHh"); 74 j = first_alpha(menu_item, "YyNnMmHh");
75 75
76 /* Clear 'residue' of last item */ 76 /* Clear 'residue' of last item */
77 wattrset(win, menubox_attr); 77 wattrset(win, dlg.menubox.atr);
78 wmove(win, choice, 0); 78 wmove(win, choice, 0);
79#if OLD_NCURSES 79#if OLD_NCURSES
80 { 80 {
@@ -85,10 +85,11 @@ static void do_print_item(WINDOW * win, const char *item, int choice,
85#else 85#else
86 wclrtoeol(win); 86 wclrtoeol(win);
87#endif 87#endif
88 wattrset(win, selected ? item_selected_attr : item_attr); 88 wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
89 mvwaddstr(win, choice, item_x, menu_item); 89 mvwaddstr(win, choice, item_x, menu_item);
90 if (hotkey) { 90 if (hotkey) {
91 wattrset(win, selected ? tag_key_selected_attr : tag_key_attr); 91 wattrset(win, selected ? dlg.tag_key_selected.atr
92 : dlg.tag_key.atr);
92 mvwaddch(win, choice, item_x + j, menu_item[j]); 93 mvwaddch(win, choice, item_x + j, menu_item[j]);
93 } 94 }
94 if (selected) { 95 if (selected) {
@@ -117,11 +118,11 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,
117 wmove(win, y, x); 118 wmove(win, y, x);
118 119
119 if (scroll > 0) { 120 if (scroll > 0) {
120 wattrset(win, uarrow_attr); 121 wattrset(win, dlg.uarrow.atr);
121 waddch(win, ACS_UARROW); 122 waddch(win, ACS_UARROW);
122 waddstr(win, "(-)"); 123 waddstr(win, "(-)");
123 } else { 124 } else {
124 wattrset(win, menubox_attr); 125 wattrset(win, dlg.menubox.atr);
125 waddch(win, ACS_HLINE); 126 waddch(win, ACS_HLINE);
126 waddch(win, ACS_HLINE); 127 waddch(win, ACS_HLINE);
127 waddch(win, ACS_HLINE); 128 waddch(win, ACS_HLINE);
@@ -133,11 +134,11 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,
133 wrefresh(win); 134 wrefresh(win);
134 135
135 if ((height < item_no) && (scroll + height < item_no)) { 136 if ((height < item_no) && (scroll + height < item_no)) {
136 wattrset(win, darrow_attr); 137 wattrset(win, dlg.darrow.atr);
137 waddch(win, ACS_DARROW); 138 waddch(win, ACS_DARROW);
138 waddstr(win, "(+)"); 139 waddstr(win, "(+)");
139 } else { 140 } else {
140 wattrset(win, menubox_border_attr); 141 wattrset(win, dlg.menubox_border.atr);
141 waddch(win, ACS_HLINE); 142 waddch(win, ACS_HLINE);
142 waddch(win, ACS_HLINE); 143 waddch(win, ACS_HLINE);
143 waddch(win, ACS_HLINE); 144 waddch(win, ACS_HLINE);
@@ -199,18 +200,19 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
199 dialog = newwin(height, width, y, x); 200 dialog = newwin(height, width, y, x);
200 keypad(dialog, TRUE); 201 keypad(dialog, TRUE);
201 202
202 draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); 203 draw_box(dialog, 0, 0, height, width,
203 wattrset(dialog, border_attr); 204 dlg.dialog.atr, dlg.border.atr);
205 wattrset(dialog, dlg.border.atr);
204 mvwaddch(dialog, height - 3, 0, ACS_LTEE); 206 mvwaddch(dialog, height - 3, 0, ACS_LTEE);
205 for (i = 0; i < width - 2; i++) 207 for (i = 0; i < width - 2; i++)
206 waddch(dialog, ACS_HLINE); 208 waddch(dialog, ACS_HLINE);
207 wattrset(dialog, dialog_attr); 209 wattrset(dialog, dlg.dialog.atr);
208 wbkgdset(dialog, dialog_attr & A_COLOR); 210 wbkgdset(dialog, dlg.dialog.atr & A_COLOR);
209 waddch(dialog, ACS_RTEE); 211 waddch(dialog, ACS_RTEE);
210 212
211 print_title(dialog, title, width); 213 print_title(dialog, title, width);
212 214
213 wattrset(dialog, dialog_attr); 215 wattrset(dialog, dlg.dialog.atr);
214 print_autowrap(dialog, prompt, width - 2, 1, 3); 216 print_autowrap(dialog, prompt, width - 2, 1, 3);
215 217
216 menu_width = width - 6; 218 menu_width = width - 6;
@@ -224,7 +226,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
224 226
225 /* draw a box around the menu items */ 227 /* draw a box around the menu items */
226 draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2, 228 draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2,
227 menubox_border_attr, menubox_attr); 229 dlg.menubox_border.atr, dlg.menubox.atr);
228 230
229 item_x = (menu_width - 70) / 2; 231 item_x = (menu_width - 70) / 2;
230 232