aboutsummaryrefslogtreecommitdiffstats
path: root/src/wins.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2014-05-15 21:49:32 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2014-05-18 11:03:13 +0200
commitcf1565648bde10103b1aae14a253b3e13bb380db (patch)
tree62c87a42dc011180b2b06d419b6c5d14560dbde4 /src/wins.c
parent655218b7df40b3e159119933a4fa18efca2ff940 (diff)
downloadcalcurse-cf1565648bde10103b1aae14a253b3e13bb380db.tar.gz
calcurse-cf1565648bde10103b1aae14a253b3e13bb380db.zip
ui-calendar: Use scroll window implementation
Make use of the generic scroll window implementation for the calendar view. Note that this is useful despite the panel not needing a scroll bar, since the scroll window functions can be used to draw the panel border and take care of relative positions. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/wins.c')
-rw-r--r--src/wins.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/wins.c b/src/wins.c
index 30d6529..a690fe2 100644
--- a/src/wins.c
+++ b/src/wins.c
@@ -50,6 +50,7 @@
/* Variables to handle calcurse windows. */
struct window win[NBWINS];
+struct scrollwin sw_cal;
struct listbox lb_todo;
/* User-configurable side bar width. */
@@ -243,9 +244,9 @@ void wins_slctd_next(void)
static void wins_init_panels(void)
{
- win[CAL].p = newwin(CALHEIGHT + (conf.compact_panels ? 2 : 4),
- wins_sbar_width(), win[CAL].y, win[CAL].x);
- wins_show(win[CAL].p, _("Calendar"));
+ wins_scrollwin_init(&sw_cal, win[CAL].y, win[CAL].x,
+ CALHEIGHT + (conf.compact_panels ? 2 : 4),
+ wins_sbar_width(), _("Calendar"));
win[APP].p =
newwin(win[APP].h, win[APP].w, win[APP].y, win[APP].x);
@@ -258,7 +259,6 @@ static void wins_init_panels(void)
ui_todo_load_items();
/* Enable function keys (i.e. arrow keys) in those windows */
- keypad(win[CAL].p, TRUE);
keypad(win[APP].p, TRUE);
}
@@ -400,7 +400,7 @@ void wins_scrollwin_ensure_visible(struct scrollwin *sw, unsigned line)
void wins_reinit_panels(void)
{
- delwin(win[CAL].p);
+ wins_scrollwin_delete(&sw_cal);
delwin(win[APP].p);
delwin(apad.ptrwin);
listbox_delete(&lb_todo);
@@ -414,7 +414,7 @@ void wins_reinit_panels(void)
*/
void wins_reinit(void)
{
- delwin(win[CAL].p);
+ wins_scrollwin_delete(&sw_cal);
delwin(win[APP].p);
delwin(apad.ptrwin);
listbox_delete(&lb_todo);
@@ -544,10 +544,7 @@ void wins_update_border(int flags)
{
if (flags & FLAG_CAL) {
WINS_CALENDAR_LOCK;
- if (slctd_win == CAL)
- border_color(win[CAL].p);
- else
- border_nocolor(win[CAL].p);
+ wins_scrollwin_draw_deco(&sw_cal, (slctd_win == CAL));
WINS_CALENDAR_UNLOCK;
}
if (flags & FLAG_APP) {
@@ -567,7 +564,7 @@ void wins_update_panels(int flags)
if (flags & FLAG_TOD)
ui_todo_update_panel(slctd_win);
if (flags & FLAG_CAL)
- ui_calendar_update_panel(&win[CAL]);
+ ui_calendar_update_panel();
}
/*