summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-06-07 11:45:02 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-06-07 11:45:02 +0000
commitfe72cbe6accbffe394d012974d7ccae299d22d8c (patch)
tree640dce65f5a92255f0843407931f7adcf93e3084
parent4c040943bbd7f3416667f1f28dd6aa6e58295c3d (diff)
downloadrockbox-fe72cbe6accbffe394d012974d7ccae299d22d8c.tar.gz
rockbox-fe72cbe6accbffe394d012974d7ccae299d22d8c.tar.bz2
rockbox-fe72cbe6accbffe394d012974d7ccae299d22d8c.zip
Fix FS#11370 - BEWARE when useing viewport colours.
%Vf() and %Vb() need to be straight after the %V() or else the colours wont be set on the viewport (but on the line instead). This means scrolling lines dont work. To make sure the colours are used for the whole viewport dont leave any gaps between %V and %Vf/%Vb. (of course, if you want a single line to be a different colour then use the %Vf as normal. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26656 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/skin_engine/skin_parser.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index ece172e1de..45500c5408 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -1026,6 +1026,8 @@ static int parse_viewportcolour(const char *wps_bufptr,
{
(void)wps_data;
const char *ptr = wps_bufptr;
+ int i;
+ bool found_text;
struct viewport_colour *colour = skin_buffer_alloc(sizeof(struct viewport_colour));
uint32_t set;
if (*ptr != '(' || !colour)
@@ -1040,6 +1042,31 @@ static int parse_viewportcolour(const char *wps_bufptr,
token->type == WPS_TOKEN_VIEWPORT_FGCOLOUR);
colour->vp = &curr_vp->vp;
token->value.data = colour;
+ /* If there havnt been any text tags between the %V() line and here use
+ * the colour as the viewport colour. fixes scrolling lines not
+ * having the correct colour */
+ i = curr_vp->lines->sublines.first_token_idx;
+ found_text = false;
+ while (!found_text && i< curr_vp->lines->sublines.last_token_idx)
+ {
+ if (wps_data->tokens[i++].type != WPS_TOKEN_CHARACTER &&
+ wps_data->tokens[i++].type != WPS_TOKEN_VIEWPORT_FGCOLOUR &&
+ wps_data->tokens[i++].type != WPS_TOKEN_VIEWPORT_BGCOLOUR )
+ found_text = true;
+ }
+ if (!found_text)
+ {
+ if (token->type == WPS_TOKEN_VIEWPORT_FGCOLOUR)
+ {
+ curr_vp->start_fgcolour = colour->colour;
+ curr_vp->vp.fg_pattern = colour->colour;
+ }
+ else
+ {
+ curr_vp->start_bgcolour = colour->colour;
+ curr_vp->vp.bg_pattern = colour->colour;
+ }
+ }
ptr++;
return ptr - wps_bufptr;
}