summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/list.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 9de705dcbc..86de0ae312 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -55,7 +55,7 @@ static int offset_step = 16; /* pixels per screen scroll step */
55/* should lines scroll out of the screen */ 55/* should lines scroll out of the screen */
56static bool offset_out_of_view = false; 56static bool offset_out_of_view = false;
57#endif 57#endif
58static struct gui_synclist* last_list_displayed; 58static int force_list_reinit = false;
59 59
60static void gui_list_select_at_offset(struct gui_synclist * gui_list, 60static void gui_list_select_at_offset(struct gui_synclist * gui_list,
61 int offset); 61 int offset);
@@ -72,6 +72,7 @@ void list_init_viewports(void)
72 vp = &parent[i]; 72 vp = &parent[i];
73 viewport_set_defaults(vp, i); 73 viewport_set_defaults(vp, i);
74 } 74 }
75 force_list_reinit = false;
75} 76}
76#else 77#else
77static struct viewport parent[NB_SCREENS] = 78static struct viewport parent[NB_SCREENS] =
@@ -145,6 +146,7 @@ void gui_synclist_init(struct gui_synclist * gui_list,
145 gui_list->title_color = -1; 146 gui_list->title_color = -1;
146 gui_list->callback_get_item_color = NULL; 147 gui_list->callback_get_item_color = NULL;
147#endif 148#endif
149 force_list_reinit = true;
148} 150}
149 151
150/* this toggles the selection bar or cursor */ 152/* this toggles the selection bar or cursor */
@@ -194,16 +196,29 @@ int gui_list_get_item_offset(struct gui_synclist * gui_list, int item_width,
194void gui_synclist_draw(struct gui_synclist *gui_list) 196void gui_synclist_draw(struct gui_synclist *gui_list)
195{ 197{
196 int i; 198 int i;
197 FOR_NB_SCREENS(i) 199 static struct gui_synclist *last_list = NULL;
200 static int last_count = -1;
201#ifdef HAS_BUTTONBAR
202 static bool last_buttonbar = false;
203#endif
204
205 if (force_list_reinit ||
206#ifdef HAS_BUTTONBAR
207 last_buttonbar != screens[SCREEN_MAIN].has_buttonbar ||
208#endif
209 last_list != gui_list ||
210 gui_list->nb_items != last_count)
198 { 211 {
199 last_list_displayed = NULL; 212 list_init_viewports();
200 /* quick hack to fix the recorder overwriting the button bar.. 213 force_list_reinit = false;
201 TODO: fix properly */ 214 }
202 gui_list->parent[i]->height = screens[i].height - gui_list->parent[i]->y
203#ifdef HAS_BUTTONBAR 215#ifdef HAS_BUTTONBAR
204 - (screens[i].has_buttonbar?BUTTONBAR_HEIGHT:0) 216 last_buttonbar = screens[SCREEN_MAIN].has_buttonbar;
205#endif 217#endif
206 ; 218 last_count = gui_list->nb_items;
219 last_list = gui_list;
220 FOR_NB_SCREENS(i)
221 {
207 list_draw(&screens[i], gui_list->parent[i], gui_list); 222 list_draw(&screens[i], gui_list->parent[i], gui_list);
208 } 223 }
209} 224}
@@ -401,6 +416,7 @@ void gui_synclist_set_title(struct gui_synclist * gui_list,
401 } else { 416 } else {
402 gui_list->title_width = 0; 417 gui_list->title_width = 0;
403 } 418 }
419 force_list_reinit = true;
404} 420}
405 421
406 422