From 885283c424066e25faf691b604efb84b89145d71 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 9 Mar 2008 09:37:39 +0000 Subject: more fixes for button bar... this will all disappear when viewports are handled by a manager of some sort git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16589 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/list.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'apps/gui') 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 */ /* should lines scroll out of the screen */ static bool offset_out_of_view = false; #endif -static struct gui_synclist* last_list_displayed; +static int force_list_reinit = false; static void gui_list_select_at_offset(struct gui_synclist * gui_list, int offset); @@ -72,6 +72,7 @@ void list_init_viewports(void) vp = &parent[i]; viewport_set_defaults(vp, i); } + force_list_reinit = false; } #else static struct viewport parent[NB_SCREENS] = @@ -145,6 +146,7 @@ void gui_synclist_init(struct gui_synclist * gui_list, gui_list->title_color = -1; gui_list->callback_get_item_color = NULL; #endif + force_list_reinit = true; } /* 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, void gui_synclist_draw(struct gui_synclist *gui_list) { int i; - FOR_NB_SCREENS(i) + static struct gui_synclist *last_list = NULL; + static int last_count = -1; +#ifdef HAS_BUTTONBAR + static bool last_buttonbar = false; +#endif + + if (force_list_reinit || +#ifdef HAS_BUTTONBAR + last_buttonbar != screens[SCREEN_MAIN].has_buttonbar || +#endif + last_list != gui_list || + gui_list->nb_items != last_count) { - last_list_displayed = NULL; - /* quick hack to fix the recorder overwriting the button bar.. - TODO: fix properly */ - gui_list->parent[i]->height = screens[i].height - gui_list->parent[i]->y + list_init_viewports(); + force_list_reinit = false; + } #ifdef HAS_BUTTONBAR - - (screens[i].has_buttonbar?BUTTONBAR_HEIGHT:0) + last_buttonbar = screens[SCREEN_MAIN].has_buttonbar; #endif - ; + last_count = gui_list->nb_items; + last_list = gui_list; + FOR_NB_SCREENS(i) + { list_draw(&screens[i], gui_list->parent[i], gui_list); } } @@ -401,6 +416,7 @@ void gui_synclist_set_title(struct gui_synclist * gui_list, } else { gui_list->title_width = 0; } + force_list_reinit = true; } -- cgit v1.2.3