diff options
author | Lars Henriksen <LarsHenriksen@get2net.dk> | 2018-12-27 12:08:25 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2019-05-22 01:56:59 -0400 |
commit | 0bb4a59b5fb089062f0eb369d39289ff1ccfc2ba (patch) | |
tree | 7186551e8e2be5ad5643c4e5d7e57ce98037e80b /src/day.c | |
parent | 4284ca91bc0fd04851a34c67dae1068f3c1defc9 (diff) | |
download | calcurse-0bb4a59b5fb089062f0eb369d39289ff1ccfc2ba.tar.gz calcurse-0bb4a59b5fb089062f0eb369d39289ff1ccfc2ba.zip |
Add week numbers in the calendar and full first and last week
Much in the calendar is based on the selected day, struct date
slctd_day, in ui-calendar.c.
On the screen it is highlighted with a deviating colour. The highlight
effect has been changed to a pair of red square brackets that do not
obscure the day colour.
The week number (in the frame) used to be that of the selected day, but
has no obvious relation to the days in the APP panel. It has been
replaced by the year day number of the selected day. The week numbers of
all visible weeks are displayed to the left of the calendar.
Dates are displayed also for the overlapping parts of the first and last
week of the month (which do not belong to the month).
Days are accessible in the appointments panel as well as in the
calendar. Hence, validation of days (= inside UNIX time limits) must be
extended from the calendar (in ui_calendar_move()) to include loaded
days (in day_store_items()).
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/day.c')
-rw-r--r-- | src/day.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -437,6 +437,9 @@ day_store_items(time_t date, int include_captions, int n) day_init_vector(); for (i = 0; i < n; i++, date = NEXTDAY(date)) { + if (YEAR1902_2037 && !check_sec(&date)) + break; + if (include_captions) day_add_item(DAY_HEADING, 0, date, p); @@ -584,10 +587,10 @@ void day_popup_item(struct day_item *day) } /* - * Check whether there is an item on a given day. - * - * Returns 2 if the selected day contains a regular event or appointment. - * Returns 1 if the selected day does not contain a regular event or + * Check whether there is an item on a given day and return the colour + * attribute for the item: + * ATTR_TRUE if the selected day contains a regular event or appointment, + * ATTR_LOW if the selected day does not contain a regular event or * appointment but an occurrence of a recurrent item. Returns 0 otherwise. */ int day_check_if_item(struct date day) @@ -595,23 +598,23 @@ int day_check_if_item(struct date day) const time_t t = date2sec(day, 0, 0); if (LLIST_FIND_FIRST(&eventlist, (time_t *)&t, event_inday)) - return 2; + return ATTR_TRUE; LLIST_TS_LOCK(&alist_p); if (LLIST_TS_FIND_FIRST(&alist_p, (time_t *)&t, apoint_inday)) { LLIST_TS_UNLOCK(&alist_p); - return 2; + return ATTR_TRUE; } LLIST_TS_UNLOCK(&alist_p); if (LLIST_FIND_FIRST(&recur_elist, (time_t *)&t, recur_event_inday)) - return 1; + return ATTR_LOW; LLIST_TS_LOCK(&recur_alist_p); if (LLIST_TS_FIND_FIRST(&recur_alist_p, (time_t *)&t, recur_apoint_inday)) { LLIST_TS_UNLOCK(&recur_alist_p); - return 1; + return ATTR_LOW; } LLIST_TS_UNLOCK(&recur_alist_p); |