diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2009-12-09 07:25:46 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2009-12-09 07:25:46 +0000 |
commit | b2eb44ce0eb24632a46b0ea8c8c46a8f2ba35e24 (patch) | |
tree | ff3c0e14e9a53c08749ee1f233a5b1e887d3561a /apps/gui/statusbar-skinned.c | |
parent | 85aad9b3972208b0e34ba0241ebb5314118ae05e (diff) | |
download | rockbox-b2eb44ce0eb24632a46b0ea8c8c46a8f2ba35e24.tar.gz rockbox-b2eb44ce0eb24632a46b0ea8c8c46a8f2ba35e24.zip |
FS#10824 - viewport/statusbar API rework.
Hopefully the only user visible changes are:
- fm and recording screens go by the statusbar setting (sbs or inbuilt)
- plugins go back to using the theme as they should for menus and lists
- splash screens might get cut a bit... entirely theme and splash dependant.. if there is a problematic one we can look at it later.
- hopefully nothing more than very minor screen flickerings... let me know exactly where they are so they can be fixed
New GUI screen rules:
* Screens assume that the theme (sbs+ui viewport+ maybe background image) are always enabled. They may be disabled on a per display basis, but MUST be re-enabled on exit
* Screens must not be coded in a way that requires a statusbar of any type.. the inbuilt bar will be removed shortly.
ALWAYS RESPECT THE USERS SETTINGS unless the screen requires the full display to fit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23904 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/statusbar-skinned.c')
-rw-r--r-- | apps/gui/statusbar-skinned.c | 97 |
1 files changed, 25 insertions, 72 deletions
diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c index 4ef739929a..8bdecef692 100644 --- a/apps/gui/statusbar-skinned.c +++ b/apps/gui/statusbar-skinned.c | |||
@@ -41,7 +41,7 @@ static struct wps_data sb_skin_data[NB_SCREENS] = {{ .wps_loaded = 0 }}; | |||
41 | static struct wps_sync_data sb_skin_sync_data = { .do_full_update = false }; | 41 | static struct wps_sync_data sb_skin_sync_data = { .do_full_update = false }; |
42 | 42 | ||
43 | /* initial setup of wps_data */ | 43 | /* initial setup of wps_data */ |
44 | static void sb_skin_update(void*); | 44 | |
45 | static bool loaded_ok[NB_SCREENS] = { false }; | 45 | static bool loaded_ok[NB_SCREENS] = { false }; |
46 | static int update_delay = DEFAULT_UPDATE_DELAY; | 46 | static int update_delay = DEFAULT_UPDATE_DELAY; |
47 | 47 | ||
@@ -68,9 +68,6 @@ void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile) | |||
68 | vp->hidden_flags = VP_NEVER_VISIBLE; | 68 | vp->hidden_flags = VP_NEVER_VISIBLE; |
69 | } | 69 | } |
70 | 70 | ||
71 | if (!success) | ||
72 | remove_event(GUI_EVENT_ACTIONUPDATE, sb_skin_update); | ||
73 | |||
74 | loaded_ok[screen] = success; | 71 | loaded_ok[screen] = success; |
75 | } | 72 | } |
76 | 73 | ||
@@ -96,7 +93,6 @@ struct viewport *sb_skin_get_info_vp(enum screen_type screen) | |||
96 | 93 | ||
97 | inline bool sb_skin_get_state(enum screen_type screen) | 94 | inline bool sb_skin_get_state(enum screen_type screen) |
98 | { | 95 | { |
99 | int skinbars = sb_skin[screen].sync_data->statusbars; | ||
100 | /* Temp fix untill the hardcoded bar is removed */ | 96 | /* Temp fix untill the hardcoded bar is removed */ |
101 | int bar_setting = global_settings.statusbar; | 97 | int bar_setting = global_settings.statusbar; |
102 | #if NB_SCREENS > 1 | 98 | #if NB_SCREENS > 1 |
@@ -106,87 +102,45 @@ inline bool sb_skin_get_state(enum screen_type screen) | |||
106 | switch (bar_setting) | 102 | switch (bar_setting) |
107 | { | 103 | { |
108 | case STATUSBAR_CUSTOM: | 104 | case STATUSBAR_CUSTOM: |
109 | return loaded_ok[screen] && (skinbars & VP_SB_ONSCREEN(screen)); | 105 | return loaded_ok[screen]; |
110 | case STATUSBAR_TOP: | 106 | case STATUSBAR_TOP: |
111 | case STATUSBAR_BOTTOM: | 107 | case STATUSBAR_BOTTOM: |
108 | return true; | ||
112 | case STATUSBAR_OFF: | 109 | case STATUSBAR_OFF: |
113 | return (viewportmanager_get_statusbar()&VP_SB_ONSCREEN(screen)); | 110 | return false; |
114 | } | 111 | } |
115 | return false; /* Should never actually get here */ | 112 | return false; /* Should never actually get here */ |
116 | } | 113 | } |
117 | 114 | ||
118 | 115 | void sb_skin_update(enum screen_type screen, bool force) | |
119 | static void do_update_callback(void *param) | ||
120 | { | ||
121 | (void)param; | ||
122 | /* the WPS handles changing the actual id3 data in the id3 pointers | ||
123 | * we imported, we just want a full update */ | ||
124 | sb_skin_sync_data.do_full_update = true; | ||
125 | /* force timeout in wps main loop, so that the update is instantly */ | ||
126 | queue_post(&button_queue, BUTTON_NONE, 0); | ||
127 | } | ||
128 | |||
129 | |||
130 | void sb_skin_set_state(int state, enum screen_type screen) | ||
131 | { | ||
132 | sb_skin[screen].sync_data->do_full_update = true; | ||
133 | int skinbars = sb_skin[screen].sync_data->statusbars; | ||
134 | if (state && loaded_ok[screen]) | ||
135 | { | ||
136 | skinbars |= VP_SB_ONSCREEN(screen); | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | skinbars &= ~VP_SB_ONSCREEN(screen); | ||
141 | } | ||
142 | |||
143 | if (skinbars) | ||
144 | { | ||
145 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
146 | add_event(LCD_EVENT_ACTIVATION, false, do_update_callback); | ||
147 | #endif | ||
148 | add_event(PLAYBACK_EVENT_TRACK_CHANGE, false, | ||
149 | do_update_callback); | ||
150 | add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, false, | ||
151 | do_update_callback); | ||
152 | add_event(GUI_EVENT_ACTIONUPDATE, false, sb_skin_update); | ||
153 | } | ||
154 | else | ||
155 | { | ||
156 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
157 | remove_event(LCD_EVENT_ACTIVATION, do_update_callback); | ||
158 | #endif | ||
159 | remove_event(PLAYBACK_EVENT_TRACK_CHANGE, do_update_callback); | ||
160 | remove_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, do_update_callback); | ||
161 | remove_event(GUI_EVENT_ACTIONUPDATE, sb_skin_update); | ||
162 | } | ||
163 | |||
164 | sb_skin[screen].sync_data->statusbars = skinbars; | ||
165 | } | ||
166 | |||
167 | static void sb_skin_update(void* param) | ||
168 | { | 116 | { |
169 | static long next_update = 0; | 117 | static long next_update = 0; |
170 | int i; | 118 | int i = screen; |
171 | int forced_draw = param || sb_skin[SCREEN_MAIN].sync_data->do_full_update; | 119 | if (TIME_AFTER(current_tick, next_update) || force) |
172 | if (TIME_AFTER(current_tick, next_update) || forced_draw) | ||
173 | { | 120 | { |
174 | FOR_NB_SCREENS(i) | 121 | if (sb_skin_get_state(i)) |
175 | { | 122 | { |
176 | if (sb_skin_get_state(i)) | ||
177 | { | ||
178 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 123 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
179 | /* currently, all remotes are readable without backlight | 124 | /* currently, all remotes are readable without backlight |
180 | * so still update those */ | 125 | * so still update those */ |
181 | if (lcd_active() || (i != SCREEN_MAIN)) | 126 | if (lcd_active() || (i != SCREEN_MAIN)) |
182 | #endif | 127 | #endif |
183 | skin_update(&sb_skin[i], forced_draw? | 128 | skin_update(&sb_skin[i], force? |
184 | WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC); | 129 | WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC); |
185 | } | ||
186 | } | 130 | } |
187 | next_update = current_tick + update_delay; /* don't update too often */ | ||
188 | sb_skin[SCREEN_MAIN].sync_data->do_full_update = false; | ||
189 | } | 131 | } |
132 | next_update = current_tick + update_delay; /* don't update too often */ | ||
133 | sb_skin[SCREEN_MAIN].sync_data->do_full_update = false; | ||
134 | } | ||
135 | |||
136 | void do_sbs_update_callback(void *param) | ||
137 | { | ||
138 | (void)param; | ||
139 | /* the WPS handles changing the actual id3 data in the id3 pointers | ||
140 | * we imported, we just want a full update */ | ||
141 | sb_skin_sync_data.do_full_update = true; | ||
142 | /* force timeout in wps main loop, so that the update is instantly */ | ||
143 | queue_post(&button_queue, BUTTON_NONE, 0); | ||
190 | } | 144 | } |
191 | 145 | ||
192 | void sb_skin_set_update_delay(int delay) | 146 | void sb_skin_set_update_delay(int delay) |
@@ -209,7 +163,6 @@ void sb_skin_init(void) | |||
209 | /* Currently no seperate wps_state needed/possible | 163 | /* Currently no seperate wps_state needed/possible |
210 | so use the only available ( "global" ) one */ | 164 | so use the only available ( "global" ) one */ |
211 | sb_skin[i].state = &wps_state; | 165 | sb_skin[i].state = &wps_state; |
212 | sb_skin_sync_data.statusbars = VP_SB_HIDE_ALL; | ||
213 | sb_skin[i].sync_data = &sb_skin_sync_data; | 166 | sb_skin[i].sync_data = &sb_skin_sync_data; |
214 | } | 167 | } |
215 | } | 168 | } |