aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/lxdialog
diff options
context:
space:
mode:
authorPetr Baudis <pasky@ucw.cz>2005-12-21 22:44:04 -0500
committer <sam@mars.ravnborg.org>2006-01-01 16:30:43 -0500
commit00213b17cec87d2cd4df75bcc79aea7a91d8532d (patch)
tree6947dba41f8b0e7fe7bccd41a4840d6de6a27079 /scripts/kconfig/lxdialog
parent352dd1df32e672be4cff71132eb9c06a257872fe (diff)
kconfig: Remove support for lxdialog --checklist
Remove support for lxdialog --checklist The checklist lxdialog functionality is not used by menuconfig (only the radiolist variant is used) and supporting it would significantly complicate the forthcoming liblxdialog API. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/lxdialog')
-rw-r--r--scripts/kconfig/lxdialog/checklist.c47
-rw-r--r--scripts/kconfig/lxdialog/dialog.h9
-rw-r--r--scripts/kconfig/lxdialog/lxdialog.c12
3 files changed, 17 insertions, 51 deletions
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c
index 3fb681fb9632..db07ae73e051 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -23,7 +23,7 @@
23 23
24#include "dialog.h" 24#include "dialog.h"
25 25
26static int list_width, check_x, item_x, checkflag; 26static int list_width, check_x, item_x;
27 27
28/* 28/*
29 * Print list item 29 * Print list item
@@ -41,10 +41,7 @@ static void print_item(WINDOW * win, const char *item, int status, int choice,
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 ? check_selected_attr : check_attr);
44 if (checkflag == FLAG_CHECK) 44 wprintw(win, "(%c)", status ? 'X' : ' ');
45 wprintw(win, "[%c]", status ? 'X' : ' ');
46 else
47 wprintw(win, "(%c)", status ? 'X' : ' ');
48 45
49 wattrset(win, selected ? tag_selected_attr : tag_attr); 46 wattrset(win, selected ? tag_selected_attr : tag_attr);
50 mvwaddch(win, choice, item_x, item[0]); 47 mvwaddch(win, choice, item_x, item[0]);
@@ -109,18 +106,16 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
109 106
110/* 107/*
111 * Display a dialog box with a list of options that can be turned on or off 108 * Display a dialog box with a list of options that can be turned on or off
112 * The `flag' parameter is used to select between radiolist and checklist. 109 * in the style of radiolist (only one option turned on at a time).
113 */ 110 */
114int dialog_checklist(const char *title, const char *prompt, int height, 111int dialog_checklist(const char *title, const char *prompt, int height,
115 int width, int list_height, int item_no, 112 int width, int list_height, int item_no,
116 const char *const *items, int flag) 113 const char *const *items)
117{ 114{
118 int i, x, y, box_x, box_y; 115 int i, x, y, box_x, box_y;
119 int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status; 116 int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status;
120 WINDOW *dialog, *list; 117 WINDOW *dialog, *list;
121 118
122 checkflag = flag;
123
124 /* Allocate space for storing item on/off status */ 119 /* Allocate space for storing item on/off status */
125 if ((status = malloc(sizeof(int) * item_no)) == NULL) { 120 if ((status = malloc(sizeof(int) * item_no)) == NULL) {
126 endwin(); 121 endwin();
@@ -303,34 +298,20 @@ int dialog_checklist(const char *title, const char *prompt, int height,
303 case ' ': 298 case ' ':
304 case '\n': 299 case '\n':
305 if (!button) { 300 if (!button) {
306 if (flag == FLAG_CHECK) { 301 if (!status[scroll + choice]) {
307 status[scroll + choice] = !status[scroll + choice]; 302 for (i = 0; i < item_no; i++)
308 wmove(list, choice, check_x); 303 status[i] = 0;
309 wattrset(list, check_selected_attr); 304 status[scroll + choice] = 1;
310 wprintw(list, "[%c]", status[scroll + choice] ? 'X' : ' '); 305 for (i = 0; i < max_choice; i++)
311 } else { 306 print_item(list, items[(scroll + i) * 3 + 1],
312 if (!status[scroll + choice]) { 307 status[scroll + i], i, i == choice);
313 for (i = 0; i < item_no; i++)
314 status[i] = 0;
315 status[scroll + choice] = 1;
316 for (i = 0; i < max_choice; i++)
317 print_item(list, items[(scroll + i) * 3 + 1],
318 status[scroll + i], i, i == choice);
319 }
320 } 308 }
321 wnoutrefresh(list); 309 wnoutrefresh(list);
322 wrefresh(dialog); 310 wrefresh(dialog);
323 311
324 for (i = 0; i < item_no; i++) { 312 for (i = 0; i < item_no; i++)
325 if (status[i]) { 313 if (status[i])
326 if (flag == FLAG_CHECK) { 314 fprintf(stderr, "%s", items[i * 3]);
327 fprintf(stderr, "\"%s\" ", items[i * 3]);
328 } else {
329 fprintf(stderr, "%s", items[i * 3]);
330 }
331
332 }
333 }
334 } else 315 } else
335 fprintf(stderr, "%s", items[(scroll + choice) * 3]); 316 fprintf(stderr, "%s", items[(scroll + choice) * 3]);
336 delwin(dialog); 317 delwin(dialog);
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index f882204cb3c2..af3cf716e215 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -160,7 +160,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
160 const char *const *items); 160 const char *const *items);
161int dialog_checklist(const char *title, const char *prompt, int height, 161int dialog_checklist(const char *title, const char *prompt, int height,
162 int width, int list_height, int item_no, 162 int width, int list_height, int item_no,
163 const char *const *items, int flag); 163 const char *const *items);
164extern char dialog_input_result[]; 164extern char dialog_input_result[];
165int dialog_inputbox(const char *title, const char *prompt, int height, 165int dialog_inputbox(const char *title, const char *prompt, int height,
166 int width, const char *init); 166 int width, const char *init);
@@ -175,10 +175,3 @@ int dialog_inputbox(const char *title, const char *prompt, int height,
175 * -- uppercase chars are used to invoke the button (M_EVENT + 'O') 175 * -- uppercase chars are used to invoke the button (M_EVENT + 'O')
176 */ 176 */
177#define M_EVENT (KEY_MAX+1) 177#define M_EVENT (KEY_MAX+1)
178
179/*
180 * The `flag' parameter in checklist is used to select between
181 * radiolist and checklist
182 */
183#define FLAG_CHECK 1
184#define FLAG_RADIO 0
diff --git a/scripts/kconfig/lxdialog/lxdialog.c b/scripts/kconfig/lxdialog/lxdialog.c
index 2c34ea1e0a41..79f6c5fb5cef 100644
--- a/scripts/kconfig/lxdialog/lxdialog.c
+++ b/scripts/kconfig/lxdialog/lxdialog.c
@@ -31,12 +31,11 @@ struct Mode {
31 jumperFn *jumper; 31 jumperFn *jumper;
32}; 32};
33 33
34jumperFn j_menu, j_checklist, j_radiolist, j_yesno, j_textbox, j_inputbox; 34jumperFn j_menu, j_radiolist, j_yesno, j_textbox, j_inputbox;
35jumperFn j_msgbox, j_infobox; 35jumperFn j_msgbox, j_infobox;
36 36
37static struct Mode modes[] = { 37static struct Mode modes[] = {
38 {"--menu", 9, 0, 3, j_menu}, 38 {"--menu", 9, 0, 3, j_menu},
39 {"--checklist", 9, 0, 3, j_checklist},
40 {"--radiolist", 9, 0, 3, j_radiolist}, 39 {"--radiolist", 9, 0, 3, j_radiolist},
41 {"--yesno", 5, 5, 1, j_yesno}, 40 {"--yesno", 5, 5, 1, j_yesno},
42 {"--textbox", 5, 5, 1, j_textbox}, 41 {"--textbox", 5, 5, 1, j_textbox},
@@ -151,7 +150,6 @@ static void Usage(const char *name)
151\nBox options:\ 150\nBox options:\
152\n\ 151\n\
153\n --menu <text> <height> <width> <menu height> <tag1> <item1>...\ 152\n --menu <text> <height> <width> <menu height> <tag1> <item1>...\
154\n --checklist <text> <height> <width> <list height> <tag1> <item1> <status1>...\
155\n --radiolist <text> <height> <width> <list height> <tag1> <item1> <status1>...\ 153\n --radiolist <text> <height> <width> <list height> <tag1> <item1> <status1>...\
156\n --textbox <file> <height> <width>\ 154\n --textbox <file> <height> <width>\
157\n --inputbox <text> <height> <width> [<init>]\ 155\n --inputbox <text> <height> <width> [<init>]\
@@ -170,16 +168,10 @@ int j_menu(const char *t, int ac, const char *const *av)
170 atoi(av[5]), av[6], (ac - 6) / 2, av + 7); 168 atoi(av[5]), av[6], (ac - 6) / 2, av + 7);
171} 169}
172 170
173int j_checklist(const char *t, int ac, const char *const *av)
174{
175 return dialog_checklist(t, av[2], atoi(av[3]), atoi(av[4]),
176 atoi(av[5]), (ac - 6) / 3, av + 6, FLAG_CHECK);
177}
178
179int j_radiolist(const char *t, int ac, const char *const *av) 171int j_radiolist(const char *t, int ac, const char *const *av)
180{ 172{
181 return dialog_checklist(t, av[2], atoi(av[3]), atoi(av[4]), 173 return dialog_checklist(t, av[2], atoi(av[3]), atoi(av[4]),
182 atoi(av[5]), (ac - 6) / 3, av + 6, FLAG_RADIO); 174 atoi(av[5]), (ac - 6) / 3, av + 6);
183} 175}
184 176
185int j_textbox(const char *t, int ac, const char *const *av) 177int j_textbox(const char *t, int ac, const char *const *av)