Mercurial > hg > toybox
annotate kconfig/lxdialog/checklist.c @ 1046:673fe8f927b0 draft
fix rm to handle "mkdir sub/sub && chmod 007 sub/sub && rm -rf sub".
Previous version didn't delete it, but exited without error. Neither was right.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 05 Sep 2013 04:19:37 -0500 |
parents | 4d21d59f3206 |
children |
rev | line source |
---|---|
10
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
1 /* |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
2 * checklist.c -- implements the checklist box |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
3 * |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
4 * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
5 * Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
6 * Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
7 * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
8 * |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
9 * This program is free software; you can redistribute it and/or |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
10 * modify it under the terms of the GNU General Public License |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
11 * as published by the Free Software Foundation; either version 2 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
12 * of the License, or (at your option) any later version. |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
13 * |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
14 * This program is distributed in the hope that it will be useful, |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
17 * GNU General Public License for more details. |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
18 * |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
19 * You should have received a copy of the GNU General Public License |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
20 * along with this program; if not, write to the Free Software |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
22 */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
23 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
24 #include "dialog.h" |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
25 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
26 static int list_width, check_x, item_x; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
27 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
28 /* |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
29 * Print list item |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
30 */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
31 static void print_item(WINDOW * win, int choice, int selected) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
32 { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
33 int i; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
34 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
35 /* Clear 'residue' of last item */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
36 wattrset(win, dlg.menubox.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
37 wmove(win, choice, 0); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
38 for (i = 0; i < list_width; i++) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
39 waddch(win, ' '); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
40 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
41 wmove(win, choice, check_x); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
42 wattrset(win, selected ? dlg.check_selected.atr |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
43 : dlg.check.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
44 wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' '); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
45 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
46 wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
47 mvwaddch(win, choice, item_x, item_str()[0]); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
48 wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
49 waddstr(win, (char *)item_str() + 1); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
50 if (selected) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
51 wmove(win, choice, check_x + 1); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
52 wrefresh(win); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
53 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
54 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
55 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
56 /* |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
57 * Print the scroll indicators. |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
58 */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
59 static void print_arrows(WINDOW * win, int choice, int item_no, int scroll, |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
60 int y, int x, int height) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
61 { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
62 wmove(win, y, x); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
63 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
64 if (scroll > 0) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
65 wattrset(win, dlg.uarrow.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
66 waddch(win, ACS_UARROW); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
67 waddstr(win, "(-)"); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
68 } else { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
69 wattrset(win, dlg.menubox.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
70 waddch(win, ACS_HLINE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
71 waddch(win, ACS_HLINE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
72 waddch(win, ACS_HLINE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
73 waddch(win, ACS_HLINE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
74 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
75 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
76 y = y + height + 1; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
77 wmove(win, y, x); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
78 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
79 if ((height < item_no) && (scroll + choice < item_no - 1)) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
80 wattrset(win, dlg.darrow.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
81 waddch(win, ACS_DARROW); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
82 waddstr(win, "(+)"); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
83 } else { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
84 wattrset(win, dlg.menubox_border.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
85 waddch(win, ACS_HLINE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
86 waddch(win, ACS_HLINE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
87 waddch(win, ACS_HLINE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
88 waddch(win, ACS_HLINE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
89 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
90 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
91 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
92 /* |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
93 * Display the termination buttons |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
94 */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
95 static void print_buttons(WINDOW * dialog, int height, int width, int selected) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
96 { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
97 int x = width / 2 - 11; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
98 int y = height - 2; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
99 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
100 print_button(dialog, "Select", y, x, selected == 0); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
101 print_button(dialog, " Help ", y, x + 14, selected == 1); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
102 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
103 wmove(dialog, y, x + 1 + 14 * selected); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
104 wrefresh(dialog); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
105 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
106 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
107 /* |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
108 * Display a dialog box with a list of options that can be turned on or off |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
109 * in the style of radiolist (only one option turned on at a time). |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
110 */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
111 int dialog_checklist(const char *title, const char *prompt, int height, |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
112 int width, int list_height) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
113 { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
114 int i, x, y, box_x, box_y; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
115 int key = 0, button = 0, choice = 0, scroll = 0, max_choice; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
116 WINDOW *dialog, *list; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
117 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
118 /* which item to highlight */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
119 item_foreach() { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
120 if (item_is_tag('X')) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
121 choice = item_n(); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
122 if (item_is_selected()) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
123 choice = item_n(); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
124 break; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
125 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
126 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
127 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
128 do_resize: |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
129 if (getmaxy(stdscr) < (height + 6)) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
130 return -ERRDISPLAYTOOSMALL; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
131 if (getmaxx(stdscr) < (width + 6)) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
132 return -ERRDISPLAYTOOSMALL; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
133 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
134 max_choice = MIN(list_height, item_count()); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
135 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
136 /* center dialog box on screen */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
137 x = (COLS - width) / 2; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
138 y = (LINES - height) / 2; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
139 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
140 draw_shadow(stdscr, y, x, height, width); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
141 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
142 dialog = newwin(height, width, y, x); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
143 keypad(dialog, TRUE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
144 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
145 draw_box(dialog, 0, 0, height, width, |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
146 dlg.dialog.atr, dlg.border.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
147 wattrset(dialog, dlg.border.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
148 mvwaddch(dialog, height - 3, 0, ACS_LTEE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
149 for (i = 0; i < width - 2; i++) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
150 waddch(dialog, ACS_HLINE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
151 wattrset(dialog, dlg.dialog.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
152 waddch(dialog, ACS_RTEE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
153 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
154 print_title(dialog, title, width); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
155 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
156 wattrset(dialog, dlg.dialog.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
157 print_autowrap(dialog, prompt, width - 2, 1, 3); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
158 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
159 list_width = width - 6; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
160 box_y = height - list_height - 5; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
161 box_x = (width - list_width) / 2 - 1; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
162 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
163 /* create new window for the list */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
164 list = subwin(dialog, list_height, list_width, y + box_y + 1, |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
165 x + box_x + 1); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
166 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
167 keypad(list, TRUE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
168 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
169 /* draw a box around the list items */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
170 draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2, |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
171 dlg.menubox_border.atr, dlg.menubox.atr); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
172 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
173 /* Find length of longest item in order to center checklist */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
174 check_x = 0; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
175 item_foreach() |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
176 check_x = MAX(check_x, strlen(item_str()) + 4); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
177 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
178 check_x = (list_width - check_x) / 2; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
179 item_x = check_x + 4; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
180 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
181 if (choice >= list_height) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
182 scroll = choice - list_height + 1; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
183 choice -= scroll; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
184 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
185 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
186 /* Print the list */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
187 for (i = 0; i < max_choice; i++) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
188 item_set(scroll + i); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
189 print_item(list, i, i == choice); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
190 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
191 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
192 print_arrows(dialog, choice, item_count(), scroll, |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
193 box_y, box_x + check_x + 5, list_height); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
194 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
195 print_buttons(dialog, height, width, 0); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
196 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
197 wnoutrefresh(dialog); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
198 wnoutrefresh(list); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
199 doupdate(); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
200 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
201 while (key != KEY_ESC) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
202 key = wgetch(dialog); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
203 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
204 for (i = 0; i < max_choice; i++) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
205 item_set(i + scroll); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
206 if (toupper(key) == toupper(item_str()[0])) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
207 break; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
208 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
209 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
210 if (i < max_choice || key == KEY_UP || key == KEY_DOWN || |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
211 key == '+' || key == '-') { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
212 if (key == KEY_UP || key == '-') { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
213 if (!choice) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
214 if (!scroll) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
215 continue; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
216 /* Scroll list down */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
217 if (list_height > 1) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
218 /* De-highlight current first item */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
219 item_set(scroll); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
220 print_item(list, 0, FALSE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
221 scrollok(list, TRUE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
222 wscrl(list, -1); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
223 scrollok(list, FALSE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
224 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
225 scroll--; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
226 item_set(scroll); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
227 print_item(list, 0, TRUE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
228 print_arrows(dialog, choice, item_count(), |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
229 scroll, box_y, box_x + check_x + 5, list_height); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
230 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
231 wnoutrefresh(dialog); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
232 wrefresh(list); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
233 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
234 continue; /* wait for another key press */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
235 } else |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
236 i = choice - 1; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
237 } else if (key == KEY_DOWN || key == '+') { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
238 if (choice == max_choice - 1) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
239 if (scroll + choice >= item_count() - 1) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
240 continue; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
241 /* Scroll list up */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
242 if (list_height > 1) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
243 /* De-highlight current last item before scrolling up */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
244 item_set(scroll + max_choice - 1); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
245 print_item(list, |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
246 max_choice - 1, |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
247 FALSE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
248 scrollok(list, TRUE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
249 wscrl(list, 1); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
250 scrollok(list, FALSE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
251 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
252 scroll++; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
253 item_set(scroll + max_choice - 1); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
254 print_item(list, max_choice - 1, TRUE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
255 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
256 print_arrows(dialog, choice, item_count(), |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
257 scroll, box_y, box_x + check_x + 5, list_height); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
258 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
259 wnoutrefresh(dialog); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
260 wrefresh(list); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
261 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
262 continue; /* wait for another key press */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
263 } else |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
264 i = choice + 1; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
265 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
266 if (i != choice) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
267 /* De-highlight current item */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
268 item_set(scroll + choice); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
269 print_item(list, choice, FALSE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
270 /* Highlight new item */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
271 choice = i; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
272 item_set(scroll + choice); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
273 print_item(list, choice, TRUE); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
274 wnoutrefresh(dialog); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
275 wrefresh(list); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
276 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
277 continue; /* wait for another key press */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
278 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
279 switch (key) { |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
280 case 'H': |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
281 case 'h': |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
282 case '?': |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
283 button = 1; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
284 /* fall-through */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
285 case 'S': |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
286 case 's': |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
287 case ' ': |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
288 case '\n': |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
289 item_foreach() |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
290 item_set_selected(0); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
291 item_set(scroll + choice); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
292 item_set_selected(1); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
293 delwin(list); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
294 delwin(dialog); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
295 return button; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
296 case TAB: |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
297 case KEY_LEFT: |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
298 case KEY_RIGHT: |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
299 button = ((key == KEY_LEFT ? --button : ++button) < 0) |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
300 ? 1 : (button > 1 ? 0 : button); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
301 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
302 print_buttons(dialog, height, width, button); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
303 wrefresh(dialog); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
304 break; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
305 case 'X': |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
306 case 'x': |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
307 key = KEY_ESC; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
308 break; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
309 case KEY_ESC: |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
310 key = on_key_esc(dialog); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
311 break; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
312 case KEY_RESIZE: |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
313 delwin(list); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
314 delwin(dialog); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
315 on_key_resize(); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
316 goto do_resize; |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
317 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
318 |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
319 /* Now, update everything... */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
320 doupdate(); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
321 } |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
322 delwin(list); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
323 delwin(dialog); |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
324 return key; /* ESC pressed */ |
4d21d59f3206
Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff
changeset
|
325 } |