Theme Editor: Updated rendering code to accomodate new format for %xd tags, including long names, numerical tile specification, tag-evaluating tile specification, and tile offset

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29107 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Bieber 2011-01-22 08:45:59 +00:00
parent 30b29f1866
commit 5729be4017
2 changed files with 63 additions and 9 deletions

View file

@ -47,6 +47,11 @@ public:
currentTile = tiles -1;
}
int numTiles()
{
return tiles;
}
void enableMovement()
{
setFlag(ItemSendsGeometryChanges, true);

View file

@ -747,8 +747,33 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport)
{
case 'd':
/* %xd */
/* Breaking up into cases, getting the id first */
if(element->params_count == 1)
{
/* The old fashioned style */
id = "";
id.append(element->params[0].data.text[0]);
}
else
{
id = QString(element->params[0].data.text);
}
if(info.screen()->getImage(id))
{
/* Fetching the image if available */
image = new RBImage(*(info.screen()->getImage(id)), viewport);
}
else
{
image = 0;
}
/* Now determining the particular tile to load */
if(element->params_count == 1)
{
c = element->params[0].data.text[1];
if(c == '\0')
@ -763,9 +788,33 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport)
tile = c - 'a';
}
if(info.screen()->getImage(id))
}else{
/* If the next param is just an int, use it as the tile */
if(element->params[1].type == skin_tag_parameter::INTEGER)
{
tile = element->params[1].data.number - 1;
}
else
{
tile = children[1]->evalTag(info, true,
image->numTiles()).toInt();
/* Adding the offset if there is one */
if(element->params_count == 3)
tile += element->params[2].data.number;
if(tile < 0)
{
/* If there is no image for the current status, then
* just refrain from showing anything
*/
delete image;
return true;
}
}
}
if(image)
{
image = new RBImage(*(info.screen()->getImage(id)), viewport);
image->setTile(tile);
image->show();
image->enableMovement();