diff options
Diffstat (limited to 'scripts/config/lxdialog')
-rw-r--r-- | scripts/config/lxdialog/checklist.c | 28 | ||||
-rw-r--r-- | scripts/config/lxdialog/dialog.h | 4 | ||||
-rw-r--r-- | scripts/config/lxdialog/menubox.c | 146 | ||||
-rw-r--r-- | scripts/config/lxdialog/msgbox.c | 2 | ||||
-rw-r--r-- | scripts/config/lxdialog/textbox.c | 4 | ||||
-rw-r--r-- | scripts/config/lxdialog/util.c | 18 |
6 files changed, 101 insertions, 101 deletions
diff --git a/scripts/config/lxdialog/checklist.c b/scripts/config/lxdialog/checklist.c index 71de4a1..7565b5d 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, wattrset (win, selected ? item_selected_attr : item_attr); waddstr (win, (char *)item+1); if (selected) { - wmove (win, choice, check_x+1); - wrefresh (win); + wmove (win, choice, check_x+1); + wrefresh (win); } } @@ -120,7 +120,7 @@ int dialog_checklist (const char *title, const char *prompt, int height, int width, int list_height, int item_no, struct dialog_list_item ** items, int flag) - + { int i, x, y, box_x, box_y; 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, for (i = 0; i < item_no; i++) { status[i] = (items[i]->selected == 1); /* ON */ if ((!choice && status[i]) || items[i]->selected == 2) /* SELECTED */ - choice = i + 1; + choice = i + 1; } if (choice) choice--; @@ -197,7 +197,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, /* Find length of longest item in order to center checklist */ check_x = 0; - for (i = 0; i < item_no; i++) + for (i = 0; i < item_no; i++) check_x = MAX (check_x, + strlen (items[i]->name) + 4); check_x = (list_width - check_x) / 2; @@ -226,12 +226,12 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, while (key != ESC) { key = wgetch (dialog); - for (i = 0; i < max_choice; i++) - if (toupper(key) == toupper(items[scroll + i]->name[0])) - break; + for (i = 0; i < max_choice; i++) + if (toupper(key) == toupper(items[scroll + i]->name[0])) + break; - if ( i < max_choice || key == KEY_UP || key == KEY_DOWN || + if ( i < max_choice || key == KEY_UP || key == KEY_DOWN || key == '+' || key == '-' ) { if (key == KEY_UP || key == '-') { if (!choice) { @@ -251,7 +251,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, status[scroll], 0, TRUE); wnoutrefresh (list); - print_arrows(dialog, choice, item_no, scroll, + print_arrows(dialog, choice, item_no, scroll, box_y, box_x + check_x + 5, list_height); wrefresh (dialog); @@ -279,7 +279,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, max_choice - 1, TRUE); wnoutrefresh (list); - print_arrows(dialog, choice, item_no, scroll, + print_arrows(dialog, choice, item_no, scroll, box_y, box_x + check_x + 5, list_height); wrefresh (dialog); @@ -342,11 +342,11 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, } wnoutrefresh (list); wrefresh (dialog); - + for (i = 0; i < item_no; i++) { items[i]->selected = status[i]; } - } else { + } else { for (i = 0; i < item_no; i++) items[i]->selected = 0; items[scroll + choice]->selected = 1; @@ -364,7 +364,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, /* Now, update everything... */ doupdate (); } - + delwin (dialog); free (status); diff --git a/scripts/config/lxdialog/dialog.h b/scripts/config/lxdialog/dialog.h index 7bab3ad..cb482a5 100644 --- a/scripts/config/lxdialog/dialog.h +++ b/scripts/config/lxdialog/dialog.h @@ -89,7 +89,7 @@ #define ACS_DARROW 'v' #endif -/* +/* * Attribute names */ #define screen_attr attributes[0] @@ -165,7 +165,7 @@ int dialog_msgbox (const char *title, const char *prompt, int height, int width, int pause); int dialog_textbox (const char *title, const char *file, int height, int width); int dialog_menu (const char *title, const char *prompt, int height, int width, - int menu_height, const char *choice, int item_no, + int menu_height, const char *choice, int item_no, struct dialog_list_item ** items); int dialog_checklist (const char *title, const char *prompt, int height, int width, int list_height, int item_no, diff --git a/scripts/config/lxdialog/menubox.c b/scripts/config/lxdialog/menubox.c index 873dc58..d0990c3 100644 --- a/scripts/config/lxdialog/menubox.c +++ b/scripts/config/lxdialog/menubox.c @@ -26,7 +26,7 @@ * * *) A bugfix for the Page-Down problem * - * *) Formerly when I used Page Down and Page Up, the cursor would be set + * *) Formerly when I used Page Down and Page Up, the cursor would be set * to the first position in the menu box. Now lxdialog is a bit * smarter and works more like other menu systems (just have a look at * it). @@ -78,8 +78,8 @@ print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey wmove (win, choice, 0); #if OLD_NCURSES { - int i; - for (i = 0; i < menu_width; i++) + int i; + for (i = 0; i < menu_width; i++) waddch (win, ' '); } #else @@ -88,8 +88,8 @@ print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey wattrset (win, selected ? item_selected_attr : item_attr); mvwaddstr (win, choice, item_x, menu_item); if (hotkey) { - wattrset (win, selected ? tag_key_selected_attr : tag_key_attr); - mvwaddch(win, choice, item_x+j, menu_item[j]); + wattrset (win, selected ? tag_key_selected_attr : tag_key_attr); + mvwaddch(win, choice, item_x+j, menu_item[j]); } if (selected) { wmove (win, choice, item_x+1); @@ -225,7 +225,7 @@ dialog_menu (const char *title, const char *prompt, int height, int width, /* * Find length of longest item in order to center menu. - * Set 'choice' to default item. + * Set 'choice' to default item. */ item_x = 0; for (i = 0; i < item_no; i++) { @@ -261,7 +261,7 @@ dialog_menu (const char *title, const char *prompt, int height, int width, /* Print the menu */ for (i=0; i < max_choice; i++) { print_item (menu, items[first_item + i]->name, i, i == choice, - (items[first_item + i]->tag[0] != ':')); + (items[first_item + i]->tag[0] != ':')); } wnoutrefresh (menu); @@ -281,107 +281,107 @@ dialog_menu (const char *title, const char *prompt, int height, int width, if (strchr("ynmh", key)) i = max_choice; else { - for (i = choice+1; i < max_choice; i++) { + for (i = choice+1; i < max_choice; i++) { j = first_alpha(items[scroll + i]->name, "YyNnMmHh"); if (key == tolower(items[scroll + i]->name[j])) - break; + break; } if (i == max_choice) - for (i = 0; i < max_choice; i++) { + for (i = 0; i < max_choice; i++) { j = first_alpha(items[scroll + i]->name, "YyNnMmHh"); if (key == tolower(items[scroll + i]->name[j])) - break; + break; } } - if (i < max_choice || - key == KEY_UP || key == KEY_DOWN || - key == '-' || key == '+' || - key == KEY_PPAGE || key == KEY_NPAGE) { + if (i < max_choice || + key == KEY_UP || key == KEY_DOWN || + key == '-' || key == '+' || + key == KEY_PPAGE || key == KEY_NPAGE) { - print_item (menu, items[scroll + choice]->name, choice, FALSE, - (items[scroll + choice]->tag[0] != ':')); + print_item (menu, items[scroll + choice]->name, choice, FALSE, + (items[scroll + choice]->tag[0] != ':')); if (key == KEY_UP || key == '-') { - if (choice < 2 && scroll) { + if (choice < 2 && scroll) { /* Scroll menu down */ - scrollok (menu, TRUE); - wscrl (menu, -1); - scrollok (menu, FALSE); + scrollok (menu, TRUE); + wscrl (menu, -1); + scrollok (menu, FALSE); - scroll--; + scroll--; - print_item (menu, items[scroll]->name, 0, FALSE, - (items[scroll]->tag[0] != ':')); + print_item (menu, items[scroll]->name, 0, FALSE, + (items[scroll]->tag[0] != ':')); } else choice = MAX(choice - 1, 0); } else if (key == KEY_DOWN || key == '+') { print_item (menu, items[scroll + choice]->name, choice, FALSE, - (items[scroll + choice]->tag[0] != ':')); + (items[scroll + choice]->tag[0] != ':')); - if ((choice > max_choice-3) && - (scroll + max_choice < item_no) - ) { + if ((choice > max_choice-3) && + (scroll + max_choice < item_no) + ) { /* Scroll menu up */ scrollok (menu, TRUE); - scroll (menu); - scrollok (menu, FALSE); + scroll (menu); + scrollok (menu, FALSE); - scroll++; + scroll++; - print_item (menu, items[scroll + max_choice - 1]->name, - max_choice-1, FALSE, - (items[scroll + max_choice - 1]->tag[0] != ':')); - } else - choice = MIN(choice+1, max_choice-1); + print_item (menu, items[scroll + max_choice - 1]->name, + max_choice-1, FALSE, + (items[scroll + max_choice - 1]->tag[0] != ':')); + } else + choice = MIN(choice+1, max_choice-1); } else if (key == KEY_PPAGE) { scrollok (menu, TRUE); - for (i=0; (i < max_choice); i++) { - if (scroll > 0) { - wscrl (menu, -1); - scroll--; - print_item (menu, items[scroll]->name, 0, FALSE, - (items[scroll]->tag[0] != ':')); - } else { - if (choice > 0) - choice--; - } - } - scrollok (menu, FALSE); - - } else if (key == KEY_NPAGE) { - for (i=0; (i < max_choice); i++) { - if (scroll+max_choice < item_no) { + for (i=0; (i < max_choice); i++) { + if (scroll > 0) { + wscrl (menu, -1); + scroll--; + print_item (menu, items[scroll]->name, 0, FALSE, + (items[scroll]->tag[0] != ':')); + } else { + if (choice > 0) + choice--; + } + } + scrollok (menu, FALSE); + + } else if (key == KEY_NPAGE) { + for (i=0; (i < max_choice); i++) { + if (scroll+max_choice < item_no) { scrollok (menu, TRUE); scroll(menu); scrollok (menu, FALSE); - scroll++; - print_item (menu, items[scroll + max_choice - 1]->name, + scroll++; + print_item (menu, items[scroll + max_choice - 1]->name, max_choice-1, FALSE, (items[scroll + max_choice - 1]->tag[0] != ':')); } else { if (choice+1 < max_choice) choice++; } - } + } - } else - choice = i; + } else + choice = i; - print_item (menu, items[scroll + choice]->name, choice, TRUE, - (items[scroll + choice]->tag[0] != ':')); + print_item (menu, items[scroll + choice]->name, choice, TRUE, + (items[scroll + choice]->tag[0] != ':')); - print_arrows(dialog, item_no, scroll, - box_y, box_x+item_x+1, menu_height); + print_arrows(dialog, item_no, scroll, + box_y, box_x+item_x+1, menu_height); - wnoutrefresh (dialog); - wrefresh (menu); + wnoutrefresh (dialog); + wrefresh (menu); continue; /* wait for another key press */ - } + } switch (key) { case KEY_LEFT: @@ -405,15 +405,15 @@ dialog_menu (const char *title, const char *prompt, int height, int width, fclose(f); } delwin (dialog); - items[scroll + choice]->selected = 1; - switch (key) { - case 's': return 3; - case 'y': return 3; - case 'n': return 4; - case 'm': return 5; - case ' ': return 6; - case '/': return 7; - } + items[scroll + choice]->selected = 1; + switch (key) { + case 's': return 3; + case 'y': return 3; + case 'n': return 4; + case 'm': return 5; + case ' ': return 6; + case '/': return 7; + } return 0; case 'h': case '?': diff --git a/scripts/config/lxdialog/msgbox.c b/scripts/config/lxdialog/msgbox.c index 93692e1..de0f32b 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, wrefresh (dialog); while (key != ESC && key != '\n' && key != ' ' && - key != 'O' && key != 'o' && key != 'X' && key != 'x') + key != 'O' && key != 'o' && key != 'X' && key != 'x') key = wgetch (dialog); } else { key = '\n'; diff --git a/scripts/config/lxdialog/textbox.c b/scripts/config/lxdialog/textbox.c index a5a460b..b75e12a 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) /* Clear 'residue' of previous line */ #if OLD_NCURSES { - int i; - for (i = 0; i < width - x; i++) + int i; + for (i = 0; i < width - x; i++) waddch (win, ' '); } #else diff --git a/scripts/config/lxdialog/util.c b/scripts/config/lxdialog/util.c index 6f83951..47afa5e 100644 --- a/scripts/config/lxdialog/util.c +++ b/scripts/config/lxdialog/util.c @@ -29,7 +29,7 @@ const char *backtitle = NULL; const char *dialog_result; -/* +/* * Attribute values, default is for mono display */ chtype attributes[] = @@ -127,13 +127,13 @@ void dialog_clear (void) attr_clear (stdscr, LINES, COLS, screen_attr); /* Display background title if it exists ... - SLH */ if (backtitle != NULL) { - int i; + int i; - wattrset (stdscr, screen_attr); - mvwaddstr (stdscr, 0, 1, (char *)backtitle); - wmove (stdscr, 1, 1); - for (i = 1; i < COLS - 1; i++) - waddch (stdscr, ACS_HLINE); + wattrset (stdscr, screen_attr); + mvwaddstr (stdscr, 0, 1, (char *)backtitle); + wmove (stdscr, 1, 1); + for (i = 1; i < COLS - 1; i++) + waddch (stdscr, ACS_HLINE); } wnoutrefresh (stdscr); } @@ -204,7 +204,7 @@ print_autowrap (WINDOW * win, const char *prompt, int width, int y, int x) strcpy (tempstr, prompt); prompt_len = strlen(tempstr); - + /* * Remove newlines */ @@ -350,7 +350,7 @@ first_alpha(const char *string, const char *exempt) if (strchr("<[(", c)) ++in_paren; if (strchr(">])", c) && in_paren > 0) --in_paren; - if ((! in_paren) && isalpha(c) && + if ((! in_paren) && isalpha(c) && strchr(exempt, c) == 0) return i; } |