diff options
author | Frederic Culot <calcurse@culot.org> | 2009-10-08 16:28:05 +0000 |
---|---|---|
committer | Frederic Culot <calcurse@culot.org> | 2009-10-08 16:28:05 +0000 |
commit | abc03bb86f0ed57fa56c7bdeaa2aabf1360555f0 (patch) | |
tree | cfb32f969c823e0d1d160581428b149711eb6829 /src/calendar.c | |
parent | a90f680d70318f8c2751b58b15aa41d9602e1325 (diff) | |
download | calcurse-abc03bb86f0ed57fa56c7bdeaa2aabf1360555f0.zip |
More work on the weekly calendar view.
Diffstat (limited to 'src/calendar.c')
-rwxr-xr-x | src/calendar.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/calendar.c b/src/calendar.c index ff2c99d..72cc330 100755 --- a/src/calendar.c +++ b/src/calendar.c @@ -1,4 +1,4 @@ -/* $calcurse: calendar.c,v 1.27 2009/08/25 14:51:41 culot Exp $ */ +/* $calcurse: calendar.c,v 1.28 2009/10/08 16:28:06 culot Exp $ */ /* * Calcurse - text-based organizer @@ -483,12 +483,15 @@ draw_weekly_view (window_t *cwin, date_t *current_day, unsigned sunday_first) custom_apply_attr (cwin->p, ATTR_HIGHEST); mvwprintw (cwin->p, 2, cwin->w - 9, "(# %02d)", weeknum); custom_remove_attr (cwin->p, ATTR_HIGHEST); + +#define DAYSLICESNO 6 /* Now draw calendar view. */ for (j = 0; j < WEEKINDAYS; j++) { date_t date; unsigned attr, item_this_day; + int i, slices[DAYSLICESNO]; /* print the day names, with regards to the first day of the week */ custom_apply_attr (cwin->p, ATTR_HIGHEST); @@ -520,10 +523,25 @@ draw_weekly_view (window_t *cwin, date_t *current_day, unsigned sunday_first) mvwprintw (cwin->p, 4, 2 + 4 * j, "%02d", t.tm_mday); if (attr) custom_remove_attr (cwin->p, attr); + + /* Draw slices indicating appointment times. */ + bzero (slices, DAYSLICESNO * sizeof *slices); + if (day_chk_busy_slices (date, DAYSLICESNO, slices)) + { + for (i = 0; i < DAYSLICESNO; i++) + if (slices[i]) + { + wattron (cwin->p, A_REVERSE); + mvwprintw (cwin->p, 5 + i, 3 + 4 * j, " "); + wattroff (cwin->p, A_REVERSE); + } + } /* get next day */ (void)date_change (&t, 0, 1); } + +#undef DAYSLICESNO } /* Function used to display the calendar panel. */ |