1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jonathan Gordon 2010-06-07 11:45:02 +00:00
parent 4c040943bb
commit fe72cbe6ac

View file

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