From 52d79ac5b3482bfc064bb41e1c76fc9dcdf9a5c2 Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Fri, 20 Jul 2007 19:05:19 +0000 Subject: day_process_storage() added --- src/day.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/day.c b/src/day.c index 1f36337..bb8e8c3 100755 --- a/src/day.c +++ b/src/day.c @@ -1,4 +1,4 @@ -/* $calcurse: day.c,v 1.23 2007/07/01 17:52:45 culot Exp $ */ +/* $calcurse: day.c,v 1.24 2007/07/20 19:05:19 culot Exp $ */ /* * Calcurse - text-based organizer @@ -44,6 +44,41 @@ static struct day_item_s *day_items_ptr; static struct day_saved_item_s *day_saved_item = NULL; + +/* + * Store the events and appointments for the selected day, and write + * those items in a pad. If selected day is null, then store items for current + * day. This is useful to speed up the appointment panel update. + */ +day_items_nb_t * +day_process_storage(date_t *slctd_date, bool day_changed, day_items_nb_t *inday) +{ + long date; + date_t day; + + if (slctd_date) + day = *slctd_date; + else + calendar_store_current_date(&day); + + date = date2sec(day, 0, 0); + + /* Inits */ + if (apad->length != 0) + delwin(apad->ptrwin); + + /* Store the events and appointments (recursive and normal items). */ + apad->length = day_store_items(date, + &inday->nb_events, &inday->nb_apoints); + + /* Create the new pad with its new length. */ + if (day_changed) + apad->first_onscreen = 0; + apad->ptrwin = newpad(apad->length, apad->width); + + return (inday); +} + /* * Store all of the items to be displayed for the selected day. * Items are of four types: recursive events, normal events, -- cgit v1.2.3-70-g09d2