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

@@ -421,6 +421,7 @@ enum day_item_type {
EVNT_SEPARATOR,
RECUR_APPT,
APPT,
EMPTY_SEPARATOR,
DAY_SEPARATOR
};
@@ -764,7 +765,7 @@ int parse_args(int, char **);
/* calendar.c */
extern struct day_item empty_day;
/* ui_calendar.c */
/* ui-calendar.c */
void ui_calendar_view_next(void);
void ui_calendar_view_prev(void);
void ui_calendar_set_view(int);
@@ -803,10 +804,10 @@ void custom_keys_config(void);
void custom_config_main(void);
/* day.c */
int day_get_nb(void);
int day_set_sel_data(struct day_item *);
int day_check_sel_data(void);
int day_sel_index(void);
int day_get_days(void);
void day_free_vector(void);
char *day_item_get_mesg(struct day_item *);
char *day_item_get_note(struct day_item *);
@@ -1115,7 +1116,9 @@ struct day_item *ui_day_get_sel(void);
time_t ui_day_sel_date(void);
void ui_day_sel_reset(void);
void ui_day_set_sel(struct day_item *);
void ui_day_sel_move(int);
int ui_day_sel_move(int);
void ui_day_sel_daybegin(int);
void ui_day_sel_dayend(void);
void ui_day_draw(int, WINDOW *, int, int, void *);
enum listbox_row_type ui_day_row_type(int, void *);
int ui_day_height(int, void *);