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

@@ -668,14 +668,8 @@ static unsigned print_config_options(WINDOW * optwin)
static void reinit_conf_win(struct scrollwin *win)
{
unsigned first_line;
first_line = win->first_visible_line;
wins_scrollwin_delete(win);
custom_set_swsiz(win);
wins_scrollwin_init(win);
wins_show(win->win.p, win->label);
win->first_visible_line = first_line;
wins_scrollwin_resize(win, 0, 0, notify_bar() ? row - 3 : row - 2, col);
wins_scrollwin_draw_deco(win);
}
/* Notify-bar configuration. */
@@ -697,12 +691,10 @@ void notify_config_bar(void)
int ch;
clear();
custom_set_swsiz(&cwin);
cwin.label = _("notification options");
wins_scrollwin_init(&cwin);
wins_show(cwin.win.p, cwin.label);
wins_scrollwin_init(&cwin, 0, 0, notify_bar() ? row - 3 : row - 2, col, _("notification options"));
wins_scrollwin_draw_deco(&cwin);
status_mesg(number_str, keys);
cwin.total_lines = print_config_options(cwin.pad.p);
wins_scrollwin_set_linecount(&cwin, print_config_options(cwin.inner));
wins_scrollwin_display(&cwin);
buf = mem_malloc(BUFSIZ);
@@ -724,7 +716,6 @@ void notify_config_bar(void)
notify_start_main_thread();
else
notify_stop_main_thread();
wins_scrollwin_delete(&cwin);
reinit_conf_win(&cwin);
break;
case '2':
@@ -809,7 +800,7 @@ void notify_config_bar(void)
}
status_mesg(number_str, keys);
cwin.total_lines = print_config_options(cwin.pad.p);
print_config_options(cwin.inner);
wins_scrollwin_display(&cwin);
}
mem_free(buf);