summaryrefslogtreecommitdiff
path: root/src/notify.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2014-05-13 18:43:02 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2014-05-18 11:02:32 +0200
commit7184da0fa364049424f626f55f7c2bc0a7d22929 (patch)
tree728419c8fd482a789d996b4a29f9cbff58974999 /src/notify.c
parentca83e6569617aa19679844986ecb929d38fc7786 (diff)
downloadcalcurse-7184da0fa364049424f626f55f7c2bc0a7d22929.zip
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>
Diffstat (limited to 'src/notify.c')
-rw-r--r--src/notify.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/notify.c b/src/notify.c
index 816da3c..37fec8f 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -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);