diff options
-rw-r--r-- | utils/themeeditor/graphics/rbmovable.cpp | 18 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbmovable.h | 4 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbrenderinfo.cpp | 7 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbrenderinfo.h | 8 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbviewport.cpp | 23 | ||||
-rw-r--r-- | utils/themeeditor/graphics/rbviewport.h | 10 | ||||
-rw-r--r-- | utils/themeeditor/gui/skindocument.cpp | 2 | ||||
-rw-r--r-- | utils/themeeditor/gui/skindocument.h | 5 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreemodel.cpp | 14 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreemodel.h | 2 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreenode.cpp | 32 | ||||
-rw-r--r-- | utils/themeeditor/models/parsetreenode.h | 2 |
12 files changed, 104 insertions, 23 deletions
diff --git a/utils/themeeditor/graphics/rbmovable.cpp b/utils/themeeditor/graphics/rbmovable.cpp index 11b3a6812f..3eca8bd18c 100644 --- a/utils/themeeditor/graphics/rbmovable.cpp +++ b/utils/themeeditor/graphics/rbmovable.cpp | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "rbmovable.h" | 25 | #include "rbmovable.h" |
26 | 26 | ||
27 | RBMovable::RBMovable(QGraphicsItem* parent) | 27 | RBMovable::RBMovable(QGraphicsItem* parent) |
28 | : QGraphicsItem(parent) | 28 | : QGraphicsItem(parent), geomChanged(false) |
29 | { | 29 | { |
30 | setFlags(ItemIsMovable | ItemIsSelectable | ItemSendsGeometryChanges); | 30 | setFlags(ItemIsMovable | ItemIsSelectable | ItemSendsGeometryChanges); |
31 | } | 31 | } |
@@ -61,7 +61,7 @@ QVariant RBMovable::itemChange(GraphicsItemChange change, const QVariant &value) | |||
61 | pos.setY(qMax(0., pos.y())); | 61 | pos.setY(qMax(0., pos.y())); |
62 | pos.setY(qMin(pos.y(), bound.height() - boundingRect().height())); | 62 | pos.setY(qMin(pos.y(), bound.height() - boundingRect().height())); |
63 | 63 | ||
64 | saveGeometry(); | 64 | geomChanged = true; |
65 | 65 | ||
66 | return pos; | 66 | return pos; |
67 | } | 67 | } |
@@ -69,3 +69,17 @@ QVariant RBMovable::itemChange(GraphicsItemChange change, const QVariant &value) | |||
69 | return QGraphicsItem::itemChange(change, value); | 69 | return QGraphicsItem::itemChange(change, value); |
70 | } | 70 | } |
71 | 71 | ||
72 | void RBMovable::mousePressEvent(QGraphicsSceneMouseEvent *event) | ||
73 | { | ||
74 | QGraphicsItem::mousePressEvent(event); | ||
75 | } | ||
76 | |||
77 | void RBMovable::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | ||
78 | { | ||
79 | QGraphicsItem::mouseReleaseEvent(event); | ||
80 | if(isSelected()) | ||
81 | { | ||
82 | saveGeometry(); | ||
83 | geomChanged = false; | ||
84 | } | ||
85 | } | ||
diff --git a/utils/themeeditor/graphics/rbmovable.h b/utils/themeeditor/graphics/rbmovable.h index e8ef69b5bd..5b6330228d 100644 --- a/utils/themeeditor/graphics/rbmovable.h +++ b/utils/themeeditor/graphics/rbmovable.h | |||
@@ -41,6 +41,8 @@ public: | |||
41 | 41 | ||
42 | virtual void paint(QPainter *painter, | 42 | virtual void paint(QPainter *painter, |
43 | const QStyleOptionGraphicsItem *option, QWidget *widget); | 43 | const QStyleOptionGraphicsItem *option, QWidget *widget); |
44 | virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||
45 | virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); | ||
44 | 46 | ||
45 | protected: | 47 | protected: |
46 | virtual QVariant itemChange(GraphicsItemChange change, | 48 | virtual QVariant itemChange(GraphicsItemChange change, |
@@ -48,6 +50,8 @@ protected: | |||
48 | /* Responsible for updating the parse tree */ | 50 | /* Responsible for updating the parse tree */ |
49 | virtual void saveGeometry() = 0; | 51 | virtual void saveGeometry() = 0; |
50 | 52 | ||
53 | bool geomChanged; | ||
54 | |||
51 | }; | 55 | }; |
52 | 56 | ||
53 | #endif // RBMOVABLE_H | 57 | #endif // RBMOVABLE_H |
diff --git a/utils/themeeditor/graphics/rbrenderinfo.cpp b/utils/themeeditor/graphics/rbrenderinfo.cpp index 0b9ea41397..e39a4cea43 100644 --- a/utils/themeeditor/graphics/rbrenderinfo.cpp +++ b/utils/themeeditor/graphics/rbrenderinfo.cpp | |||
@@ -22,10 +22,11 @@ | |||
22 | #include "rbrenderinfo.h" | 22 | #include "rbrenderinfo.h" |
23 | 23 | ||
24 | RBRenderInfo::RBRenderInfo(ParseTreeModel* model, ProjectModel* project, | 24 | RBRenderInfo::RBRenderInfo(ParseTreeModel* model, ProjectModel* project, |
25 | QMap<QString, QString>* settings, | 25 | SkinDocument* doc, QMap<QString, QString>* settings, |
26 | DeviceState* device, RBScreen* screen, | 26 | DeviceState* device, RBScreen* screen, |
27 | RBScreen* sbsScreen) | 27 | RBScreen* sbsScreen) |
28 | :mProject(project), mSettings(settings), | 28 | :mProject(project), mDoc(doc), |
29 | mSettings(settings), | ||
29 | mDevice(device), mScreen(screen), | 30 | mDevice(device), mScreen(screen), |
30 | mSbsScreen(sbsScreen), mModel(model) | 31 | mSbsScreen(sbsScreen), mModel(model) |
31 | { | 32 | { |
@@ -41,6 +42,7 @@ RBRenderInfo::RBRenderInfo(const RBRenderInfo &other) | |||
41 | mProject = other.mProject; | 42 | mProject = other.mProject; |
42 | mSettings = other.mSettings; | 43 | mSettings = other.mSettings; |
43 | mDevice = other.mDevice; | 44 | mDevice = other.mDevice; |
45 | mDoc = other.mDoc; | ||
44 | mScreen = other.mScreen; | 46 | mScreen = other.mScreen; |
45 | mSbsScreen = other.mSbsScreen; | 47 | mSbsScreen = other.mSbsScreen; |
46 | mModel = other.mModel; | 48 | mModel = other.mModel; |
@@ -51,6 +53,7 @@ const RBRenderInfo& RBRenderInfo::operator=(const RBRenderInfo& other) | |||
51 | mProject = other.mProject; | 53 | mProject = other.mProject; |
52 | mSettings = other.mSettings; | 54 | mSettings = other.mSettings; |
53 | mDevice = other.mDevice; | 55 | mDevice = other.mDevice; |
56 | mDoc = other.mDoc; | ||
54 | mScreen = other.mScreen; | 57 | mScreen = other.mScreen; |
55 | mSbsScreen = other.mSbsScreen; | 58 | mSbsScreen = other.mSbsScreen; |
56 | mModel = other.mModel; | 59 | mModel = other.mModel; |
diff --git a/utils/themeeditor/graphics/rbrenderinfo.h b/utils/themeeditor/graphics/rbrenderinfo.h index 599a563da2..17b87dbb6b 100644 --- a/utils/themeeditor/graphics/rbrenderinfo.h +++ b/utils/themeeditor/graphics/rbrenderinfo.h | |||
@@ -28,13 +28,15 @@ class RBScreen; | |||
28 | class ProjectModel; | 28 | class ProjectModel; |
29 | class ParseTreeModel; | 29 | class ParseTreeModel; |
30 | class DeviceState; | 30 | class DeviceState; |
31 | class SkinDocument; | ||
31 | 32 | ||
32 | class RBRenderInfo | 33 | class RBRenderInfo |
33 | { | 34 | { |
34 | public: | 35 | public: |
35 | RBRenderInfo(ParseTreeModel* model, ProjectModel* project, | 36 | RBRenderInfo(ParseTreeModel* model, ProjectModel* project, |
36 | QMap<QString, QString>* settings, DeviceState* device, | 37 | SkinDocument* doc, QMap<QString, QString>* settings, |
37 | RBScreen* screen, RBScreen* sbsScreen = 0); | 38 | DeviceState* device, RBScreen* screen, |
39 | RBScreen* sbsScreen = 0); | ||
38 | RBRenderInfo(); | 40 | RBRenderInfo(); |
39 | RBRenderInfo(const RBRenderInfo& other); | 41 | RBRenderInfo(const RBRenderInfo& other); |
40 | virtual ~RBRenderInfo(); | 42 | virtual ~RBRenderInfo(); |
@@ -43,6 +45,7 @@ public: | |||
43 | 45 | ||
44 | ProjectModel* project() const{ return mProject; } | 46 | ProjectModel* project() const{ return mProject; } |
45 | DeviceState* device() const{ return mDevice; } | 47 | DeviceState* device() const{ return mDevice; } |
48 | SkinDocument* document() const{ return mDoc; } | ||
46 | QMap<QString, QString>* settings() const{ return mSettings; } | 49 | QMap<QString, QString>* settings() const{ return mSettings; } |
47 | RBScreen* screen() const{ return mScreen; } | 50 | RBScreen* screen() const{ return mScreen; } |
48 | RBScreen* sbsScreen() const{ return mSbsScreen; } | 51 | RBScreen* sbsScreen() const{ return mSbsScreen; } |
@@ -50,6 +53,7 @@ public: | |||
50 | 53 | ||
51 | private: | 54 | private: |
52 | ProjectModel* mProject; | 55 | ProjectModel* mProject; |
56 | SkinDocument* mDoc; | ||
53 | QMap<QString, QString>* mSettings; | 57 | QMap<QString, QString>* mSettings; |
54 | DeviceState* mDevice; | 58 | DeviceState* mDevice; |
55 | RBScreen* mScreen; | 59 | RBScreen* mScreen; |
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp index fe17ebbeef..33749fdb7f 100644 --- a/utils/themeeditor/graphics/rbviewport.cpp +++ b/utils/themeeditor/graphics/rbviewport.cpp | |||
@@ -34,16 +34,19 @@ | |||
34 | #include "parsetreemodel.h" | 34 | #include "parsetreemodel.h" |
35 | #include "tag_table.h" | 35 | #include "tag_table.h" |
36 | #include "skin_parser.h" | 36 | #include "skin_parser.h" |
37 | #include "skindocument.h" | ||
37 | 38 | ||
38 | /* Pixels/second of text scrolling */ | 39 | /* Pixels/second of text scrolling */ |
39 | const double RBViewport::scrollRate = 30; | 40 | const double RBViewport::scrollRate = 30; |
40 | 41 | ||
41 | RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) | 42 | RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info, |
43 | ParseTreeNode* pNode) | ||
42 | : RBMovable(info.screen()), foreground(info.screen()->foreground()), | 44 | : RBMovable(info.screen()), foreground(info.screen()->foreground()), |
43 | background(info.screen()->background()), textOffset(0,0), | 45 | background(info.screen()->background()), textOffset(0,0), |
44 | screen(info.screen()), textAlign(Left), showStatusBar(false), | 46 | screen(info.screen()), textAlign(Left), showStatusBar(false), |
45 | statusBarTexture(":/render/statusbar.png"), | 47 | statusBarTexture(":/render/statusbar.png"), |
46 | leftGraphic(0), centerGraphic(0), rightGraphic(0), scrollTime(0) | 48 | leftGraphic(0), centerGraphic(0), rightGraphic(0), scrollTime(0), |
49 | node(pNode), doc(info.document()) | ||
47 | { | 50 | { |
48 | setFlags(ItemIsSelectable | ItemIsMovable | ItemSendsGeometryChanges); | 51 | setFlags(ItemIsSelectable | ItemIsMovable | ItemSendsGeometryChanges); |
49 | 52 | ||
@@ -67,7 +70,6 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) | |||
67 | } | 70 | } |
68 | else | 71 | else |
69 | { | 72 | { |
70 | int param = 0; | ||
71 | QString ident; | 73 | QString ident; |
72 | int x,y,w,h; | 74 | int x,y,w,h; |
73 | /* Rendering one of the other types of viewport */ | 75 | /* Rendering one of the other types of viewport */ |
@@ -75,7 +77,7 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) | |||
75 | { | 77 | { |
76 | case '\0': | 78 | case '\0': |
77 | customUI = false; | 79 | customUI = false; |
78 | param = 0; | 80 | baseParam= 0; |
79 | break; | 81 | break; |
80 | 82 | ||
81 | case 'l': | 83 | case 'l': |
@@ -85,13 +87,13 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) | |||
85 | if(!screen->viewPortDisplayed(ident)) | 87 | if(!screen->viewPortDisplayed(ident)) |
86 | hide(); | 88 | hide(); |
87 | info.screen()->loadViewport(ident, this); | 89 | info.screen()->loadViewport(ident, this); |
88 | param = 1; | 90 | baseParam= 1; |
89 | break; | 91 | break; |
90 | 92 | ||
91 | case 'i': | 93 | case 'i': |
92 | /* Custom UI Viewport */ | 94 | /* Custom UI Viewport */ |
93 | customUI = true; | 95 | customUI = true; |
94 | param = 1; | 96 | baseParam= 1; |
95 | if(node->params[0].type == skin_tag_parameter::DEFAULT) | 97 | if(node->params[0].type == skin_tag_parameter::DEFAULT) |
96 | { | 98 | { |
97 | setVisible(true); | 99 | setVisible(true); |
@@ -104,6 +106,7 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) | |||
104 | break; | 106 | break; |
105 | } | 107 | } |
106 | /* Now we grab the info common to all viewports */ | 108 | /* Now we grab the info common to all viewports */ |
109 | int param = baseParam; | ||
107 | x = node->params[param++].data.number; | 110 | x = node->params[param++].data.number; |
108 | if(x < 0) | 111 | if(x < 0) |
109 | x = info.screen()->boundingRect().right() + x; | 112 | x = info.screen()->boundingRect().right() + x; |
@@ -301,7 +304,15 @@ void RBViewport::showPlaylist(const RBRenderInfo &info, int start, | |||
301 | 304 | ||
302 | void RBViewport::saveGeometry() | 305 | void RBViewport::saveGeometry() |
303 | { | 306 | { |
307 | QRectF bounds = boundingRect(); | ||
308 | QPointF origin = pos(); | ||
304 | 309 | ||
310 | node->modParam(static_cast<int>(origin.x()), baseParam); | ||
311 | node->modParam(static_cast<int>(origin.y()), baseParam + 1); | ||
312 | node->modParam(static_cast<int>(bounds.width()), baseParam + 2); | ||
313 | node->modParam(static_cast<int>(bounds.height()), baseParam + 3); | ||
314 | |||
315 | doc->genCode(); | ||
305 | } | 316 | } |
306 | 317 | ||
307 | void RBViewport::alignLeft() | 318 | void RBViewport::alignLeft() |
diff --git a/utils/themeeditor/graphics/rbviewport.h b/utils/themeeditor/graphics/rbviewport.h index b9bafe47d1..691133beeb 100644 --- a/utils/themeeditor/graphics/rbviewport.h +++ b/utils/themeeditor/graphics/rbviewport.h | |||
@@ -28,9 +28,12 @@ | |||
28 | 28 | ||
29 | class RBScreen; | 29 | class RBScreen; |
30 | class RBRenderInfo; | 30 | class RBRenderInfo; |
31 | class ParseTreeNode; | ||
31 | 32 | ||
32 | #include <QGraphicsItem> | 33 | #include <QGraphicsItem> |
33 | 34 | ||
35 | class SkinDocument; | ||
36 | |||
34 | class RBViewport : public RBMovable | 37 | class RBViewport : public RBMovable |
35 | { | 38 | { |
36 | public: | 39 | public: |
@@ -43,7 +46,8 @@ public: | |||
43 | 46 | ||
44 | static const double scrollRate; | 47 | static const double scrollRate; |
45 | 48 | ||
46 | RBViewport(skin_element* node, const RBRenderInfo& info); | 49 | RBViewport(skin_element* node, const RBRenderInfo& info, |
50 | ParseTreeNode* pNode); | ||
47 | virtual ~RBViewport(); | 51 | virtual ~RBViewport(); |
48 | 52 | ||
49 | QPainterPath shape() const; | 53 | QPainterPath shape() const; |
@@ -112,6 +116,10 @@ private: | |||
112 | RBText* rightGraphic; | 116 | RBText* rightGraphic; |
113 | 117 | ||
114 | double scrollTime; | 118 | double scrollTime; |
119 | |||
120 | int baseParam; | ||
121 | ParseTreeNode* node; | ||
122 | SkinDocument* doc; | ||
115 | }; | 123 | }; |
116 | 124 | ||
117 | #endif // RBVIEWPORT_H | 125 | #endif // RBVIEWPORT_H |
diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp index 15111cbed8..bd52685c6b 100644 --- a/utils/themeeditor/gui/skindocument.cpp +++ b/utils/themeeditor/gui/skindocument.cpp | |||
@@ -301,7 +301,7 @@ void SkinDocument::codeChanged() | |||
301 | 301 | ||
302 | if(lastUpdate.msecsTo(QTime::currentTime()) >= updateInterval) | 302 | if(lastUpdate.msecsTo(QTime::currentTime()) >= updateInterval) |
303 | { | 303 | { |
304 | model->render(project, device, &fileName); | 304 | model->render(project, device, this, &fileName); |
305 | checkUpdate.stop(); | 305 | checkUpdate.stop(); |
306 | lastUpdate = QTime::currentTime(); | 306 | lastUpdate = QTime::currentTime(); |
307 | } | 307 | } |
diff --git a/utils/themeeditor/gui/skindocument.h b/utils/themeeditor/gui/skindocument.h index d20d0fb1ec..10c9e3ff11 100644 --- a/utils/themeeditor/gui/skindocument.h +++ b/utils/themeeditor/gui/skindocument.h | |||
@@ -76,7 +76,10 @@ public: | |||
76 | 76 | ||
77 | TabType type() const{ return Skin; } | 77 | TabType type() const{ return Skin; } |
78 | 78 | ||
79 | QGraphicsScene* scene(){ return model->render(project, device, &fileName); } | 79 | QGraphicsScene* scene() |
80 | { | ||
81 | return model->render(project, device, this, &fileName); | ||
82 | } | ||
80 | 83 | ||
81 | void showFind(){ findReplace->show(); } | 84 | void showFind(){ findReplace->show(); } |
82 | void hideFind(){ findReplace->hide(); } | 85 | void hideFind(){ findReplace->hide(); } |
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp index 8d8855a5a6..a7f04ffbf2 100644 --- a/utils/themeeditor/models/parsetreemodel.cpp +++ b/utils/themeeditor/models/parsetreemodel.cpp | |||
@@ -271,7 +271,8 @@ bool ParseTreeModel::setData(const QModelIndex &index, const QVariant &value, | |||
271 | } | 271 | } |
272 | 272 | ||
273 | QGraphicsScene* ParseTreeModel::render(ProjectModel* project, | 273 | QGraphicsScene* ParseTreeModel::render(ProjectModel* project, |
274 | DeviceState* device, const QString* file) | 274 | DeviceState* device, |
275 | SkinDocument* doc, const QString* file) | ||
275 | { | 276 | { |
276 | scene->clear(); | 277 | scene->clear(); |
277 | 278 | ||
@@ -327,14 +328,14 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project, | |||
327 | 328 | ||
328 | if(sbsModel.root != 0) | 329 | if(sbsModel.root != 0) |
329 | { | 330 | { |
330 | RBRenderInfo sbsInfo(&sbsModel, project, &settings, device, | 331 | RBRenderInfo sbsInfo(&sbsModel, project, doc, &settings, device, |
331 | sbsScreen); | 332 | sbsScreen); |
332 | 333 | ||
333 | sbsScreen = new RBScreen(sbsInfo, remote); | 334 | sbsScreen = new RBScreen(sbsInfo, remote); |
334 | scene->addItem(sbsScreen); | 335 | scene->addItem(sbsScreen); |
335 | 336 | ||
336 | sbsInfo = RBRenderInfo(&sbsModel, project, &settings, device, | 337 | sbsInfo = RBRenderInfo(&sbsModel, project, doc, &settings, |
337 | sbsScreen); | 338 | device, sbsScreen); |
338 | sbsModel.root->render(sbsInfo); | 339 | sbsModel.root->render(sbsInfo); |
339 | } | 340 | } |
340 | 341 | ||
@@ -342,7 +343,7 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project, | |||
342 | } | 343 | } |
343 | 344 | ||
344 | RBScreen* screen = 0; | 345 | RBScreen* screen = 0; |
345 | RBRenderInfo info(this, project, &settings, device, screen, sbsScreen); | 346 | RBRenderInfo info(this, project, doc, &settings, device, screen, sbsScreen); |
346 | 347 | ||
347 | /* Adding the screen */ | 348 | /* Adding the screen */ |
348 | if(sbsScreen) | 349 | if(sbsScreen) |
@@ -353,7 +354,8 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project, | |||
353 | if(!sbsScreen) | 354 | if(!sbsScreen) |
354 | scene->addItem(screen); | 355 | scene->addItem(screen); |
355 | 356 | ||
356 | info = RBRenderInfo(this, project, &settings, device, screen, sbsScreen); | 357 | info = RBRenderInfo(this, project, doc, &settings, device, screen, |
358 | sbsScreen); | ||
357 | 359 | ||
358 | 360 | ||
359 | /* Rendering the tree */ | 361 | /* Rendering the tree */ |
diff --git a/utils/themeeditor/models/parsetreemodel.h b/utils/themeeditor/models/parsetreemodel.h index 463f6ca82d..ec0a420a84 100644 --- a/utils/themeeditor/models/parsetreemodel.h +++ b/utils/themeeditor/models/parsetreemodel.h | |||
@@ -63,7 +63,7 @@ public: | |||
63 | bool setData(const QModelIndex &index, const QVariant &value, int role); | 63 | bool setData(const QModelIndex &index, const QVariant &value, int role); |
64 | 64 | ||
65 | QGraphicsScene* render(ProjectModel* project, DeviceState* device, | 65 | QGraphicsScene* render(ProjectModel* project, DeviceState* device, |
66 | const QString* file = 0); | 66 | SkinDocument* doc, const QString* file = 0); |
67 | 67 | ||
68 | static QString safeSetting(ProjectModel* project, QString key, | 68 | static QString safeSetting(ProjectModel* project, QString key, |
69 | QString fallback) | 69 | QString fallback) |
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp index 1349ba9ad6..8d1fcc7d1a 100644 --- a/utils/themeeditor/models/parsetreenode.cpp +++ b/utils/themeeditor/models/parsetreenode.cpp | |||
@@ -523,7 +523,7 @@ void ParseTreeNode::render(const RBRenderInfo& info) | |||
523 | return; | 523 | return; |
524 | } | 524 | } |
525 | 525 | ||
526 | rendered = new RBViewport(element, info); | 526 | rendered = new RBViewport(element, info, this); |
527 | 527 | ||
528 | for(int i = element->params_count; i < children.count(); i++) | 528 | for(int i = element->params_count; i < children.count(); i++) |
529 | children[i]->render(info, dynamic_cast<RBViewport*>(rendered)); | 529 | children[i]->render(info, dynamic_cast<RBViewport*>(rendered)); |
@@ -1057,3 +1057,33 @@ double ParseTreeNode::findConditionalTime(ParseTreeNode *conditional, | |||
1057 | conditional->children.count()).toInt(); | 1057 | conditional->children.count()).toInt(); |
1058 | return findBranchTime(conditional->children[child], info); | 1058 | return findBranchTime(conditional->children[child], info); |
1059 | } | 1059 | } |
1060 | |||
1061 | void ParseTreeNode::modParam(QVariant value, int index) | ||
1062 | { | ||
1063 | if(element) | ||
1064 | { | ||
1065 | if(index < 0 || index >= children.count()) | ||
1066 | return; | ||
1067 | children[index]->modParam(value); | ||
1068 | } | ||
1069 | else if(param) | ||
1070 | { | ||
1071 | if(value.type() == QVariant::Double) | ||
1072 | { | ||
1073 | param->type = skin_tag_parameter::DECIMAL; | ||
1074 | param->data.number = static_cast<int>(value.toDouble() * 10); | ||
1075 | } | ||
1076 | else if(value.type() == QVariant::String) | ||
1077 | { | ||
1078 | param->type = skin_tag_parameter::STRING; | ||
1079 | free(param->data.text); | ||
1080 | param->data.text = strdup(value.toString().toStdString().c_str()); | ||
1081 | } | ||
1082 | else if(value.type() == QVariant::Int) | ||
1083 | { | ||
1084 | param->type = skin_tag_parameter::INTEGER; | ||
1085 | param->data.number = value.toInt(); | ||
1086 | } | ||
1087 | |||
1088 | } | ||
1089 | } | ||
diff --git a/utils/themeeditor/models/parsetreenode.h b/utils/themeeditor/models/parsetreenode.h index ca01ddd5ae..39f0dbdfcd 100644 --- a/utils/themeeditor/models/parsetreenode.h +++ b/utils/themeeditor/models/parsetreenode.h | |||
@@ -67,6 +67,8 @@ public: | |||
67 | double findConditionalTime(ParseTreeNode* conditional, | 67 | double findConditionalTime(ParseTreeNode* conditional, |
68 | const RBRenderInfo& info); | 68 | const RBRenderInfo& info); |
69 | 69 | ||
70 | void modParam(QVariant value, int index = -1); | ||
71 | |||
70 | private: | 72 | private: |
71 | 73 | ||
72 | bool execTag(const RBRenderInfo& info, RBViewport* viewport); | 74 | bool execTag(const RBRenderInfo& info, RBViewport* viewport); |