diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-03-09 09:37:39 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-03-09 09:37:39 +0000 |
commit | 885283c424066e25faf691b604efb84b89145d71 (patch) | |
tree | cb58bca4692c6dce9b09d7ec8cd9d687cfdf366c /apps | |
parent | d78521af47c85af9ca9b987bf5803878f1f52326 (diff) | |
download | rockbox-885283c424066e25faf691b604efb84b89145d71.tar.gz rockbox-885283c424066e25faf691b604efb84b89145d71.zip |
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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/list.c | 32 |
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 */ |
56 | static bool offset_out_of_view = false; | 56 | static bool offset_out_of_view = false; |
57 | #endif | 57 | #endif |
58 | static struct gui_synclist* last_list_displayed; | 58 | static int force_list_reinit = false; |
59 | 59 | ||
60 | static void gui_list_select_at_offset(struct gui_synclist * gui_list, | 60 | static 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 |
77 | static struct viewport parent[NB_SCREENS] = | 78 | static 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, | |||
194 | void gui_synclist_draw(struct gui_synclist *gui_list) | 196 | void 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 | ||