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
This commit is contained in:
Jonathan Gordon 2009-09-18 05:15:18 +00:00
parent 7337fd332f
commit aafeaad65f
3 changed files with 24 additions and 15 deletions

View file

@ -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 */

View file

@ -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;
}

View file

@ -318,13 +318,16 @@ const char *get_token_value(struct gui_wps *gwps,
return id3->comment;
#ifdef HAVE_ALBUMART
case WPS_TOKEN_ALBUMART_FOUND:
if (data->albumart && audio_current_aa_hid() >= 0) {
return "C";
}
return NULL;
case WPS_TOKEN_ALBUMART_DISPLAY:
if (!data->albumart)
return NULL;
if (audio_current_aa_hid() >= 0) {
return "C";
}
data->albumart->draw = false;
data->albumart->draw = true;
return NULL;
#endif