aboutsummaryrefslogtreecommitdiff
path: root/scripts/config/lxdialog/checklist.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/config/lxdialog/checklist.c')
-rw-r--r--scripts/config/lxdialog/checklist.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/scripts/config/lxdialog/checklist.c b/scripts/config/lxdialog/checklist.c
index 71de4a191..7565b5db1 100644
--- a/scripts/config/lxdialog/checklist.c
+++ b/scripts/config/lxdialog/checklist.c
@@ -52,8 +52,8 @@ print_item (WINDOW * win, const char *item, int status,
52 wattrset (win, selected ? item_selected_attr : item_attr); 52 wattrset (win, selected ? item_selected_attr : item_attr);
53 waddstr (win, (char *)item+1); 53 waddstr (win, (char *)item+1);
54 if (selected) { 54 if (selected) {
55 wmove (win, choice, check_x+1); 55 wmove (win, choice, check_x+1);
56 wrefresh (win); 56 wrefresh (win);
57 } 57 }
58} 58}
59 59
@@ -120,7 +120,7 @@ int
120dialog_checklist (const char *title, const char *prompt, int height, int width, 120dialog_checklist (const char *title, const char *prompt, int height, int width,
121 int list_height, int item_no, struct dialog_list_item ** items, 121 int list_height, int item_no, struct dialog_list_item ** items,
122 int flag) 122 int flag)
123 123
124{ 124{
125 int i, x, y, box_x, box_y; 125 int i, x, y, box_x, box_y;
126 int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status; 126 int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status;
@@ -140,7 +140,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
140 for (i = 0; i < item_no; i++) { 140 for (i = 0; i < item_no; i++) {
141 status[i] = (items[i]->selected == 1); /* ON */ 141 status[i] = (items[i]->selected == 1); /* ON */
142 if ((!choice && status[i]) || items[i]->selected == 2) /* SELECTED */ 142 if ((!choice && status[i]) || items[i]->selected == 2) /* SELECTED */
143 choice = i + 1; 143 choice = i + 1;
144 } 144 }
145 if (choice) 145 if (choice)
146 choice--; 146 choice--;
@@ -197,7 +197,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
197 197
198 /* Find length of longest item in order to center checklist */ 198 /* Find length of longest item in order to center checklist */
199 check_x = 0; 199 check_x = 0;
200 for (i = 0; i < item_no; i++) 200 for (i = 0; i < item_no; i++)
201 check_x = MAX (check_x, + strlen (items[i]->name) + 4); 201 check_x = MAX (check_x, + strlen (items[i]->name) + 4);
202 202
203 check_x = (list_width - check_x) / 2; 203 check_x = (list_width - check_x) / 2;
@@ -226,12 +226,12 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
226 while (key != ESC) { 226 while (key != ESC) {
227 key = wgetch (dialog); 227 key = wgetch (dialog);
228 228
229 for (i = 0; i < max_choice; i++) 229 for (i = 0; i < max_choice; i++)
230 if (toupper(key) == toupper(items[scroll + i]->name[0])) 230 if (toupper(key) == toupper(items[scroll + i]->name[0]))
231 break; 231 break;
232 232
233 233
234 if ( i < max_choice || key == KEY_UP || key == KEY_DOWN || 234 if ( i < max_choice || key == KEY_UP || key == KEY_DOWN ||
235 key == '+' || key == '-' ) { 235 key == '+' || key == '-' ) {
236 if (key == KEY_UP || key == '-') { 236 if (key == KEY_UP || key == '-') {
237 if (!choice) { 237 if (!choice) {
@@ -251,7 +251,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
251 status[scroll], 0, TRUE); 251 status[scroll], 0, TRUE);
252 wnoutrefresh (list); 252 wnoutrefresh (list);
253 253
254 print_arrows(dialog, choice, item_no, scroll, 254 print_arrows(dialog, choice, item_no, scroll,
255 box_y, box_x + check_x + 5, list_height); 255 box_y, box_x + check_x + 5, list_height);
256 256
257 wrefresh (dialog); 257 wrefresh (dialog);
@@ -279,7 +279,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
279 max_choice - 1, TRUE); 279 max_choice - 1, TRUE);
280 wnoutrefresh (list); 280 wnoutrefresh (list);
281 281
282 print_arrows(dialog, choice, item_no, scroll, 282 print_arrows(dialog, choice, item_no, scroll,
283 box_y, box_x + check_x + 5, list_height); 283 box_y, box_x + check_x + 5, list_height);
284 284
285 wrefresh (dialog); 285 wrefresh (dialog);
@@ -342,11 +342,11 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
342 } 342 }
343 wnoutrefresh (list); 343 wnoutrefresh (list);
344 wrefresh (dialog); 344 wrefresh (dialog);
345 345
346 for (i = 0; i < item_no; i++) { 346 for (i = 0; i < item_no; i++) {
347 items[i]->selected = status[i]; 347 items[i]->selected = status[i];
348 } 348 }
349 } else { 349 } else {
350 for (i = 0; i < item_no; i++) 350 for (i = 0; i < item_no; i++)
351 items[i]->selected = 0; 351 items[i]->selected = 0;
352 items[scroll + choice]->selected = 1; 352 items[scroll + choice]->selected = 1;
@@ -364,7 +364,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
364 /* Now, update everything... */ 364 /* Now, update everything... */
365 doupdate (); 365 doupdate ();
366 } 366 }
367 367
368 368
369 delwin (dialog); 369 delwin (dialog);
370 free (status); 370 free (status);