diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2014-05-15 14:37:49 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2014-05-18 11:03:10 +0200 |
commit | 655218b7df40b3e159119933a4fa18efca2ff940 (patch) | |
tree | bbcefa98df1595151c33752ebc45fe2a5ec5336e /src/wins.c | |
parent | 4210fdd38a511f1ea2529eea2dfd5d55ab144e37 (diff) | |
download | calcurse-655218b7df40b3e159119933a4fa18efca2ff940.tar.gz calcurse-655218b7df40b3e159119933a4fa18efca2ff940.zip |
ui-todo: Large-scale refactoring
This is a complete overhaul of the TODO list user interface. The new
implementation uses the generic list box panel.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/wins.c')
-rw-r--r-- | src/wins.c | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -50,6 +50,7 @@ /* Variables to handle calcurse windows. */ struct window win[NBWINS]; +struct listbox lb_todo; /* User-configurable side bar width. */ static unsigned sbarwidth_perc; @@ -252,14 +253,13 @@ static void wins_init_panels(void) apad.width = win[APP].w - 3; apad.ptrwin = newpad(apad.length, apad.width); - win[TOD].p = - newwin(win[TOD].h, win[TOD].w, win[TOD].y, win[TOD].x); - wins_show(win[TOD].p, _("TODO")); + listbox_init(&lb_todo, win[TOD].y, win[TOD].x, win[TOD].h, win[TOD].w, + _("TODO"), ui_todo_height, ui_todo_draw); + ui_todo_load_items(); /* Enable function keys (i.e. arrow keys) in those windows */ keypad(win[CAL].p, TRUE); keypad(win[APP].p, TRUE); - keypad(win[TOD].p, TRUE); } /* Create all the windows. */ @@ -403,7 +403,7 @@ void wins_reinit_panels(void) delwin(win[CAL].p); delwin(win[APP].p); delwin(apad.ptrwin); - delwin(win[TOD].p); + listbox_delete(&lb_todo); wins_get_config(); wins_init_panels(); } @@ -417,7 +417,7 @@ void wins_reinit(void) delwin(win[CAL].p); delwin(win[APP].p); delwin(apad.ptrwin); - delwin(win[TOD].p); + listbox_delete(&lb_todo); delwin(win[STA].p); delwin(win[KEY].p); wins_get_config(); @@ -556,12 +556,8 @@ void wins_update_border(int flags) else border_nocolor(win[APP].p); } - if (flags & FLAG_TOD) { - if (slctd_win == TOD) - border_color(win[TOD].p); - else - border_nocolor(win[TOD].p); - } + if (flags & FLAG_TOD) + listbox_draw_deco(&lb_todo, (slctd_win == TOD)); } void wins_update_panels(int flags) |