X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=scripts%2Fkconfig%2Flxdialog%2Fyesno.c;h=4e6e8090c20b573868e3cfe15015a6b6f54b2f69;hb=983a5f84a4a11c8706ca70615125db711336b684;hp=cb2568aae3ed7609a68dd04a81750e3e7c52ab2c;hpb=5c3eee79128c372a81a83665be2332a000944280;p=~andy%2Flinux diff --git a/scripts/kconfig/lxdialog/yesno.c b/scripts/kconfig/lxdialog/yesno.c index cb2568aae3e..4e6e8090c20 100644 --- a/scripts/kconfig/lxdialog/yesno.c +++ b/scripts/kconfig/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 */ }