diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-04-18 12:05:16 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-04-18 12:05:16 +0000 |
commit | 9d5510a500a1804484152adb8951dda3688658bc (patch) | |
tree | 6e4d8725c2956742201d0e14126f7e457b453c66 /scripts/config/lxdialog/yesno.c | |
parent | 97e7fdf6fdb8a91da52f622b499181171262af19 (diff) | |
download | master-31e0f0ae-9d5510a500a1804484152adb8951dda3688658bc.tar.gz master-31e0f0ae-9d5510a500a1804484152adb8951dda3688658bc.tar.bz2 master-31e0f0ae-9d5510a500a1804484152adb8951dda3688658bc.zip |
build: add new menuconfig code based on linux 3.9
SVN-Revision: 36361
Diffstat (limited to 'scripts/config/lxdialog/yesno.c')
-rw-r--r-- | scripts/config/lxdialog/yesno.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/scripts/config/lxdialog/yesno.c b/scripts/config/lxdialog/yesno.c index cb2568aae3..4e6e8090c2 100644 --- a/scripts/config/lxdialog/yesno.c +++ b/scripts/config/lxdialog/yesno.c @@ -29,8 +29,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 10; int y = height - 2; - print_button(dialog, " Yes ", y, x, selected == 0); - print_button(dialog, " No ", y, x + 13, selected == 1); + print_button(dialog, gettext(" Yes "), y, x, selected == 0); + print_button(dialog, gettext(" No "), y, x + 13, selected == 1); wmove(dialog, y, x + 1 + 13 * selected); wrefresh(dialog); @@ -44,6 +44,12 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width) int i, x, y, key = 0, button = 0; WINDOW *dialog; +do_resize: + if (getmaxy(stdscr) < (height + 4)) + return -ERRDISPLAYTOOSMALL; + if (getmaxx(stdscr) < (width + 4)) + return -ERRDISPLAYTOOSMALL; + /* center dialog box on screen */ x = (COLS - width) / 2; y = (LINES - height) / 2; @@ -53,22 +59,23 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width) dialog = newwin(height, width, y, x); keypad(dialog, TRUE); - draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); - wattrset(dialog, border_attr); + draw_box(dialog, 0, 0, height, width, + dlg.dialog.atr, dlg.border.atr); + wattrset(dialog, dlg.border.atr); mvwaddch(dialog, height - 3, 0, ACS_LTEE); for (i = 0; i < width - 2; i++) waddch(dialog, ACS_HLINE); - wattrset(dialog, dialog_attr); + wattrset(dialog, dlg.dialog.atr); waddch(dialog, ACS_RTEE); print_title(dialog, title, width); - wattrset(dialog, dialog_attr); + wattrset(dialog, dlg.dialog.atr); print_autowrap(dialog, prompt, width - 2, 1, 3); print_buttons(dialog, height, width, 0); - while (key != ESC) { + while (key != KEY_ESC) { key = wgetch(dialog); switch (key) { case 'Y': @@ -92,11 +99,16 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width) case '\n': delwin(dialog); return button; - case ESC: + case KEY_ESC: + key = on_key_esc(dialog); break; + case KEY_RESIZE: + delwin(dialog); + on_key_resize(); + goto do_resize; } } delwin(dialog); - return -1; /* ESC pressed */ + return key; /* ESC pressed */ } |