aboutsummaryrefslogtreecommitdiff
path: root/scripts/config/lxdialog
diff options
context:
space:
mode:
authorTim Riker <tim@rikers.org>2006-01-25 00:08:53 +0000
committerTim Riker <tim@rikers.org>2006-01-25 00:08:53 +0000
commitc1ef7bdd8d002ae0889efcf883d0e1b7faa938d4 (patch)
tree5f329b7d0c7f20ecced0dc7581a9ba6dc720d965 /scripts/config/lxdialog
parentf64ff682a3d58dbb627e760e6fe1ec21d9ccdf61 (diff)
downloadbusybox-w32-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.tar.gz
busybox-w32-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.tar.bz2
busybox-w32-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.zip
just whitespace
Diffstat (limited to 'scripts/config/lxdialog')
-rw-r--r--scripts/config/lxdialog/checklist.c28
-rw-r--r--scripts/config/lxdialog/dialog.h4
-rw-r--r--scripts/config/lxdialog/menubox.c146
-rw-r--r--scripts/config/lxdialog/msgbox.c2
-rw-r--r--scripts/config/lxdialog/textbox.c4
-rw-r--r--scripts/config/lxdialog/util.c18
6 files changed, 101 insertions, 101 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);
diff --git a/scripts/config/lxdialog/dialog.h b/scripts/config/lxdialog/dialog.h
index 7bab3ad0e..cb482a5ab 100644
--- a/scripts/config/lxdialog/dialog.h
+++ b/scripts/config/lxdialog/dialog.h
@@ -89,7 +89,7 @@
89#define ACS_DARROW 'v' 89#define ACS_DARROW 'v'
90#endif 90#endif
91 91
92/* 92/*
93 * Attribute names 93 * Attribute names
94 */ 94 */
95#define screen_attr attributes[0] 95#define screen_attr attributes[0]
@@ -165,7 +165,7 @@ int dialog_msgbox (const char *title, const char *prompt, int height,
165 int width, int pause); 165 int width, int pause);
166int dialog_textbox (const char *title, const char *file, int height, int width); 166int dialog_textbox (const char *title, const char *file, int height, int width);
167int dialog_menu (const char *title, const char *prompt, int height, int width, 167int dialog_menu (const char *title, const char *prompt, int height, int width,
168 int menu_height, const char *choice, int item_no, 168 int menu_height, const char *choice, int item_no,
169 struct dialog_list_item ** items); 169 struct dialog_list_item ** items);
170int dialog_checklist (const char *title, const char *prompt, int height, 170int dialog_checklist (const char *title, const char *prompt, int height,
171 int width, int list_height, int item_no, 171 int width, int list_height, int item_no,
diff --git a/scripts/config/lxdialog/menubox.c b/scripts/config/lxdialog/menubox.c
index 873dc587b..d0990c34e 100644
--- a/scripts/config/lxdialog/menubox.c
+++ b/scripts/config/lxdialog/menubox.c
@@ -26,7 +26,7 @@
26 * 26 *
27 * *) A bugfix for the Page-Down problem 27 * *) A bugfix for the Page-Down problem
28 * 28 *
29 * *) Formerly when I used Page Down and Page Up, the cursor would be set 29 * *) Formerly when I used Page Down and Page Up, the cursor would be set
30 * to the first position in the menu box. Now lxdialog is a bit 30 * to the first position in the menu box. Now lxdialog is a bit
31 * smarter and works more like other menu systems (just have a look at 31 * smarter and works more like other menu systems (just have a look at
32 * it). 32 * it).
@@ -78,8 +78,8 @@ print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey
78 wmove (win, choice, 0); 78 wmove (win, choice, 0);
79#if OLD_NCURSES 79#if OLD_NCURSES
80 { 80 {
81 int i; 81 int i;
82 for (i = 0; i < menu_width; i++) 82 for (i = 0; i < menu_width; i++)
83 waddch (win, ' '); 83 waddch (win, ' ');
84 } 84 }
85#else 85#else
@@ -88,8 +88,8 @@ print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey
88 wattrset (win, selected ? item_selected_attr : item_attr); 88 wattrset (win, selected ? item_selected_attr : item_attr);
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 ? tag_key_selected_attr : tag_key_attr);
92 mvwaddch(win, choice, item_x+j, menu_item[j]); 92 mvwaddch(win, choice, item_x+j, menu_item[j]);
93 } 93 }
94 if (selected) { 94 if (selected) {
95 wmove (win, choice, item_x+1); 95 wmove (win, choice, item_x+1);
@@ -225,7 +225,7 @@ dialog_menu (const char *title, const char *prompt, int height, int width,
225 225
226 /* 226 /*
227 * Find length of longest item in order to center menu. 227 * Find length of longest item in order to center menu.
228 * Set 'choice' to default item. 228 * Set 'choice' to default item.
229 */ 229 */
230 item_x = 0; 230 item_x = 0;
231 for (i = 0; i < item_no; i++) { 231 for (i = 0; i < item_no; i++) {
@@ -261,7 +261,7 @@ dialog_menu (const char *title, const char *prompt, int height, int width,
261 /* Print the menu */ 261 /* Print the menu */
262 for (i=0; i < max_choice; i++) { 262 for (i=0; i < max_choice; i++) {
263 print_item (menu, items[first_item + i]->name, i, i == choice, 263 print_item (menu, items[first_item + i]->name, i, i == choice,
264 (items[first_item + i]->tag[0] != ':')); 264 (items[first_item + i]->tag[0] != ':'));
265 } 265 }
266 266
267 wnoutrefresh (menu); 267 wnoutrefresh (menu);
@@ -281,107 +281,107 @@ dialog_menu (const char *title, const char *prompt, int height, int width,
281 if (strchr("ynmh", key)) 281 if (strchr("ynmh", key))
282 i = max_choice; 282 i = max_choice;
283 else { 283 else {
284 for (i = choice+1; i < max_choice; i++) { 284 for (i = choice+1; i < max_choice; i++) {
285 j = first_alpha(items[scroll + i]->name, "YyNnMmHh"); 285 j = first_alpha(items[scroll + i]->name, "YyNnMmHh");
286 if (key == tolower(items[scroll + i]->name[j])) 286 if (key == tolower(items[scroll + i]->name[j]))
287 break; 287 break;
288 } 288 }
289 if (i == max_choice) 289 if (i == max_choice)
290 for (i = 0; i < max_choice; i++) { 290 for (i = 0; i < max_choice; i++) {
291 j = first_alpha(items[scroll + i]->name, "YyNnMmHh"); 291 j = first_alpha(items[scroll + i]->name, "YyNnMmHh");
292 if (key == tolower(items[scroll + i]->name[j])) 292 if (key == tolower(items[scroll + i]->name[j]))
293 break; 293 break;
294 } 294 }
295 } 295 }
296 296
297 if (i < max_choice || 297 if (i < max_choice ||
298 key == KEY_UP || key == KEY_DOWN || 298 key == KEY_UP || key == KEY_DOWN ||
299 key == '-' || key == '+' || 299 key == '-' || key == '+' ||
300 key == KEY_PPAGE || key == KEY_NPAGE) { 300 key == KEY_PPAGE || key == KEY_NPAGE) {
301 301
302 print_item (menu, items[scroll + choice]->name, choice, FALSE, 302 print_item (menu, items[scroll + choice]->name, choice, FALSE,
303 (items[scroll + choice]->tag[0] != ':')); 303 (items[scroll + choice]->tag[0] != ':'));
304 304
305 if (key == KEY_UP || key == '-') { 305 if (key == KEY_UP || key == '-') {
306 if (choice < 2 && scroll) { 306 if (choice < 2 && scroll) {
307 /* Scroll menu down */ 307 /* Scroll menu down */
308 scrollok (menu, TRUE); 308 scrollok (menu, TRUE);
309 wscrl (menu, -1); 309 wscrl (menu, -1);
310 scrollok (menu, FALSE); 310 scrollok (menu, FALSE);
311 311
312 scroll--; 312 scroll--;
313 313
314 print_item (menu, items[scroll]->name, 0, FALSE, 314 print_item (menu, items[scroll]->name, 0, FALSE,
315 (items[scroll]->tag[0] != ':')); 315 (items[scroll]->tag[0] != ':'));
316 } else 316 } else
317 choice = MAX(choice - 1, 0); 317 choice = MAX(choice - 1, 0);
318 318
319 } else if (key == KEY_DOWN || key == '+') { 319 } else if (key == KEY_DOWN || key == '+') {
320 320
321 print_item (menu, items[scroll + choice]->name, choice, FALSE, 321 print_item (menu, items[scroll + choice]->name, choice, FALSE,
322 (items[scroll + choice]->tag[0] != ':')); 322 (items[scroll + choice]->tag[0] != ':'));
323 323
324 if ((choice > max_choice-3) && 324 if ((choice > max_choice-3) &&
325 (scroll + max_choice < item_no) 325 (scroll + max_choice < item_no)
326 ) { 326 ) {
327 /* Scroll menu up */ 327 /* Scroll menu up */
328 scrollok (menu, TRUE); 328 scrollok (menu, TRUE);
329 scroll (menu); 329 scroll (menu);
330 scrollok (menu, FALSE); 330 scrollok (menu, FALSE);
331 331
332 scroll++; 332 scroll++;
333 333
334 print_item (menu, items[scroll + max_choice - 1]->name, 334 print_item (menu, items[scroll + max_choice - 1]->name,
335 max_choice-1, FALSE, 335 max_choice-1, FALSE,
336 (items[scroll + max_choice - 1]->tag[0] != ':')); 336 (items[scroll + max_choice - 1]->tag[0] != ':'));
337 } else 337 } else
338 choice = MIN(choice+1, max_choice-1); 338 choice = MIN(choice+1, max_choice-1);
339 339
340 } else if (key == KEY_PPAGE) { 340 } else if (key == KEY_PPAGE) {
341 scrollok (menu, TRUE); 341 scrollok (menu, TRUE);
342 for (i=0; (i < max_choice); i++) { 342 for (i=0; (i < max_choice); i++) {
343 if (scroll > 0) { 343 if (scroll > 0) {
344 wscrl (menu, -1); 344 wscrl (menu, -1);
345 scroll--; 345 scroll--;
346 print_item (menu, items[scroll]->name, 0, FALSE, 346 print_item (menu, items[scroll]->name, 0, FALSE,
347 (items[scroll]->tag[0] != ':')); 347 (items[scroll]->tag[0] != ':'));
348 } else { 348 } else {
349 if (choice > 0) 349 if (choice > 0)
350 choice--; 350 choice--;
351 } 351 }
352 } 352 }
353 scrollok (menu, FALSE); 353 scrollok (menu, FALSE);
354 354
355 } else if (key == KEY_NPAGE) { 355 } else if (key == KEY_NPAGE) {
356 for (i=0; (i < max_choice); i++) { 356 for (i=0; (i < max_choice); i++) {
357 if (scroll+max_choice < item_no) { 357 if (scroll+max_choice < item_no) {
358 scrollok (menu, TRUE); 358 scrollok (menu, TRUE);
359 scroll(menu); 359 scroll(menu);
360 scrollok (menu, FALSE); 360 scrollok (menu, FALSE);
361 scroll++; 361 scroll++;
362 print_item (menu, items[scroll + max_choice - 1]->name, 362 print_item (menu, items[scroll + max_choice - 1]->name,
363 max_choice-1, FALSE, 363 max_choice-1, FALSE,
364 (items[scroll + max_choice - 1]->tag[0] != ':')); 364 (items[scroll + max_choice - 1]->tag[0] != ':'));
365 } else { 365 } else {
366 if (choice+1 < max_choice) 366 if (choice+1 < max_choice)
367 choice++; 367 choice++;
368 } 368 }
369 } 369 }
370 370
371 } else 371 } else
372 choice = i; 372 choice = i;
373 373
374 print_item (menu, items[scroll + choice]->name, choice, TRUE, 374 print_item (menu, items[scroll + choice]->name, choice, TRUE,
375 (items[scroll + choice]->tag[0] != ':')); 375 (items[scroll + choice]->tag[0] != ':'));
376 376
377 print_arrows(dialog, item_no, scroll, 377 print_arrows(dialog, item_no, scroll,
378 box_y, box_x+item_x+1, menu_height); 378 box_y, box_x+item_x+1, menu_height);
379 379
380 wnoutrefresh (dialog); 380 wnoutrefresh (dialog);
381 wrefresh (menu); 381 wrefresh (menu);
382 382
383 continue; /* wait for another key press */ 383 continue; /* wait for another key press */
384 } 384 }
385 385
386 switch (key) { 386 switch (key) {
387 case KEY_LEFT: 387 case KEY_LEFT:
@@ -405,15 +405,15 @@ dialog_menu (const char *title, const char *prompt, int height, int width,
405 fclose(f); 405 fclose(f);
406 } 406 }
407 delwin (dialog); 407 delwin (dialog);
408 items[scroll + choice]->selected = 1; 408 items[scroll + choice]->selected = 1;
409 switch (key) { 409 switch (key) {
410 case 's': return 3; 410 case 's': return 3;
411 case 'y': return 3; 411 case 'y': return 3;
412 case 'n': return 4; 412 case 'n': return 4;
413 case 'm': return 5; 413 case 'm': return 5;
414 case ' ': return 6; 414 case ' ': return 6;
415 case '/': return 7; 415 case '/': return 7;
416 } 416 }
417 return 0; 417 return 0;
418 case 'h': 418 case 'h':
419 case '?': 419 case '?':
diff --git a/scripts/config/lxdialog/msgbox.c b/scripts/config/lxdialog/msgbox.c
index 93692e1fb..de0f32bf0 100644
--- a/scripts/config/lxdialog/msgbox.c
+++ b/scripts/config/lxdialog/msgbox.c
@@ -73,7 +73,7 @@ dialog_msgbox (const char *title, const char *prompt, int height, int width,
73 73
74 wrefresh (dialog); 74 wrefresh (dialog);
75 while (key != ESC && key != '\n' && key != ' ' && 75 while (key != ESC && key != '\n' && key != ' ' &&
76 key != 'O' && key != 'o' && key != 'X' && key != 'x') 76 key != 'O' && key != 'o' && key != 'X' && key != 'x')
77 key = wgetch (dialog); 77 key = wgetch (dialog);
78 } else { 78 } else {
79 key = '\n'; 79 key = '\n';
diff --git a/scripts/config/lxdialog/textbox.c b/scripts/config/lxdialog/textbox.c
index a5a460b5c..b75e12a3e 100644
--- a/scripts/config/lxdialog/textbox.c
+++ b/scripts/config/lxdialog/textbox.c
@@ -472,8 +472,8 @@ print_line (WINDOW * win, int row, int width)
472 /* Clear 'residue' of previous line */ 472 /* Clear 'residue' of previous line */
473#if OLD_NCURSES 473#if OLD_NCURSES
474 { 474 {
475 int i; 475 int i;
476 for (i = 0; i < width - x; i++) 476 for (i = 0; i < width - x; i++)
477 waddch (win, ' '); 477 waddch (win, ' ');
478 } 478 }
479#else 479#else
diff --git a/scripts/config/lxdialog/util.c b/scripts/config/lxdialog/util.c
index 6f83951b9..47afa5e6a 100644
--- a/scripts/config/lxdialog/util.c
+++ b/scripts/config/lxdialog/util.c
@@ -29,7 +29,7 @@ const char *backtitle = NULL;
29 29
30const char *dialog_result; 30const char *dialog_result;
31 31
32/* 32/*
33 * Attribute values, default is for mono display 33 * Attribute values, default is for mono display
34 */ 34 */
35chtype attributes[] = 35chtype attributes[] =
@@ -127,13 +127,13 @@ void dialog_clear (void)
127 attr_clear (stdscr, LINES, COLS, screen_attr); 127 attr_clear (stdscr, LINES, COLS, screen_attr);
128 /* Display background title if it exists ... - SLH */ 128 /* Display background title if it exists ... - SLH */
129 if (backtitle != NULL) { 129 if (backtitle != NULL) {
130 int i; 130 int i;
131 131
132 wattrset (stdscr, screen_attr); 132 wattrset (stdscr, screen_attr);
133 mvwaddstr (stdscr, 0, 1, (char *)backtitle); 133 mvwaddstr (stdscr, 0, 1, (char *)backtitle);
134 wmove (stdscr, 1, 1); 134 wmove (stdscr, 1, 1);
135 for (i = 1; i < COLS - 1; i++) 135 for (i = 1; i < COLS - 1; i++)
136 waddch (stdscr, ACS_HLINE); 136 waddch (stdscr, ACS_HLINE);
137 } 137 }
138 wnoutrefresh (stdscr); 138 wnoutrefresh (stdscr);
139} 139}
@@ -204,7 +204,7 @@ print_autowrap (WINDOW * win, const char *prompt, int width, int y, int x)
204 strcpy (tempstr, prompt); 204 strcpy (tempstr, prompt);
205 205
206 prompt_len = strlen(tempstr); 206 prompt_len = strlen(tempstr);
207 207
208 /* 208 /*
209 * Remove newlines 209 * Remove newlines
210 */ 210 */
@@ -350,7 +350,7 @@ first_alpha(const char *string, const char *exempt)
350 if (strchr("<[(", c)) ++in_paren; 350 if (strchr("<[(", c)) ++in_paren;
351 if (strchr(">])", c) && in_paren > 0) --in_paren; 351 if (strchr(">])", c) && in_paren > 0) --in_paren;
352 352
353 if ((! in_paren) && isalpha(c) && 353 if ((! in_paren) && isalpha(c) &&
354 strchr(exempt, c) == 0) 354 strchr(exempt, c) == 0)
355 return i; 355 return i;
356 } 356 }