diff options
| author | Baptiste Daroussin <bapt@FreeBSD.org> | 2018-10-20 20:32:57 +0000 | 
|---|---|---|
| committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2018-10-20 20:32:57 +0000 | 
| commit | 4dccdce4191d6e2bc3ba9f782b0fe1aa46b743e3 (patch) | |
| tree | 3f3f729ef0455b62fba0c60263ba2c0180f4b4ec /timebox.c | |
| parent | 42c10d5d7d5ba2fde22838d594f29d2f73b3ead2 (diff) | |
Notes
Diffstat (limited to 'timebox.c')
| -rw-r--r-- | timebox.c | 27 | 
1 files changed, 20 insertions, 7 deletions
| diff --git a/timebox.c b/timebox.c index 38abeecc75dd..288e76735d24 100644 --- a/timebox.c +++ b/timebox.c @@ -1,9 +1,9 @@  /* - * $Id: timebox.c,v 1.54 2013/03/17 15:03:41 tom Exp $ + * $Id: timebox.c,v 1.59 2018/06/19 22:57:01 tom Exp $   *   *  timebox.c -- implements the timebox dialog   * - *  Copyright 2001-2012,2013   Thomas E. Dickey + *  Copyright 2001-2016,2018   Thomas E. Dickey   *   *  This program is free software; you can redistribute it and/or modify   *  it under the terms of the GNU Lesser General Public License, version 2.1 @@ -82,7 +82,7 @@ draw_cell(BOX * data)  		 data->height + (2 * MARGIN), data->width + (2 * MARGIN),  		 menubox_border_attr, menubox_border2_attr); -    (void) wattrset(data->window, item_attr); +    dlg_attrset(data->window, item_attr);      wprintw(data->window, "%02d", data->value);      return 0;  } @@ -148,7 +148,7 @@ dialog_timebox(const char *title,  	DLG_KEYS_DATA( DLGK_DELETE_RIGHT,KEY_DC ),  	HELPKEY_BINDINGS,  	ENTERKEY_BINDINGS, -	DLG_KEYS_DATA( DLGK_ENTER,	' ' ), +	TOGGLEKEY_BINDINGS,  	DLG_KEYS_DATA( DLGK_FIELD_FIRST,KEY_HOME ),  	DLG_KEYS_DATA( DLGK_FIELD_LAST, KEY_END ),  	DLG_KEYS_DATA( DLGK_FIELD_LAST, KEY_LL ), @@ -184,10 +184,19 @@ dialog_timebox(const char *title,      struct tm current;      int state = dlg_default_button();      const char **buttons = dlg_ok_labels(); -    char *prompt = dlg_strclone(subtitle); +    char *prompt;      char buffer[MAX_LEN];      DIALOG_VARS save_vars; +    DLG_TRACE(("# timebox args:\n")); +    DLG_TRACE2S("title", title); +    DLG_TRACE2S("message", subtitle); +    DLG_TRACE2N("height", height); +    DLG_TRACE2N("width", width); +    DLG_TRACE2N("hour", hour); +    DLG_TRACE2N("minute", minute); +    DLG_TRACE2N("second", second); +      now_time = time((time_t *) 0);      current = *localtime(&now_time); @@ -200,7 +209,9 @@ dialog_timebox(const char *title,    retry:  #endif +    prompt = dlg_strclone(subtitle);      dlg_auto_size(title, prompt, &height, &width, 0, 0); +      height += MIN_HIGH;      if (width < MIN_WIDE)  	width = MIN_WIDE; @@ -224,7 +235,7 @@ dialog_timebox(const char *title,      dlg_draw_title(dialog, title);      dlg_draw_helpline(dialog, FALSE); -    (void) wattrset(dialog, dialog_attr); +    dlg_attrset(dialog, dialog_attr);      dlg_print_autowrap(dialog, prompt, height, width);      /* compute positions of hour, month and year boxes */ @@ -303,6 +314,7 @@ dialog_timebox(const char *title,  		case DLGK_MOUSE('S'):  		    state = sSC;  		    break; +		case DLGK_TOGGLE:  		case DLGK_ENTER:  		    result = dlg_ok_buttoncode(button);  		    break; @@ -340,6 +352,7 @@ dialog_timebox(const char *title,  		    break;  #ifdef KEY_RESIZE  		case KEY_RESIZE: +		    dlg_will_resize(dialog);  		    /* reset data */  		    height = old_height;  		    width = old_width; @@ -347,9 +360,9 @@ dialog_timebox(const char *title,  		    minute = mn_box.value;  		    second = sc_box.value;  		    /* repaint */ +		    free(prompt);  		    dlg_clear();  		    dlg_del_window(dialog); -		    refresh();  		    dlg_mouse_free_regions();  		    goto retry;  #endif | 
