diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2009-08-16 18:23:00 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2009-08-16 18:23:00 +0000 |
commit | 18a8e529b5d14413dce83cdb9103f3426db10708 (patch) | |
tree | 5ac9e53a987b6a48c92281b32aba9b6ca9bcab08 /apps/gui/skin_engine/wps_internals.h | |
parent | eefe832785407c387e71aba476091e805eecc3f4 (diff) | |
download | rockbox-18a8e529b5d14413dce83cdb9103f3426db10708.tar.gz rockbox-18a8e529b5d14413dce83cdb9103f3426db10708.zip |
more wps->skin engine work..
start redoing memory management in the skins to use a single larger buffer instead of lots of arrays for things like images and progressbars.
This commit removes the limit on the amount of progressbars allowed on the screen, still 1 per viewport, but unlimited otherwise(!)
Also a larger buffer for remote targets, same size for non-remote targets but very easy to make it bigger (technically removed the 52(?) image limit in skins, except still limited to 1 char identifiers)
Unlimited "string" tokens now (limit was 1024 which was rediculously wasteful)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22350 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine/wps_internals.h')
-rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 201 |
1 files changed, 10 insertions, 191 deletions
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index ffebed7bad..bb68e578ab 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h | |||
@@ -31,7 +31,7 @@ | |||
31 | #define TIMEOUT_UNIT (HZ/10) /* I.e. 0.1 sec */ | 31 | #define TIMEOUT_UNIT (HZ/10) /* I.e. 0.1 sec */ |
32 | #define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */ | 32 | #define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */ |
33 | 33 | ||
34 | 34 | #include "skin_tokens.h" | |
35 | 35 | ||
36 | 36 | ||
37 | /* TODO: sort this mess out */ | 37 | /* TODO: sort this mess out */ |
@@ -77,6 +77,7 @@ | |||
77 | 77 | ||
78 | #ifdef HAVE_LCD_BITMAP | 78 | #ifdef HAVE_LCD_BITMAP |
79 | struct gui_img { | 79 | struct gui_img { |
80 | short int id; | ||
80 | struct bitmap bm; | 81 | struct bitmap bm; |
81 | struct viewport* vp; /* The viewport to display this image in */ | 82 | struct viewport* vp; /* The viewport to display this image in */ |
82 | short int x; /* x-pos */ | 83 | short int x; /* x-pos */ |
@@ -88,6 +89,7 @@ struct gui_img { | |||
88 | bool always_display; /* not using the preload/display mechanism */ | 89 | bool always_display; /* not using the preload/display mechanism */ |
89 | }; | 90 | }; |
90 | 91 | ||
92 | |||
91 | struct progressbar { | 93 | struct progressbar { |
92 | /* regular pb */ | 94 | /* regular pb */ |
93 | short x; | 95 | short x; |
@@ -153,187 +155,6 @@ enum wps_parse_error { | |||
153 | PARSE_FAIL_LIMITS_EXCEEDED, | 155 | PARSE_FAIL_LIMITS_EXCEEDED, |
154 | }; | 156 | }; |
155 | 157 | ||
156 | enum wps_token_type { | ||
157 | WPS_NO_TOKEN, /* for WPS tags we don't want to save as tokens */ | ||
158 | WPS_TOKEN_UNKNOWN, | ||
159 | |||
160 | /* Markers */ | ||
161 | WPS_TOKEN_CHARACTER, | ||
162 | WPS_TOKEN_STRING, | ||
163 | |||
164 | /* Alignment */ | ||
165 | WPS_TOKEN_ALIGN_LEFT, | ||
166 | WPS_TOKEN_ALIGN_CENTER, | ||
167 | WPS_TOKEN_ALIGN_RIGHT, | ||
168 | |||
169 | /* Sublines */ | ||
170 | WPS_TOKEN_SUBLINE_TIMEOUT, | ||
171 | |||
172 | /* Battery */ | ||
173 | WPS_TOKEN_BATTERY_PERCENT, | ||
174 | WPS_TOKEN_BATTERY_VOLTS, | ||
175 | WPS_TOKEN_BATTERY_TIME, | ||
176 | WPS_TOKEN_BATTERY_CHARGER_CONNECTED, | ||
177 | WPS_TOKEN_BATTERY_CHARGING, | ||
178 | WPS_TOKEN_BATTERY_SLEEPTIME, | ||
179 | |||
180 | /* Sound */ | ||
181 | #if (CONFIG_CODEC != MAS3507D) | ||
182 | WPS_TOKEN_SOUND_PITCH, | ||
183 | #endif | ||
184 | #if (CONFIG_CODEC == SWCODEC) | ||
185 | WPS_TOKEN_REPLAYGAIN, | ||
186 | WPS_TOKEN_CROSSFADE, | ||
187 | #endif | ||
188 | |||
189 | /* Time */ | ||
190 | |||
191 | WPS_TOKEN_RTC_PRESENT, | ||
192 | |||
193 | /* The begin/end values allow us to know if a token is an RTC one. | ||
194 | New RTC tokens should be added between the markers. */ | ||
195 | |||
196 | WPS_TOKENS_RTC_BEGIN, /* just the start marker, not an actual token */ | ||
197 | |||
198 | WPS_TOKEN_RTC_DAY_OF_MONTH, | ||
199 | WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED, | ||
200 | WPS_TOKEN_RTC_12HOUR_CFG, | ||
201 | WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED, | ||
202 | WPS_TOKEN_RTC_HOUR_24, | ||
203 | WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED, | ||
204 | WPS_TOKEN_RTC_HOUR_12, | ||
205 | WPS_TOKEN_RTC_MONTH, | ||
206 | WPS_TOKEN_RTC_MINUTE, | ||
207 | WPS_TOKEN_RTC_SECOND, | ||
208 | WPS_TOKEN_RTC_YEAR_2_DIGITS, | ||
209 | WPS_TOKEN_RTC_YEAR_4_DIGITS, | ||
210 | WPS_TOKEN_RTC_AM_PM_UPPER, | ||
211 | WPS_TOKEN_RTC_AM_PM_LOWER, | ||
212 | WPS_TOKEN_RTC_WEEKDAY_NAME, | ||
213 | WPS_TOKEN_RTC_MONTH_NAME, | ||
214 | WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON, | ||
215 | WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN, | ||
216 | |||
217 | WPS_TOKENS_RTC_END, /* just the end marker, not an actual token */ | ||
218 | |||
219 | /* Conditional */ | ||
220 | WPS_TOKEN_CONDITIONAL, | ||
221 | WPS_TOKEN_CONDITIONAL_START, | ||
222 | WPS_TOKEN_CONDITIONAL_OPTION, | ||
223 | WPS_TOKEN_CONDITIONAL_END, | ||
224 | |||
225 | /* Database */ | ||
226 | #ifdef HAVE_TAGCACHE | ||
227 | WPS_TOKEN_DATABASE_PLAYCOUNT, | ||
228 | WPS_TOKEN_DATABASE_RATING, | ||
229 | WPS_TOKEN_DATABASE_AUTOSCORE, | ||
230 | #endif | ||
231 | |||
232 | /* File */ | ||
233 | WPS_TOKEN_FILE_BITRATE, | ||
234 | WPS_TOKEN_FILE_CODEC, | ||
235 | WPS_TOKEN_FILE_FREQUENCY, | ||
236 | WPS_TOKEN_FILE_FREQUENCY_KHZ, | ||
237 | WPS_TOKEN_FILE_NAME, | ||
238 | WPS_TOKEN_FILE_NAME_WITH_EXTENSION, | ||
239 | WPS_TOKEN_FILE_PATH, | ||
240 | WPS_TOKEN_FILE_SIZE, | ||
241 | WPS_TOKEN_FILE_VBR, | ||
242 | WPS_TOKEN_FILE_DIRECTORY, | ||
243 | |||
244 | #ifdef HAVE_LCD_BITMAP | ||
245 | /* Image */ | ||
246 | WPS_TOKEN_IMAGE_BACKDROP, | ||
247 | WPS_TOKEN_IMAGE_PROGRESS_BAR, | ||
248 | WPS_TOKEN_IMAGE_PRELOAD, | ||
249 | WPS_TOKEN_IMAGE_PRELOAD_DISPLAY, | ||
250 | WPS_TOKEN_IMAGE_DISPLAY, | ||
251 | #endif | ||
252 | |||
253 | #ifdef HAVE_ALBUMART | ||
254 | /* Albumart */ | ||
255 | WPS_TOKEN_ALBUMART_DISPLAY, | ||
256 | WPS_TOKEN_ALBUMART_FOUND, | ||
257 | #endif | ||
258 | |||
259 | /* Metadata */ | ||
260 | WPS_TOKEN_METADATA_ARTIST, | ||
261 | WPS_TOKEN_METADATA_COMPOSER, | ||
262 | WPS_TOKEN_METADATA_ALBUM_ARTIST, | ||
263 | WPS_TOKEN_METADATA_GROUPING, | ||
264 | WPS_TOKEN_METADATA_ALBUM, | ||
265 | WPS_TOKEN_METADATA_GENRE, | ||
266 | WPS_TOKEN_METADATA_DISC_NUMBER, | ||
267 | WPS_TOKEN_METADATA_TRACK_NUMBER, | ||
268 | WPS_TOKEN_METADATA_TRACK_TITLE, | ||
269 | WPS_TOKEN_METADATA_VERSION, | ||
270 | WPS_TOKEN_METADATA_YEAR, | ||
271 | WPS_TOKEN_METADATA_COMMENT, | ||
272 | |||
273 | /* Mode */ | ||
274 | WPS_TOKEN_REPEAT_MODE, | ||
275 | WPS_TOKEN_PLAYBACK_STATUS, | ||
276 | |||
277 | WPS_TOKEN_MAIN_HOLD, | ||
278 | |||
279 | #ifdef HAS_REMOTE_BUTTON_HOLD | ||
280 | WPS_TOKEN_REMOTE_HOLD, | ||
281 | #endif | ||
282 | |||
283 | /* Progressbar */ | ||
284 | WPS_TOKEN_PROGRESSBAR, | ||
285 | #ifdef HAVE_LCD_CHARCELLS | ||
286 | WPS_TOKEN_PLAYER_PROGRESSBAR, | ||
287 | #endif | ||
288 | |||
289 | #ifdef HAVE_LCD_BITMAP | ||
290 | /* Peakmeter */ | ||
291 | WPS_TOKEN_PEAKMETER, | ||
292 | #endif | ||
293 | |||
294 | /* Volume level */ | ||
295 | WPS_TOKEN_VOLUME, | ||
296 | |||
297 | /* Current track */ | ||
298 | WPS_TOKEN_TRACK_ELAPSED_PERCENT, | ||
299 | WPS_TOKEN_TRACK_TIME_ELAPSED, | ||
300 | WPS_TOKEN_TRACK_TIME_REMAINING, | ||
301 | WPS_TOKEN_TRACK_LENGTH, | ||
302 | |||
303 | /* Playlist */ | ||
304 | WPS_TOKEN_PLAYLIST_ENTRIES, | ||
305 | WPS_TOKEN_PLAYLIST_NAME, | ||
306 | WPS_TOKEN_PLAYLIST_POSITION, | ||
307 | WPS_TOKEN_PLAYLIST_SHUFFLE, | ||
308 | |||
309 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | ||
310 | /* Virtual LED */ | ||
311 | WPS_TOKEN_VLED_HDD, | ||
312 | #endif | ||
313 | |||
314 | /* Viewport display */ | ||
315 | WPS_VIEWPORT_ENABLE, | ||
316 | |||
317 | /* buttons */ | ||
318 | WPS_TOKEN_BUTTON_VOLUME, | ||
319 | WPS_TOKEN_LASTTOUCH, | ||
320 | |||
321 | /* Setting option */ | ||
322 | WPS_TOKEN_SETTING, | ||
323 | }; | ||
324 | |||
325 | struct wps_token { | ||
326 | unsigned char type; /* enough to store the token type */ | ||
327 | |||
328 | /* Whether the tag (e.g. track name or the album) refers the | ||
329 | current or the next song (false=current, true=next) */ | ||
330 | bool next; | ||
331 | |||
332 | union { | ||
333 | char c; | ||
334 | unsigned short i; | ||
335 | } value; | ||
336 | }; | ||
337 | 158 | ||
338 | /* Description of a subline on the WPS */ | 159 | /* Description of a subline on the WPS */ |
339 | struct wps_subline { | 160 | struct wps_subline { |
@@ -406,15 +227,11 @@ struct touchregion { | |||
406 | struct wps_data | 227 | struct wps_data |
407 | { | 228 | { |
408 | #ifdef HAVE_LCD_BITMAP | 229 | #ifdef HAVE_LCD_BITMAP |
409 | struct gui_img img[MAX_IMAGES]; | ||
410 | unsigned char img_buf[IMG_BUFSIZE]; | ||
411 | unsigned char* img_buf_ptr; | ||
412 | int img_buf_free; | ||
413 | bool wps_sb_tag; | 230 | bool wps_sb_tag; |
414 | bool show_sb_on_wps; | 231 | bool show_sb_on_wps; |
415 | 232 | ||
416 | struct progressbar progressbar[MAX_PROGRESSBARS]; | 233 | struct skin_token_list *images; |
417 | short progressbar_count; | 234 | struct skin_token_list *progressbars; |
418 | 235 | ||
419 | bool peak_meter_enabled; | 236 | bool peak_meter_enabled; |
420 | 237 | ||
@@ -465,9 +282,7 @@ struct wps_data | |||
465 | int num_tokens; | 282 | int num_tokens; |
466 | struct wps_token tokens[WPS_MAX_TOKENS]; | 283 | struct wps_token tokens[WPS_MAX_TOKENS]; |
467 | 284 | ||
468 | char string_buffer[STRING_BUFFER_SIZE]; | 285 | struct skin_token_list *strings; |
469 | char *strings[WPS_MAX_STRINGS]; | ||
470 | int num_strings; | ||
471 | 286 | ||
472 | bool wps_loaded; | 287 | bool wps_loaded; |
473 | 288 | ||
@@ -533,4 +348,8 @@ const char *get_token_value(struct gui_wps *gwps, | |||
533 | char *buf, int buf_size, | 348 | char *buf, int buf_size, |
534 | int *intval); | 349 | int *intval); |
535 | 350 | ||
351 | |||
352 | |||
353 | struct gui_img* find_image(int n, struct wps_data *data); | ||
354 | |||
536 | #endif | 355 | #endif |