diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-04-19 08:43:42 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-04-19 08:43:42 +0000 |
commit | 58a0393154cfced92830fed1a78450761f30f3b9 (patch) | |
tree | 9f00c8b5779a0d045b5fdd860f0e995b2c593a90 | |
parent | 1cd1e66ed361d908b517d224aab6da0cc8693f1e (diff) |
2 quick fixes
1) fix %pv| where the | is for a conditional break and not for long form %pv
2) only draw bmp-bars if they are enabled (by a conditional or always on.)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25677 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 15 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 8 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 2 |
3 files changed, 24 insertions, 1 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 827d90c630..9cef12a690 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -608,6 +608,12 @@ 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, data)); + else if (data->tokens[i].type == WPS_TOKEN_VOLUMEBAR || + data->tokens[i].type == WPS_TOKEN_PROGRESSBAR) + { + struct progressbar *bar = (struct progressbar*)data->tokens[i].value.data; + bar->draw = false; + } #endif #ifdef HAVE_ALBUMART if (data->albumart && data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY) @@ -670,6 +676,13 @@ static bool get_line(struct gui_wps *gwps, break; #ifdef HAVE_LCD_BITMAP + case WPS_TOKEN_VOLUMEBAR: + case WPS_TOKEN_PROGRESSBAR: + { + struct progressbar *bar = (struct progressbar*)data->tokens[i].value.data; + bar->draw = true; + } + break; case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY: { char n = data->tokens[i].value.i & 0xFF; @@ -1255,7 +1268,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) while (bar) { struct progressbar *thisbar = (struct progressbar*)bar->token->value.data; - if (thisbar->vp == &skin_viewport->vp) + if (thisbar->vp == &skin_viewport->vp && thisbar->draw) { draw_progressbar(gwps, thisbar); } diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index cac3b381b7..93c5c73210 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -1158,6 +1158,7 @@ static int parse_progressbar(const char *wps_bufptr, pb->have_bitmap_pb = false; pb->bm.data = NULL; /* no bitmap specified */ pb->follow_lang_direction = follow_lang_direction > 0; + pb->draw = false; if (*wps_bufptr != '|') /* regular old style */ { @@ -1174,7 +1175,14 @@ static int parse_progressbar(const char *wps_bufptr, if (!(ptr = parse_list("sdddd", &set, '|', ptr, &filename, &x, &y, &width, &height))) + { + /* if we are in a conditional then we probably don't want to fail + * if the above doesnt work. so ASSume the | is breaking the conditional + * and move on. the next token will fail if this is incorrect */ + if (level > 0) + return 0; return WPS_ERROR_INVALID_PARAM; + } if (LIST_VALUE_PARSED(set, PB_FILENAME)) /* filename */ pb->bm.data = (char*)filename; diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index 954928085f..a014770017 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h @@ -105,6 +105,8 @@ struct progressbar { /*progressbar image*/ struct bitmap bm; bool have_bitmap_pb; + + bool draw; }; #endif |