From aafeaad65f3e3921cdb16e30098422f2afd84146 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Fri, 18 Sep 2009 05:15:18 +0000 Subject: fix FS#10599 and do r22721 a slightly better way. the %C tag is internally converted to a different token for display and conditional check. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22726 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_display.c | 15 +++++++-------- apps/gui/skin_engine/skin_parser.c | 11 +++++++++-- apps/gui/skin_engine/skin_tokens.c | 13 ++++++++----- 3 files changed, 24 insertions(+), 15 deletions(-) (limited to 'apps/gui/skin_engine') diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 762b7f78a6..e24ab66393 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -474,6 +474,13 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index) /* clear all pictures in the conditional and nested ones */ if (data->tokens[i].type == WPS_TOKEN_IMAGE_PRELOAD_DISPLAY) clear_image_pos(gwps, find_image(data->tokens[i].value.i&0xFF, gwps->data)); +#endif +#ifdef HAVE_ALBUMART + if (data->albumart && data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY) + { + draw_album_art(gwps, audio_current_aa_hid(), true); + data->albumart->draw = false; + } #endif } @@ -622,14 +629,6 @@ static bool get_line(struct gui_wps *gwps, } } break; -#ifdef HAVE_ALBUMART - case WPS_TOKEN_ALBUMART_DISPLAY: - if (data->albumart) - { - data->albumart->draw = true; - } - break; -#endif default: { /* get the value of the tag and copy it to the buffer */ diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 7d37e1972c..3717dadd48 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -1120,8 +1120,15 @@ static int parse_albumart_display(const char *wps_bufptr, struct wps_data *wps_data) { (void)wps_bufptr; - (void)token; - if (wps_data->albumart) + if (wps_data->num_tokens > 1) + { + struct wps_token *prev = token-1; + if (prev->type == WPS_TOKEN_CONDITIONAL) + { + token->type = WPS_TOKEN_ALBUMART_FOUND; + } + } + else if (wps_data->albumart) { wps_data->albumart->vp = &curr_vp->vp; } diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 6d4fef5ab5..94d8eb4dc6 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -318,13 +318,16 @@ const char *get_token_value(struct gui_wps *gwps, return id3->comment; #ifdef HAVE_ALBUMART - case WPS_TOKEN_ALBUMART_DISPLAY: - if (!data->albumart) - return NULL; - if (audio_current_aa_hid() >= 0) { + case WPS_TOKEN_ALBUMART_FOUND: + if (data->albumart && audio_current_aa_hid() >= 0) { return "C"; } - data->albumart->draw = false; + return NULL; + + case WPS_TOKEN_ALBUMART_DISPLAY: + if (!data->albumart) + return NULL; + data->albumart->draw = true; return NULL; #endif -- cgit v1.2.3