From 02a246b0d723255166c879ccd599c5787f4a9991 Mon Sep 17 00:00:00 2001 From: kugel Date: Sun, 1 Nov 2009 15:48:31 +0000 Subject: [PATCH] Move find_viewport() and find_image() to skin_parser.c where the reset of the linked-list handling sits. That enables removing duplicated code from checkwps. Also remove a few stubs in favor having the restart playback mechanism on albumart change #ifdef __PCTOOL__ git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23465 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/backdrop.h | 5 +-- apps/gui/skin_engine/skin_display.c | 28 -------------- apps/gui/skin_engine/skin_parser.c | 34 ++++++++++++++++- tools/checkwps/checkwps.c | 76 ------------------------------------- 4 files changed, 35 insertions(+), 108 deletions(-) diff --git a/apps/gui/backdrop.h b/apps/gui/backdrop.h index 9281cc404..b37071b5d 100644 --- a/apps/gui/backdrop.h +++ b/apps/gui/backdrop.h @@ -36,10 +36,9 @@ bool backdrop_load(enum backdrop_type bdrop, const char*); void backdrop_unload(enum backdrop_type bdrop); void backdrop_show(enum backdrop_type bdrop); -#else /* LCD_DEPTH > 1 */ +#else /* LCD_DEPTH <= 1 || __PCTOOL__ */ -static inline -bool backdrop_load(enum backdrop_type bdrop, const char* filename) +static inline bool backdrop_load(enum backdrop_type bdrop, const char* filename) { (void)filename; (void)bdrop; return true; } diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 743f1b7a3..51f86e568 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -489,34 +489,6 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index) return true; } -#ifdef HAVE_LCD_BITMAP -struct gui_img* find_image(char label, struct wps_data *data) -{ - struct skin_token_list *list = data->images; - while (list) - { - struct gui_img *img = (struct gui_img *)list->token->value.data; - if (img->label == label) - return img; - list = list->next; - } - return NULL; -} -#endif - -struct skin_viewport* find_viewport(char label, struct wps_data *data) -{ - struct skin_token_list *list = data->viewports; - while (list) - { - struct skin_viewport *vp = (struct skin_viewport *)list->token->value.data; - if (vp->label == label) - return vp; - list = list->next; - } - return NULL; -} - /* Read a (sub)line to the given alignment format buffer. linebuf is the buffer where the data is actually stored. diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 7f6e80d10..c05ebca45 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -381,6 +381,38 @@ static void add_to_ll_chain(struct skin_token_list **list, struct skin_token_lis t->next = item; } } + +/* traverse the image linked-list for an image */ +#ifdef HAVE_LCD_BITMAP +struct gui_img* find_image(char label, struct wps_data *data) +{ + struct skin_token_list *list = data->images; + while (list) + { + struct gui_img *img = (struct gui_img *)list->token->value.data; + if (img->label == label) + return img; + list = list->next; + } + return NULL; +} +#endif + +/* traverse the viewport linked list for a viewport */ +struct skin_viewport* find_viewport(char label, struct wps_data *data) +{ + struct skin_token_list *list = data->viewports; + while (list) + { + struct skin_viewport *vp = (struct skin_viewport *)list->token->value.data; + if (vp->label == label) + return vp; + list = list->next; + } + return NULL; +} + + /* create and init a new wpsll item. * passing NULL to token will alloc a new one. * You should only pass NULL for the token when the token type (table above) @@ -1841,7 +1873,7 @@ bool skin_data_load(struct wps_data *wps_data, return false; } #endif -#ifdef HAVE_ALBUMART +#if defined(HAVE_ALBUMART) && !defined(__PCTOOL__) status = audio_status(); if (status & AUDIO_STATUS_PLAY) { diff --git a/tools/checkwps/checkwps.c b/tools/checkwps/checkwps.c index d426394ea..b074457de 100644 --- a/tools/checkwps/checkwps.c +++ b/tools/checkwps/checkwps.c @@ -127,16 +127,6 @@ int read_line(int fd, char* buffer, int buffer_size) return errno ? -1 : num_read; } -bool load_wps_backdrop(const char* filename) -{ - return true; -} - -bool load_remote_wps_backdrop(const char* filename) -{ - return true; -} - int recalc_dimension(struct dim *dst, struct dim *src) { return 0; @@ -165,24 +155,6 @@ int resize_on_load(struct bitmap *bm, bool dither, return 0; } -int audio_status(void) -{ - return 0; -} - -struct mp3entry* audio_current_track(void) -{ - return NULL; -} - -void audio_stop(void) -{ -} - -void audio_play(long offset) -{ -} - static char pluginbuf[PLUGIN_BUFFER_SIZE]; static unsigned dummy_func2(void) @@ -259,54 +231,6 @@ void screen_clear_area(struct screen * display, int xstart, int ystart, } #endif -/* From skin_display.c */ -void skin_data_init(struct wps_data *wps_data) -{ -#ifdef HAVE_LCD_BITMAP - wps_data->wps_sb_tag = false; - wps_data->show_sb_on_wps = false; - wps_data->peak_meter_enabled = false; - wps_data->images = NULL; - wps_data->progressbars = NULL; - /* progress bars */ -#else /* HAVE_LCD_CHARCELLS */ - int i; - for (i = 0; i < 8; i++) - { - wps_data->wps_progress_pat[i] = 0; - } - wps_data->full_line_progressbar = false; -#endif - wps_data->wps_loaded = false; -} - -#ifdef HAVE_LCD_BITMAP -struct gui_img* find_image(char label, struct wps_data *data) -{ - struct skin_token_list *list = data->images; - while (list) - { - struct gui_img *img = (struct gui_img *)list->token->value.data; - if (img->label == label) - return img; - list = list->next; - } - return NULL; -} -#endif - -struct skin_viewport* find_viewport(char label, struct wps_data *data) -{ - struct skin_token_list *list = data->viewports; - while (list) - { - struct skin_viewport *vp = (struct skin_viewport *)list->token->value.data; - if (vp->label == label) - return vp; - list = list->next; - } - return NULL; -} int main(int argc, char **argv) { -- 2.11.4.GIT