FS#2580 - Support for conditional images.

Attached to Project: Rockbox
Opened by Dave Wiard (sithia) - Thursday, 14 July 2005, 05:06 GMT
Last edited by Linus Nielsen Feltzing (linusnielsen) - Thursday, 01 September 2005, 08:21 GMT
Task Type Patches
Category Themes
Status Closed
Assigned To No-one
Operating System
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


First crack at support for conditional images. Images
are loaded using %xl|n|filename.bmp|x|y| and displayed
with %xdn (where "n" is the image sequence number). %xl
can appear in the WPS after the %xd and still work just
This task depends upon

Closed by  Linus Nielsen Feltzing (linusnielsen)
Thursday, 01 September 2005, 08:21 GMT
Reason for closing:  Accepted
Additional comments about closing:  Logged In: YES

Thanks, I have applied the patch, with some changes.
Comment by Linus Nielsen Feltzing (linusnielsen) - Wednesday, 24 August 2005, 09:04 GMT

This is a good idea. I have a few suggestions that would
make it better, and I would also like to merge this patch
into CVS soonish, so we can include it in the 2.5 release.
It is certainly a bug that the wps can't have conditional

1) Keep the file name in the img struct and use that to
prevent the same BMP from being loaded twice, but instead
set the ptr to the already loaded bitmap. That way we can
have the same bitmap in several places without loading it twice.

2) Use a-z instead of 0-9 for the sequence numbers

3) Double the size of the bitmap buffer

The optimal solution for issue (1) would probably be to have
the coordinates in the %xd tag, but that may be a problem
for the parser.
Comment by Dave Wiard (sithia) - Friday, 26 August 2005, 03:47 GMT

I have a little time this week. I'm working out how to
reincorporate this into wps-display.c and I've got a couple

2) Using a-z is a bit overkill, don't you think? There are
only 10 slots in img (hence 0-9). MAX_IMAGES is currently 10.

You are correct about the parser having some problems with
the coordinates being housed with the display tag. Unless,
of course, we used a different separator character (like
','). I also think it's better to go with the display tag
but unless the conditionals are updated to handle the extra
'|' or a different separator is used I don't see how it can
Comment by Daniel Stenberg (bagder) - Friday, 26 August 2005, 04:46 GMT

The limitation of 10 isn't as sensible any more when you
start to use a new slot each time you position the same
picture on a new place. Thus it makes sense to extend the
MAX_IMAGES and if so, you need to support something else
than just 0-9...

Let's keep the display tag as you did it, as then this
should work fine with conditionals. Even with the upcoming
"enum conditonals" where you can set different things
depending on an enum (0,1,2,3, etc).
Comment by Linus Nielsen Feltzing (linusnielsen) - Thursday, 01 September 2005, 08:21 GMT

Thanks, I have applied the patch, with some changes.