summaryrefslogtreecommitdiff
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
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
-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
-rw-r--r--utils/themeeditor/models/parsetreenode.cpp1
5 files changed, 27 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 @@
32RBScreen::RBScreen(const RBRenderInfo& info, bool remote, 32RBScreen::RBScreen(const RBRenderInfo& info, bool remote,
33 QGraphicsItem *parent) 33 QGraphicsItem *parent)
34 :QGraphicsItem(parent), backdrop(0), project(project), 34 :QGraphicsItem(parent), backdrop(0), project(project),
35 albumArt(0), customUI(0), defaultView(0) 35 albumArt(0), customUI(0), defaultView(0), ax(false)
36{ 36{
37 37
38 setAcceptHoverEvents(true); 38 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:
90 void endSbsRender(); 90 void endSbsRender();
91 void breakSBS(); 91 void breakSBS();
92 92
93 void RtlMirror(){ ax = true; }
94 bool isRtlMirrored(){ bool ret = ax; ax = false; return ret; }
95
93protected: 96protected:
94 void hoverMoveEvent(QGraphicsSceneHoverEvent *event); 97 void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
95 98
@@ -116,6 +119,8 @@ private:
116 RBViewport* defaultView; 119 RBViewport* defaultView;
117 120
118 QList<QGraphicsItem*> sbsChildren; 121 QList<QGraphicsItem*> sbsChildren;
122
123 bool ax;
119}; 124};
120 125
121#endif // RBSCREEN_H 126#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,
48 leftGraphic(0), centerGraphic(0), rightGraphic(0), scrollTime(0), 48 leftGraphic(0), centerGraphic(0), rightGraphic(0), scrollTime(0),
49 node(pNode), doc(info.document()) 49 node(pNode), doc(info.document())
50{ 50{
51 mirrored = info.screen()->isRtlMirrored()
52 && info.device()->data("rtl").toBool();
53
51 if(!node->tag) 54 if(!node->tag)
52 { 55 {
53 /* Default viewport takes up the entire screen */ 56 /* Default viewport takes up the entire screen */
@@ -147,6 +150,12 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info,
147 y -= screen->parentItem()->pos().y(); 150 y -= screen->parentItem()->pos().y();
148 } 151 }
149 152
153 /* Mirroring if necessary */
154 if(mirrored)
155 {
156 x = parentItem()->boundingRect().width() - w - x;
157 }
158
150 if(node->params[++param].type == skin_tag_parameter::DEFAULT) 159 if(node->params[++param].type == skin_tag_parameter::DEFAULT)
151 font = screen->getFont(1); 160 font = screen->getFont(1);
152 else 161 else
@@ -226,15 +235,21 @@ void RBViewport::write(QString text)
226 if(textOffset.x() < 0) 235 if(textOffset.x() < 0)
227 return; 236 return;
228 237
229 if(textAlign == Left) 238 Alignment align = textAlign;
239 if(mirrored && align == Left)
240 align = Right;
241 else if(mirrored && align == Right)
242 align = Left;
243
244 if(align == Left)
230 { 245 {
231 leftText.append(text); 246 leftText.append(text);
232 } 247 }
233 else if(textAlign == Center) 248 else if(align == Center)
234 { 249 {
235 centerText.append(text); 250 centerText.append(text);
236 } 251 }
237 else if(textAlign == Right) 252 else if(align == Right)
238 { 253 {
239 rightText.append(text); 254 rightText.append(text);
240 } 255 }
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:
120 int baseParam; 120 int baseParam;
121 ParseTreeNode* node; 121 ParseTreeNode* node;
122 SkinDocument* doc; 122 SkinDocument* doc;
123
124 bool mirrored;
123}; 125};
124 126
125#endif // RBVIEWPORT_H 127#endif // RBVIEWPORT_H
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp
index 0888bc47e9..ad80ac6f2e 100644
--- a/utils/themeeditor/models/parsetreenode.cpp
+++ b/utils/themeeditor/models/parsetreenode.cpp
@@ -665,6 +665,7 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport)
665 665
666 case 'x': 666 case 'x':
667 /* %ax */ 667 /* %ax */
668 info.screen()->RtlMirror();
668 return true; 669 return true;
669 670
670 case 'L': 671 case 'L':