diff options
author | Lars Henriksen <LarsHenriksen@get2net.dk> | 2019-03-16 08:31:12 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2019-05-22 01:56:59 -0400 |
commit | df2cb2a9c024b167fdca3b0b91e27fe7bb47b5a8 (patch) | |
tree | 872895b566f01a78dc6ab930f7b4c192abf56a44 /src/calcurse.h | |
parent | 576994de00fd61b4ce521360cfdb076e9a051ee2 (diff) | |
download | calcurse-df2cb2a9c024b167fdca3b0b91e27fe7bb47b5a8.tar.gz calcurse-df2cb2a9c024b167fdca3b0b91e27fe7bb47b5a8.zip |
Refactor listbox code
The changes are related to the selected item and the visible lines in
the scroll window viewport.
In particular, the function listbox_fix_visible_region() has been
eliminated, and functions previously only called by it have been
removed. It performed several tasks that are now elsewhere. One was
removed in an earlier commit (scroll window pad improvement). The task
of making a multi-line item visible has been moved to
listbox_item_in_view(). The task of making a caption line above a text
line visible is listbox specific (for the ap_list) and will be moved to
ui_day_sel_move(), where it is needed.
Boundary checks for the listbox selection have been moved to
listbox_fix_sel().
For future use listbox_sel_move() returns success or failure.
The function wins_scrollwin_ensure_visible() has been renamed
wins_scrollwin_in_view().
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/calcurse.h')
-rw-r--r-- | src/calcurse.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/calcurse.h b/src/calcurse.h index c568e89..3c9986f 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -580,8 +580,8 @@ struct window { /* Generic scrolling window structure. */ struct scrollwin { - WINDOW *win; - WINDOW *inner; + WINDOW *win; /* viewport */ + WINDOW *inner; /* pad */ int y; int x; int h; @@ -936,7 +936,8 @@ void listbox_draw_deco(struct listbox *, int); void listbox_display(struct listbox *, int); int listbox_get_sel(struct listbox *); void listbox_set_sel(struct listbox *, unsigned); -void listbox_sel_move(struct listbox *, int); +void listbox_item_in_view(struct listbox *, int); +int listbox_sel_move(struct listbox *, int); /* mem.c */ void *xmalloc(size_t); @@ -1271,7 +1272,7 @@ void wins_scrollwin_draw_deco(struct scrollwin *, int); void wins_scrollwin_display(struct scrollwin *, int); void wins_scrollwin_up(struct scrollwin *, int); void wins_scrollwin_down(struct scrollwin *, int); -void wins_scrollwin_ensure_visible(struct scrollwin *, unsigned); +void wins_scrollwin_in_view(struct scrollwin *, unsigned); void wins_resize(void); void wins_resize_panels(void); void wins_show(WINDOW *, const char *); |