aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/lxdialog/checklist.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/checklist.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/checklist.c')
-rw-r--r--scripts/kconfig/lxdialog/checklist.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c
index 79886413b6d5..b90e888a2bc0 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -34,18 +34,19 @@ static void print_item(WINDOW * win, const char *item, int status, int choice,
34 int i; 34 int i;
35 35
36 /* Clear 'residue' of last item */ 36 /* Clear 'residue' of last item */
37 wattrset(win, menubox_attr); 37 wattrset(win, dlg.menubox.atr);
38 wmove(win, choice, 0); 38 wmove(win, choice, 0);
39 for (i = 0; i < list_width; i++) 39 for (i = 0; i < list_width; i++)
40 waddch(win, ' '); 40 waddch(win, ' ');
41 41
42 wmove(win, choice, check_x); 42 wmove(win, choice, check_x);
43 wattrset(win, selected ? check_selected_attr : check_attr); 43 wattrset(win, selected ? dlg.check_selected.atr
44 : dlg.check.atr);
44 wprintw(win, "(%c)", status ? 'X' : ' '); 45 wprintw(win, "(%c)", status ? 'X' : ' ');
45 46
46 wattrset(win, selected ? tag_selected_attr : tag_attr); 47 wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr);
47 mvwaddch(win, choice, item_x, item[0]); 48 mvwaddch(win, choice, item_x, item[0]);
48 wattrset(win, selected ? item_selected_attr : item_attr); 49 wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
49 waddstr(win, (char *)item + 1); 50 waddstr(win, (char *)item + 1);
50 if (selected) { 51 if (selected) {
51 wmove(win, choice, check_x + 1); 52 wmove(win, choice, check_x + 1);
@@ -62,11 +63,11 @@ static void print_arrows(WINDOW * win, int choice, int item_no, int scroll,
62 wmove(win, y, x); 63 wmove(win, y, x);
63 64
64 if (scroll > 0) { 65 if (scroll > 0) {
65 wattrset(win, uarrow_attr); 66 wattrset(win, dlg.uarrow.atr);
66 waddch(win, ACS_UARROW); 67 waddch(win, ACS_UARROW);
67 waddstr(win, "(-)"); 68 waddstr(win, "(-)");
68 } else { 69 } else {
69 wattrset(win, menubox_attr); 70 wattrset(win, dlg.menubox.atr);
70 waddch(win, ACS_HLINE); 71 waddch(win, ACS_HLINE);
71 waddch(win, ACS_HLINE); 72 waddch(win, ACS_HLINE);
72 waddch(win, ACS_HLINE); 73 waddch(win, ACS_HLINE);
@@ -77,11 +78,11 @@ static void print_arrows(WINDOW * win, int choice, int item_no, int scroll,
77 wmove(win, y, x); 78 wmove(win, y, x);
78 79
79 if ((height < item_no) && (scroll + choice < item_no - 1)) { 80 if ((height < item_no) && (scroll + choice < item_no - 1)) {
80 wattrset(win, darrow_attr); 81 wattrset(win, dlg.darrow.atr);
81 waddch(win, ACS_DARROW); 82 waddch(win, ACS_DARROW);
82 waddstr(win, "(+)"); 83 waddstr(win, "(+)");
83 } else { 84 } else {
84 wattrset(win, menubox_border_attr); 85 wattrset(win, dlg.menubox_border.atr);
85 waddch(win, ACS_HLINE); 86 waddch(win, ACS_HLINE);
86 waddch(win, ACS_HLINE); 87 waddch(win, ACS_HLINE);
87 waddch(win, ACS_HLINE); 88 waddch(win, ACS_HLINE);
@@ -145,17 +146,18 @@ int dialog_checklist(const char *title, const char *prompt, int height,
145 dialog = newwin(height, width, y, x); 146 dialog = newwin(height, width, y, x);
146 keypad(dialog, TRUE); 147 keypad(dialog, TRUE);
147 148
148 draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); 149 draw_box(dialog, 0, 0, height, width,
149 wattrset(dialog, border_attr); 150 dlg.dialog.atr, dlg.border.atr);
151 wattrset(dialog, dlg.border.atr);
150 mvwaddch(dialog, height - 3, 0, ACS_LTEE); 152 mvwaddch(dialog, height - 3, 0, ACS_LTEE);
151 for (i = 0; i < width - 2; i++) 153 for (i = 0; i < width - 2; i++)
152 waddch(dialog, ACS_HLINE); 154 waddch(dialog, ACS_HLINE);
153 wattrset(dialog, dialog_attr); 155 wattrset(dialog, dlg.dialog.atr);
154 waddch(dialog, ACS_RTEE); 156 waddch(dialog, ACS_RTEE);
155 157
156 print_title(dialog, title, width); 158 print_title(dialog, title, width);
157 159
158 wattrset(dialog, dialog_attr); 160 wattrset(dialog, dlg.dialog.atr);
159 print_autowrap(dialog, prompt, width - 2, 1, 3); 161 print_autowrap(dialog, prompt, width - 2, 1, 3);
160 162
161 list_width = width - 6; 163 list_width = width - 6;
@@ -170,7 +172,7 @@ int dialog_checklist(const char *title, const char *prompt, int height,
170 172
171 /* draw a box around the list items */ 173 /* draw a box around the list items */
172 draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2, 174 draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2,
173 menubox_border_attr, menubox_attr); 175 dlg.menubox_border.atr, dlg.menubox.atr);
174 176
175 /* Find length of longest item in order to center checklist */ 177 /* Find length of longest item in order to center checklist */
176 check_x = 0; 178 check_x = 0;