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>
This commit is contained in:
Lars Henriksen
2018-12-27 12:08:25 +01:00
committed by Lukas Fleischer
parent 4284ca91bc
commit 0bb4a59b5f
5 changed files with 178 additions and 109 deletions

View File

@@ -432,6 +432,24 @@ time_t utcdate2sec(struct date day, unsigned hour, unsigned min)
return t;
}
/* Compare two calcurse dates. */
int date_cmp(struct date *d1, struct date *d2)
{
if (d1->yyyy < d2->yyyy)
return -1;
if (d1->yyyy > d2->yyyy)
return 1;
if (d1->mm < d2->mm)
return -1;
if (d1->mm > d2->mm)
return 1;
if (d1->dd < d2->dd)
return -1;
if (d1->dd > d2->dd)
return 1;
return 0;
}
/* Compare two dates (without comparing times). */
int date_cmp_day(time_t d1, time_t d2)
{