diff options
author | Lars Henriksen <LarsHenriksen@get2net.dk> | 2019-03-16 08:27:45 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2019-05-22 01:56:59 -0400 |
commit | 4284ca91bc0fd04851a34c67dae1068f3c1defc9 (patch) | |
tree | 09dbb5bd0722d4043ea7d5cba274183d714a7d29 /src/day.c | |
parent | 1ccfe128cce8d670d12c350326bb13fbc0276d0a (diff) | |
download | calcurse-4284ca91bc0fd04851a34c67dae1068f3c1defc9.tar.gz calcurse-4284ca91bc0fd04851a34c67dae1068f3c1defc9.zip |
Implement scrolling in the appointments panel
With multiple days in the APP panel, up/down movements should change
behaviour at the top and bottom of the list displayed, and load the
previous/next lot of days.
This requires that the move function returns the result of the
operation. Furthermore, the ability to move the selection to the
beginning of a day is needed when moving down (in order to move from the
first day to the last day). For this reason a DAY_SEPARATOR has been
inserted also after the last day of a lot.
Appointments have a listbox height of three to separate them clearly
when there is more than one in a day. This leaves a spurious empty line
at the end of a day with appointments. The DAY_SEPARATOR height is
reduced from two to one, and a new EMPTY_SEPARATOR of height one is
inserted in any day with only events.
When scrolling up the DAY_HEADING becomes visible when the selection
reaches the first item of the day.
The length of the separator (between events and appointments) is
adjusted to leave a space to the window border at both ends, thereby
making it a part of the day, not a separation between days.
The dummy event must also be recognisable when not the selected item and
is only inserted in interactive mode.
The test for a saved selection must also recognise caption items which
have item pointer NULL.
The function day_get_nb() has been renamed day_get_days().
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 | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -42,7 +42,7 @@ #include "calcurse.h" -static unsigned day_nb = 7; +static unsigned day_days = 5; static vector_t day_items; static unsigned day_items_nb = 0; @@ -107,9 +107,9 @@ int day_sel_index(void) return -1; } -int day_get_nb(void) +int day_get_days(void) { - return day_nb; + return day_days; } static void day_free(struct day_item *day) @@ -397,6 +397,7 @@ static int day_store_recur_apoints(time_t date) { llist_item_t *i; union aptev_ptr p; + time_t occurrence; int a_nb = 0; LLIST_TS_LOCK(&recur_alist_p); @@ -404,8 +405,6 @@ static int day_store_recur_apoints(time_t date) struct recur_apoint *rapt = LLIST_TS_GET_DATA(i); p.rapt = rapt; - - time_t occurrence; /* As for appointments */ if (recur_apoint_find_occurrence(rapt, date, &occurrence)) { day_add_item(RECUR_APPT, @@ -451,7 +450,7 @@ day_store_items(time_t date, int include_captions, int n) day_items_nb += events + apts; - if (events == 0 && apts == 0) { + if (include_captions && events == 0 && apts == 0) { /* Insert dummy event. */ d.ev = &dummy; dummy.mesg = _("(none)"); @@ -459,8 +458,12 @@ day_store_items(time_t date, int include_captions, int n) day_items_nb++; } - if (include_captions && i < n - 1) + if (include_captions) { + /* Two empty lines between days. */ + if (apts == 0) + day_add_item(EMPTY_SEPARATOR, 0, ENDOFDAY(date), p); day_add_item(DAY_SEPARATOR, 0, ENDOFDAY(date), p); + } } VECTOR_SORT(&day_items, day_cmp); |