summaryrefslogtreecommitdiffstats
path: root/utils/themeeditor/graphics
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-08-12 23:05:53 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-08-12 23:05:53 +0000
commit1ee2cddf1a64f62a57af6e10a95f0f9642027d7f (patch)
tree52178122b118b0d874acec49c9da1d9675790a81 /utils/themeeditor/graphics
parent4bca51b5b772171ef39c21b7a5913bf9852d60b1 (diff)
downloadrockbox-1ee2cddf1a64f62a57af6e10a95f0f9642027d7f.tar.gz
rockbox-1ee2cddf1a64f62a57af6e10a95f0f9642027d7f.zip
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
Diffstat (limited to 'utils/themeeditor/graphics')
-rw-r--r--utils/themeeditor/graphics/rbscreen.cpp2
-rw-r--r--utils/themeeditor/graphics/rbscreen.h5
-rw-r--r--utils/themeeditor/graphics/rbviewport.cpp21
-rw-r--r--utils/themeeditor/graphics/rbviewport.h2
4 files changed, 26 insertions, 4 deletions
diff --git a/utils/themeeditor/graphics/rbscreen.cpp b/utils/themeeditor/graphics/rbscreen.cpp
index 2b63a6bdfe..c66d4f82b2 100644
--- a/utils/themeeditor/graphics/rbscreen.cpp
+++ b/utils/themeeditor/graphics/rbscreen.cpp
@@ -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);
diff --git a/utils/themeeditor/graphics/rbscreen.h b/utils/themeeditor/graphics/rbscreen.h
index c9ae2cf350..3a9a6ddeb3 100644
--- a/utils/themeeditor/graphics/rbscreen.h
+++ b/utils/themeeditor/graphics/rbscreen.h
@@ -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
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp
index a986127987..5cac806c3d 100644
--- a/utils/themeeditor/graphics/rbviewport.cpp
+++ b/utils/themeeditor/graphics/rbviewport.cpp
@@ -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);
}
diff --git a/utils/themeeditor/graphics/rbviewport.h b/utils/themeeditor/graphics/rbviewport.h
index 8544ad3c1f..cc47e41666 100644
--- a/utils/themeeditor/graphics/rbviewport.h
+++ b/utils/themeeditor/graphics/rbviewport.h
@@ -120,6 +120,8 @@ private:
int baseParam;
ParseTreeNode* node;
SkinDocument* doc;
+
+ bool mirrored;
};
#endif // RBVIEWPORT_H