forked from len0rd/rockbox
Theme Editor: Implemented some basic viewport/text mirroring with the %ax tag
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27795 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4bca51b5b7
commit
1ee2cddf1a
5 changed files with 27 additions and 4 deletions
|
@ -32,7 +32,7 @@
|
|||
RBScreen::RBScreen(const RBRenderInfo& info, bool remote,
|
||||
QGraphicsItem *parent)
|
||||
:QGraphicsItem(parent), backdrop(0), project(project),
|
||||
albumArt(0), customUI(0), defaultView(0)
|
||||
albumArt(0), customUI(0), defaultView(0), ax(false)
|
||||
{
|
||||
|
||||
setAcceptHoverEvents(true);
|
||||
|
|
|
@ -90,6 +90,9 @@ public:
|
|||
void endSbsRender();
|
||||
void breakSBS();
|
||||
|
||||
void RtlMirror(){ ax = true; }
|
||||
bool isRtlMirrored(){ bool ret = ax; ax = false; return ret; }
|
||||
|
||||
protected:
|
||||
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
|
||||
|
||||
|
@ -116,6 +119,8 @@ private:
|
|||
RBViewport* defaultView;
|
||||
|
||||
QList<QGraphicsItem*> sbsChildren;
|
||||
|
||||
bool ax;
|
||||
};
|
||||
|
||||
#endif // RBSCREEN_H
|
||||
|
|
|
@ -48,6 +48,9 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info,
|
|||
leftGraphic(0), centerGraphic(0), rightGraphic(0), scrollTime(0),
|
||||
node(pNode), doc(info.document())
|
||||
{
|
||||
mirrored = info.screen()->isRtlMirrored()
|
||||
&& info.device()->data("rtl").toBool();
|
||||
|
||||
if(!node->tag)
|
||||
{
|
||||
/* Default viewport takes up the entire screen */
|
||||
|
@ -147,6 +150,12 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info,
|
|||
y -= screen->parentItem()->pos().y();
|
||||
}
|
||||
|
||||
/* Mirroring if necessary */
|
||||
if(mirrored)
|
||||
{
|
||||
x = parentItem()->boundingRect().width() - w - x;
|
||||
}
|
||||
|
||||
if(node->params[++param].type == skin_tag_parameter::DEFAULT)
|
||||
font = screen->getFont(1);
|
||||
else
|
||||
|
@ -226,15 +235,21 @@ void RBViewport::write(QString text)
|
|||
if(textOffset.x() < 0)
|
||||
return;
|
||||
|
||||
if(textAlign == Left)
|
||||
Alignment align = textAlign;
|
||||
if(mirrored && align == Left)
|
||||
align = Right;
|
||||
else if(mirrored && align == Right)
|
||||
align = Left;
|
||||
|
||||
if(align == Left)
|
||||
{
|
||||
leftText.append(text);
|
||||
}
|
||||
else if(textAlign == Center)
|
||||
else if(align == Center)
|
||||
{
|
||||
centerText.append(text);
|
||||
}
|
||||
else if(textAlign == Right)
|
||||
else if(align == Right)
|
||||
{
|
||||
rightText.append(text);
|
||||
}
|
||||
|
|
|
@ -120,6 +120,8 @@ private:
|
|||
int baseParam;
|
||||
ParseTreeNode* node;
|
||||
SkinDocument* doc;
|
||||
|
||||
bool mirrored;
|
||||
};
|
||||
|
||||
#endif // RBVIEWPORT_H
|
||||
|
|
|
@ -665,6 +665,7 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport)
|
|||
|
||||
case 'x':
|
||||
/* %ax */
|
||||
info.screen()->RtlMirror();
|
||||
return true;
|
||||
|
||||
case 'L':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue