summaryrefslogtreecommitdiff
path: root/utils/themeeditor/models
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-18 21:10:01 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-18 21:10:01 +0000
commitd8827b5ff10c66a065a210d8aaf1d88214ee1070 (patch)
tree26a23ff031105ee98cbba967a4554ebf8ac423a6 /utils/themeeditor/models
parent62622277dc2a11117605e5e7ff3d2a5f0423d8da (diff)
downloadrockbox-d8827b5ff10c66a065a210d8aaf1d88214ee1070.tar.gz
rockbox-d8827b5ff10c66a065a210d8aaf1d88214ee1070.zip
Theme Editor: Working on rendering viewports, display will now show %V(...) viewports as red rectangles over backdrop or background color
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26940 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/models')
-rw-r--r--utils/themeeditor/models/parsetreemodel.cpp8
-rw-r--r--utils/themeeditor/models/parsetreenode.cpp32
-rw-r--r--utils/themeeditor/models/parsetreenode.h6
3 files changed, 43 insertions, 3 deletions
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp
index 762443f4a5..41cecc4c20 100644
--- a/utils/themeeditor/models/parsetreemodel.cpp
+++ b/utils/themeeditor/models/parsetreemodel.cpp
@@ -23,6 +23,7 @@
23#include "parsetreemodel.h" 23#include "parsetreemodel.h"
24#include "symbols.h" 24#include "symbols.h"
25#include "rbscreen.h" 25#include "rbscreen.h"
26#include "rbrenderinfo.h"
26 27
27#include <cstdlib> 28#include <cstdlib>
28 29
@@ -280,5 +281,12 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project)
280 RBScreen* screen = new RBScreen(project); 281 RBScreen* screen = new RBScreen(project);
281 scene->addItem(screen); 282 scene->addItem(screen);
282 283
284 RBRenderInfo info(this, project, screen);
285
286 /* Rendering the tree */
287 if(root)
288 root->render(info);
289
290
283 return scene; 291 return scene;
284} 292}
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp
index 397031aee1..97beca4c3d 100644
--- a/utils/themeeditor/models/parsetreenode.cpp
+++ b/utils/themeeditor/models/parsetreenode.cpp
@@ -98,6 +98,12 @@ ParseTreeNode::ParseTreeNode(skin_tag_parameter *data, ParseTreeNode *parent)
98 98
99} 99}
100 100
101ParseTreeNode::~ParseTreeNode()
102{
103 for(int i = 0; i < children.count(); i++)
104 delete children[i];
105}
106
101QString ParseTreeNode::genCode() const 107QString ParseTreeNode::genCode() const
102{ 108{
103 QString buffer = ""; 109 QString buffer = "";
@@ -467,8 +473,28 @@ ParseTreeNode* ParseTreeNode::getParent() const
467 return parent; 473 return parent;
468} 474}
469 475
470ParseTreeNode::~ParseTreeNode() 476void ParseTreeNode::render(const RBRenderInfo& info)
471{ 477{
472 for(int i = 0; i < children.count(); i++) 478 /* Parameters don't get rendered */
473 delete children[i]; 479 if(!element && param)
480 return;
481
482 /* If we're at the root, we need to render each viewport */
483 if(!element && !param)
484 {
485 for(int i = 0; i < children.count(); i++)
486 {
487 children[i]->render(info);
488 }
489
490 return;
491 }
492
493 switch(element->type)
494 {
495 case VIEWPORT:
496 rendered = new RBViewport(element, info);
497 break;
498 }
474} 499}
500
diff --git a/utils/themeeditor/models/parsetreenode.h b/utils/themeeditor/models/parsetreenode.h
index 7a0807bb0d..bfbd5968d3 100644
--- a/utils/themeeditor/models/parsetreenode.h
+++ b/utils/themeeditor/models/parsetreenode.h
@@ -23,6 +23,9 @@
23#define PARSETREENODE_H 23#define PARSETREENODE_H
24 24
25#include "skin_parser.h" 25#include "skin_parser.h"
26#include "rbviewport.h"
27#include "rbscreen.h"
28#include "rbrenderinfo.h"
26 29
27#include <QString> 30#include <QString>
28#include <QVariant> 31#include <QVariant>
@@ -56,6 +59,8 @@ public:
56 return 0; 59 return 0;
57 } 60 }
58 61
62 void render(const RBRenderInfo& info);
63
59private: 64private:
60 ParseTreeNode* parent; 65 ParseTreeNode* parent;
61 struct skin_element* element; 66 struct skin_element* element;
@@ -63,6 +68,7 @@ private:
63 QList<ParseTreeNode*> children; 68 QList<ParseTreeNode*> children;
64 69
65 static int openConditionals; 70 static int openConditionals;
71 QGraphicsItem* rendered;
66 72
67}; 73};
68 74