Rework scroll window implementation

This complete rewrite of the scroll window implementation decouples
scroll windows from every other window abstraction layer we use. Note
that this leads to some code duplication. The long-term purpose of this
rewrite, however, is to eventually make every panel use scroll windows.
This makes for a huge cleanup of the UI code.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer
2014-05-13 18:43:02 +02:00
parent ca83e65696
commit 7184da0fa3
5 changed files with 121 additions and 91 deletions

View File

@@ -504,10 +504,14 @@ struct window {
/* Generic scrolling window structure. */
struct scrollwin {
struct window win;
struct window pad;
unsigned first_visible_line;
unsigned total_lines;
WINDOW *win;
WINDOW *inner;
int y;
int x;
int h;
int w;
unsigned line_off;
unsigned line_num;
const char *label;
};
@@ -1047,11 +1051,15 @@ enum win wins_slctd(void);
void wins_slctd_set(enum win);
void wins_slctd_next(void);
void wins_init(void);
void wins_scrollwin_init(struct scrollwin *);
void wins_scrollwin_init(struct scrollwin *, int, int, int, int, const char *);
void wins_scrollwin_resize(struct scrollwin *, int, int, int, int);
void wins_scrollwin_set_linecount(struct scrollwin *, unsigned);
void wins_scrollwin_delete(struct scrollwin *);
void wins_scrollwin_draw_deco(struct scrollwin *);
void wins_scrollwin_display(struct scrollwin *);
void wins_scrollwin_up(struct scrollwin *, int);
void wins_scrollwin_down(struct scrollwin *, int);
void wins_scrollwin_ensure_visible(struct scrollwin *, unsigned);
void wins_reinit(void);
void wins_reinit_panels(void);
void wins_show(WINDOW *, const char *);