From 18a8e529b5d14413dce83cdb9103f3426db10708 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 16 Aug 2009 18:23:00 +0000 Subject: 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 --- apps/gui/skin_engine/wps_internals.h | 201 ++--------------------------------- 1 file changed, 10 insertions(+), 191 deletions(-) (limited to 'apps/gui/skin_engine/wps_internals.h') 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 @@ #define TIMEOUT_UNIT (HZ/10) /* I.e. 0.1 sec */ #define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */ - +#include "skin_tokens.h" /* TODO: sort this mess out */ @@ -77,6 +77,7 @@ #ifdef HAVE_LCD_BITMAP struct gui_img { + short int id; struct bitmap bm; struct viewport* vp; /* The viewport to display this image in */ short int x; /* x-pos */ @@ -88,6 +89,7 @@ struct gui_img { bool always_display; /* not using the preload/display mechanism */ }; + struct progressbar { /* regular pb */ short x; @@ -153,187 +155,6 @@ enum wps_parse_error { PARSE_FAIL_LIMITS_EXCEEDED, }; -enum wps_token_type { - WPS_NO_TOKEN, /* for WPS tags we don't want to save as tokens */ - WPS_TOKEN_UNKNOWN, - - /* Markers */ - WPS_TOKEN_CHARACTER, - WPS_TOKEN_STRING, - - /* Alignment */ - WPS_TOKEN_ALIGN_LEFT, - WPS_TOKEN_ALIGN_CENTER, - WPS_TOKEN_ALIGN_RIGHT, - - /* Sublines */ - WPS_TOKEN_SUBLINE_TIMEOUT, - - /* Battery */ - WPS_TOKEN_BATTERY_PERCENT, - WPS_TOKEN_BATTERY_VOLTS, - WPS_TOKEN_BATTERY_TIME, - WPS_TOKEN_BATTERY_CHARGER_CONNECTED, - WPS_TOKEN_BATTERY_CHARGING, - WPS_TOKEN_BATTERY_SLEEPTIME, - - /* Sound */ -#if (CONFIG_CODEC != MAS3507D) - WPS_TOKEN_SOUND_PITCH, -#endif -#if (CONFIG_CODEC == SWCODEC) - WPS_TOKEN_REPLAYGAIN, - WPS_TOKEN_CROSSFADE, -#endif - - /* Time */ - - WPS_TOKEN_RTC_PRESENT, - - /* The begin/end values allow us to know if a token is an RTC one. - New RTC tokens should be added between the markers. */ - - WPS_TOKENS_RTC_BEGIN, /* just the start marker, not an actual token */ - - WPS_TOKEN_RTC_DAY_OF_MONTH, - WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED, - WPS_TOKEN_RTC_12HOUR_CFG, - WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED, - WPS_TOKEN_RTC_HOUR_24, - WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED, - WPS_TOKEN_RTC_HOUR_12, - WPS_TOKEN_RTC_MONTH, - WPS_TOKEN_RTC_MINUTE, - WPS_TOKEN_RTC_SECOND, - WPS_TOKEN_RTC_YEAR_2_DIGITS, - WPS_TOKEN_RTC_YEAR_4_DIGITS, - WPS_TOKEN_RTC_AM_PM_UPPER, - WPS_TOKEN_RTC_AM_PM_LOWER, - WPS_TOKEN_RTC_WEEKDAY_NAME, - WPS_TOKEN_RTC_MONTH_NAME, - WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON, - WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN, - - WPS_TOKENS_RTC_END, /* just the end marker, not an actual token */ - - /* Conditional */ - WPS_TOKEN_CONDITIONAL, - WPS_TOKEN_CONDITIONAL_START, - WPS_TOKEN_CONDITIONAL_OPTION, - WPS_TOKEN_CONDITIONAL_END, - - /* Database */ -#ifdef HAVE_TAGCACHE - WPS_TOKEN_DATABASE_PLAYCOUNT, - WPS_TOKEN_DATABASE_RATING, - WPS_TOKEN_DATABASE_AUTOSCORE, -#endif - - /* File */ - WPS_TOKEN_FILE_BITRATE, - WPS_TOKEN_FILE_CODEC, - WPS_TOKEN_FILE_FREQUENCY, - WPS_TOKEN_FILE_FREQUENCY_KHZ, - WPS_TOKEN_FILE_NAME, - WPS_TOKEN_FILE_NAME_WITH_EXTENSION, - WPS_TOKEN_FILE_PATH, - WPS_TOKEN_FILE_SIZE, - WPS_TOKEN_FILE_VBR, - WPS_TOKEN_FILE_DIRECTORY, - -#ifdef HAVE_LCD_BITMAP - /* Image */ - WPS_TOKEN_IMAGE_BACKDROP, - WPS_TOKEN_IMAGE_PROGRESS_BAR, - WPS_TOKEN_IMAGE_PRELOAD, - WPS_TOKEN_IMAGE_PRELOAD_DISPLAY, - WPS_TOKEN_IMAGE_DISPLAY, -#endif - -#ifdef HAVE_ALBUMART - /* Albumart */ - WPS_TOKEN_ALBUMART_DISPLAY, - WPS_TOKEN_ALBUMART_FOUND, -#endif - - /* Metadata */ - WPS_TOKEN_METADATA_ARTIST, - WPS_TOKEN_METADATA_COMPOSER, - WPS_TOKEN_METADATA_ALBUM_ARTIST, - WPS_TOKEN_METADATA_GROUPING, - WPS_TOKEN_METADATA_ALBUM, - WPS_TOKEN_METADATA_GENRE, - WPS_TOKEN_METADATA_DISC_NUMBER, - WPS_TOKEN_METADATA_TRACK_NUMBER, - WPS_TOKEN_METADATA_TRACK_TITLE, - WPS_TOKEN_METADATA_VERSION, - WPS_TOKEN_METADATA_YEAR, - WPS_TOKEN_METADATA_COMMENT, - - /* Mode */ - WPS_TOKEN_REPEAT_MODE, - WPS_TOKEN_PLAYBACK_STATUS, - - WPS_TOKEN_MAIN_HOLD, - -#ifdef HAS_REMOTE_BUTTON_HOLD - WPS_TOKEN_REMOTE_HOLD, -#endif - - /* Progressbar */ - WPS_TOKEN_PROGRESSBAR, -#ifdef HAVE_LCD_CHARCELLS - WPS_TOKEN_PLAYER_PROGRESSBAR, -#endif - -#ifdef HAVE_LCD_BITMAP - /* Peakmeter */ - WPS_TOKEN_PEAKMETER, -#endif - - /* Volume level */ - WPS_TOKEN_VOLUME, - - /* Current track */ - WPS_TOKEN_TRACK_ELAPSED_PERCENT, - WPS_TOKEN_TRACK_TIME_ELAPSED, - WPS_TOKEN_TRACK_TIME_REMAINING, - WPS_TOKEN_TRACK_LENGTH, - - /* Playlist */ - WPS_TOKEN_PLAYLIST_ENTRIES, - WPS_TOKEN_PLAYLIST_NAME, - WPS_TOKEN_PLAYLIST_POSITION, - WPS_TOKEN_PLAYLIST_SHUFFLE, - -#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) - /* Virtual LED */ - WPS_TOKEN_VLED_HDD, -#endif - - /* Viewport display */ - WPS_VIEWPORT_ENABLE, - - /* buttons */ - WPS_TOKEN_BUTTON_VOLUME, - WPS_TOKEN_LASTTOUCH, - - /* Setting option */ - WPS_TOKEN_SETTING, -}; - -struct wps_token { - unsigned char type; /* enough to store the token type */ - - /* Whether the tag (e.g. track name or the album) refers the - current or the next song (false=current, true=next) */ - bool next; - - union { - char c; - unsigned short i; - } value; -}; /* Description of a subline on the WPS */ struct wps_subline { @@ -406,15 +227,11 @@ struct touchregion { struct wps_data { #ifdef HAVE_LCD_BITMAP - struct gui_img img[MAX_IMAGES]; - unsigned char img_buf[IMG_BUFSIZE]; - unsigned char* img_buf_ptr; - int img_buf_free; bool wps_sb_tag; bool show_sb_on_wps; - struct progressbar progressbar[MAX_PROGRESSBARS]; - short progressbar_count; + struct skin_token_list *images; + struct skin_token_list *progressbars; bool peak_meter_enabled; @@ -465,9 +282,7 @@ struct wps_data int num_tokens; struct wps_token tokens[WPS_MAX_TOKENS]; - char string_buffer[STRING_BUFFER_SIZE]; - char *strings[WPS_MAX_STRINGS]; - int num_strings; + struct skin_token_list *strings; bool wps_loaded; @@ -533,4 +348,8 @@ const char *get_token_value(struct gui_wps *gwps, char *buf, int buf_size, int *intval); + + +struct gui_img* find_image(int n, struct wps_data *data); + #endif -- cgit v1.2.3