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>
This commit is contained in:
Lars Henriksen
2019-03-16 08:27:45 +01:00
committed by Lukas Fleischer
parent 1ccfe128cc
commit 4284ca91bc
4 changed files with 121 additions and 21 deletions

View File

@@ -60,7 +60,7 @@ static void do_storage(int day_changed)
ui_day_sel_reset();
/* The day_items vector. */
day_store_items(get_slctd_day(), 1, day_get_nb());
day_store_items(get_slctd_day(), 1, day_get_days());
/* The APP listbox. */
ui_day_load_items();
@@ -414,7 +414,12 @@ static inline void key_move_up(void)
if (wins_slctd() == CAL) {
key_generic_prev_week();
} else if (wins_slctd() == APP) {
ui_day_sel_move(-1);
if (!ui_day_sel_move(-1)) {
ui_calendar_move(DAY_PREV, 1);
do_storage(1);
ui_day_sel_dayend();
wins_update(FLAG_CAL);
}
wins_update(FLAG_APP);
} else if (wins_slctd() == TOD) {
ui_todo_sel_move(-1);
@@ -434,7 +439,12 @@ static inline void key_move_down(void)
if (wins_slctd() == CAL) {
key_generic_next_week();
} else if (wins_slctd() == APP) {
ui_day_sel_move(1);
if (!ui_day_sel_move(1)) {
ui_calendar_move(DAY_NEXT, 1);
do_storage(1);
ui_day_sel_daybegin(day_get_days() - 1);
wins_update(FLAG_CAL);
}
wins_update(FLAG_APP);
} else if (wins_slctd() == TOD) {
ui_todo_sel_move(1);