diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2012-12-30 04:22:34 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2012-12-30 04:22:34 +0000 |
commit | 52bf5abd924bc78494905f16ffbd4bd67062240c (patch) | |
tree | 6d48accafd38ffd900622df8c9eab499d302c36f /contrib/dialog/progressbox.c | |
parent | 7e3a527820c0248a0703bbf8809aabef78a41db6 (diff) | |
download | FreeBSD-src-52bf5abd924bc78494905f16ffbd4bd67062240c.zip FreeBSD-src-52bf5abd924bc78494905f16ffbd4bd67062240c.tar.gz |
Revert r241818 that updated dialog to 20120706. This turns out to horribly
break mixed form dialogs in conjunction with the FreeBSD termcap, making
the bsdinstall partition editor Add dialog, among other things, completely
nonfunctional. This restores dialog 20110707.
Diffstat (limited to 'contrib/dialog/progressbox.c')
-rw-r--r-- | contrib/dialog/progressbox.c | 60 |
1 files changed, 16 insertions, 44 deletions
diff --git a/contrib/dialog/progressbox.c b/contrib/dialog/progressbox.c index 077339c..024e288 100644 --- a/contrib/dialog/progressbox.c +++ b/contrib/dialog/progressbox.c @@ -1,5 +1,5 @@ /* - * $Id: progressbox.c,v 1.21 2012/07/03 00:12:52 tom Exp $ + * $Id: progressbox.c,v 1.13 2011/06/27 08:18:20 tom Exp $ * * progressbox.c -- implements the progress box * @@ -99,7 +99,6 @@ print_line(MY_OBJ * obj, WINDOW *win, int row, int width) #endif getyx(win, y, x); - (void) y; /* Clear 'residue' of previous line */ for (i = 0; i < width - x; i++) (void) waddch(win, ' '); @@ -112,79 +111,54 @@ pause_for_ok(WINDOW *dialog, int height, int width) static DLG_KEYS_BINDING binding[] = { HELPKEY_BINDINGS, ENTERKEY_BINDINGS, - TRAVERSE_BINDINGS, + DLG_KEYS_DATA( DLGK_ENTER, ' ' ), END_KEYS_BINDING }; /* *INDENT-ON* */ - int button; + int button = 0; int key = 0, fkey; int result = DLG_EXIT_UNKNOWN; const char **buttons = dlg_ok_label(); int check; - int save_nocancel = dialog_vars.nocancel; - bool redraw = TRUE; - - dialog_vars.nocancel = TRUE; - button = dlg_default_button(); dlg_register_window(dialog, "progressbox", binding); dlg_register_buttons(dialog, "progressbox", buttons); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + dlg_draw_bottom_box(dialog); mouse_mkbutton(height - 2, width / 2 - 4, 6, '\n'); + dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); while (result == DLG_EXIT_UNKNOWN) { - if (redraw) { - redraw = FALSE; - if (button < 0) - button = 0; - dlg_draw_buttons(dialog, - height - 2, 0, - buttons, button, - FALSE, width); - } - key = dlg_mouse_wgetch(dialog, &fkey); if (dlg_result_key(key, fkey, &result)) break; if (!fkey && (check = dlg_char_to_button(key, buttons)) >= 0) { - result = dlg_ok_buttoncode(check); + result = check ? DLG_EXIT_HELP : DLG_EXIT_OK; break; } if (fkey) { switch (key) { - case DLGK_FIELD_NEXT: - button = dlg_next_button(buttons, button); - redraw = TRUE; + case DLGK_ENTER: + result = button ? DLG_EXIT_HELP : DLG_EXIT_OK; break; - case DLGK_FIELD_PREV: - button = dlg_prev_button(buttons, button); - redraw = TRUE; + case DLGK_MOUSE(0): + result = DLG_EXIT_OK; break; - case DLGK_ENTER: - result = dlg_ok_buttoncode(button); + case DLGK_MOUSE(1): + result = DLG_EXIT_HELP; break; default: - if (is_DLGK_MOUSE(key)) { - result = dlg_ok_buttoncode(key - M_EVENT); - if (result < 0) - result = DLG_EXIT_OK; - } else { - beep(); - } + beep(); break; } - } else { beep(); } } dlg_unregister_window(dialog); - - dialog_vars.nocancel = save_nocancel; return result; } @@ -214,17 +188,16 @@ dlg_progressbox(const char *title, dialog = dlg_new_window(height, width, y, x); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); dlg_draw_title(dialog, title); dlg_draw_helpline(dialog, FALSE); if (*prompt != '\0') { int y2, x2; - (void) wattrset(dialog, dialog_attr); + wattrset(dialog, dialog_attr); dlg_print_autowrap(dialog, prompt, height, width); getyx(dialog, y2, x2); - (void) x2; ++y2; wmove(dialog, y2, MARGIN); for (i = 0; i < getmaxx(dialog) - 2 * MARGIN; i++) @@ -263,7 +236,6 @@ dlg_progressbox(const char *title, print_line(obj, text, thigh - 1, width - (2 * MARGIN)); } (void) wrefresh(text); - dlg_trace_win(dialog); if (obj->is_eof) break; } @@ -282,7 +254,7 @@ dlg_progressbox(const char *title, free(prompt); free(obj); - return result; + return DLG_EXIT_OK; } /* |