summaryrefslogtreecommitdiff
path: root/utils/themeeditor/graphics/rbviewport.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-08-03 08:42:30 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-08-03 08:42:30 +0000
commita83adc7d6d0a16d08687a903da8a992e3affedcc (patch)
tree0ed81dca47756ac17bdfb9fad0e5e373d1358595 /utils/themeeditor/graphics/rbviewport.cpp
parentdad9810fe5fe813c4960d8790651a5ad6adf2651 (diff)
downloadrockbox-a83adc7d6d0a16d08687a903da8a992e3affedcc.tar.gz
rockbox-a83adc7d6d0a16d08687a903da8a992e3affedcc.zip
Theme Editor: Removed markup comments from CodeEditor files (it was originally a Nokia example, so it was marked up with comments for their documentation), implemented the beginnings of drag and drop editing. Viewports are now movable, but don't invoke code generation yet
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27675 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/graphics/rbviewport.cpp')
-rw-r--r--utils/themeeditor/graphics/rbviewport.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp
index e9c58eb6fb..f7b1bc4ca2 100644
--- a/utils/themeeditor/graphics/rbviewport.cpp
+++ b/utils/themeeditor/graphics/rbviewport.cpp
@@ -21,6 +21,11 @@
21 21
22#include <QPainter> 22#include <QPainter>
23#include <QPainterPath> 23#include <QPainterPath>
24#include <QGraphicsSceneMouseEvent>
25#include <QTransform>
26
27#include <QDebug>
28
24#include <cmath> 29#include <cmath>
25 30
26#include "rbviewport.h" 31#include "rbviewport.h"
@@ -40,6 +45,8 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info)
40 statusBarTexture(":/render/statusbar.png"), 45 statusBarTexture(":/render/statusbar.png"),
41 leftGraphic(0), centerGraphic(0), rightGraphic(0), scrollTime(0) 46 leftGraphic(0), centerGraphic(0), rightGraphic(0), scrollTime(0)
42{ 47{
48 setFlags(ItemIsSelectable | ItemIsMovable | ItemSendsGeometryChanges);
49
43 if(!node->tag) 50 if(!node->tag)
44 { 51 {
45 /* Default viewport takes up the entire screen */ 52 /* Default viewport takes up the entire screen */
@@ -290,6 +297,26 @@ void RBViewport::showPlaylist(const RBRenderInfo &info, int start,
290 } 297 }
291} 298}
292 299
300QVariant RBViewport::itemChange(GraphicsItemChange change,
301 const QVariant &value)
302{
303 if(change == ItemPositionChange)
304 {
305 QPointF pos = value.toPointF();
306 QRectF bound = parentItem()->boundingRect();
307
308 pos.setX(qMax(0., pos.x()));
309 pos.setX(qMin(pos.x(), bound.width() - boundingRect().width()));
310
311 pos.setY(qMax(0., pos.y()));
312 pos.setY(qMin(pos.y(), bound.height() - boundingRect().height()));
313
314 return pos;
315 }
316
317 return QGraphicsItem::itemChange(change, value);
318}
319
293void RBViewport::alignLeft() 320void RBViewport::alignLeft()
294{ 321{
295 int y = textOffset.y(); 322 int y = textOffset.y();