diff options
Diffstat (limited to 'contrib/dialog/calendar.c')
-rw-r--r-- | contrib/dialog/calendar.c | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/contrib/dialog/calendar.c b/contrib/dialog/calendar.c index 45a40ab..0a7061a 100644 --- a/contrib/dialog/calendar.c +++ b/contrib/dialog/calendar.c @@ -1,9 +1,9 @@ /* - * $Id: calendar.c,v 1.62 2011/06/29 09:47:06 tom Exp $ + * $Id: calendar.c,v 1.67 2013/03/17 15:03:41 tom Exp $ * * calendar.c -- implements the calendar box * - * Copyright 2001-2010,2011 Thomas E. Dickey + * Copyright 2001-2012,2013 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 @@ -225,12 +225,14 @@ draw_day(BOX * data, struct tm *current) int prev = days_in_month(current, -1); werase(data->window); - dlg_draw_box(data->parent, - data->y - MARGIN, data->x - MARGIN, - data->height + (2 * MARGIN), data->width + (2 * MARGIN), - menubox_border_attr, menubox_attr); /* border of daybox */ - - wattrset(data->window, menubox_attr); /* daynames headline */ + dlg_draw_box2(data->parent, + data->y - MARGIN, data->x - MARGIN, + data->height + (2 * MARGIN), data->width + (2 * MARGIN), + menubox_attr, + menubox_border_attr, + menubox_border2_attr); + + (void) wattrset(data->window, menubox_attr); /* daynames headline */ for (x = 0; x < 7; x++) { mvwprintw(data->window, 0, (x + 1) * cell_wide, "%*.*s ", @@ -246,7 +248,7 @@ draw_day(BOX * data, struct tm *current) week = (current->tm_yday + 6 + mday - current->tm_mday) / 7; for (y = 1; mday < last; y++) { - wattrset(data->window, menubox_attr); /* weeknumbers headline */ + (void) wattrset(data->window, menubox_attr); /* weeknumbers headline */ mvwprintw(data->window, y, 0, "%*d ", @@ -257,9 +259,9 @@ draw_day(BOX * data, struct tm *current) ++mday; if (wmove(data->window, y, this_x) == ERR) continue; - wattrset(data->window, item_attr); /* not selected days */ + (void) wattrset(data->window, item_attr); /* not selected days */ if (mday == day) { - wattrset(data->window, item_selected_attr); /* selected day */ + (void) wattrset(data->window, item_selected_attr); /* selected day */ save_y = y; save_x = this_x; } @@ -294,13 +296,15 @@ draw_month(BOX * data, struct tm *current) month = current->tm_mon + 1; - wattrset(data->parent, dialog_attr); /* Headline "Month" */ + (void) wattrset(data->parent, dialog_attr); /* Headline "Month" */ (void) mvwprintw(data->parent, data->y - 2, data->x - 1, _("Month")); - dlg_draw_box(data->parent, - data->y - 1, data->x - 1, - data->height + 2, data->width + 2, - menubox_border_attr, menubox_attr); /* borders of monthbox */ - wattrset(data->window, item_attr); /* color the month selection */ + dlg_draw_box2(data->parent, + data->y - 1, data->x - 1, + data->height + 2, data->width + 2, + menubox_attr, + menubox_border_attr, + menubox_border2_attr); + (void) wattrset(data->window, item_attr); /* color the month selection */ mvwprintw(data->window, 0, 0, "%s", nameOfMonth(month - 1)); wmove(data->window, 0, 0); return 0; @@ -314,13 +318,15 @@ draw_year(BOX * data, struct tm *current) { int year = current->tm_year + 1900; - wattrset(data->parent, dialog_attr); /* Headline "Year" */ + (void) wattrset(data->parent, dialog_attr); /* Headline "Year" */ (void) mvwprintw(data->parent, data->y - 2, data->x - 1, _("Year")); - dlg_draw_box(data->parent, - data->y - 1, data->x - 1, - data->height + 2, data->width + 2, - menubox_border_attr, menubox_attr); /* borders of yearbox */ - wattrset(data->window, item_attr); /* color the year selection */ + dlg_draw_box2(data->parent, + data->y - 1, data->x - 1, + data->height + 2, data->width + 2, + menubox_attr, + menubox_border_attr, + menubox_border2_attr); + (void) wattrset(data->window, item_attr); /* color the year selection */ mvwprintw(data->window, 0, 0, "%4d", year); wmove(data->window, 0, 0); return 0; @@ -430,7 +436,7 @@ dialog_calendar(const char *title, WINDOW *dialog; time_t now_time = time((time_t *) 0); struct tm current; - int state = dlg_defaultno_button(); + int state = dlg_default_button(); const char **buttons = dlg_ok_labels(); char *prompt = dlg_strclone(subtitle); int mincols = MIN_WIDE; @@ -491,11 +497,11 @@ dialog_calendar(const char *title, dlg_register_buttons(dialog, "calendar", buttons); /* mainbox */ - dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); - dlg_draw_bottom_box(dialog); + dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); + dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); dlg_draw_title(dialog, title); - wattrset(dialog, dialog_attr); /* text mainbox */ + (void) wattrset(dialog, dialog_attr); /* text mainbox */ dlg_print_autowrap(dialog, prompt, height, width); /* compute positions of day, month and year boxes */ @@ -539,6 +545,7 @@ dialog_calendar(const char *title, return CleanupResult(DLG_EXIT_ERROR, dialog, prompt, &save_vars); } + dlg_trace_win(dialog); while (result == DLG_EXIT_UNKNOWN) { BOX *obj = (state == sDAY ? &dy_box : (state == sMONTH ? &mn_box : @@ -674,6 +681,7 @@ dialog_calendar(const char *title, dlg_add_result(buffer); dlg_add_separator(); + dlg_add_last_key(-1); return CleanupResult(result, dialog, prompt, &save_vars); } |