Theme Editor: Added rendering support for some more tags
authorbieber <bieber@a1c6a512-1295-4272-9138-f99709370657>
Wed, 23 Jun 2010 19:41:30 +0000 (23 19:41 +0000)
committerbieber <bieber@a1c6a512-1295-4272-9138-f99709370657>
Wed, 23 Jun 2010 19:41:30 +0000 (23 19:41 +0000)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27094 a1c6a512-1295-4272-9138-f99709370657

utils/themeeditor/graphics/rbscreen.cpp
utils/themeeditor/graphics/rbscreen.h
utils/themeeditor/graphics/rbviewport.h
utils/themeeditor/models/parsetreenode.cpp

index 0a04037..004d2e0 100644 (file)
@@ -117,6 +117,18 @@ void RBScreen::setBackdrop(QString filename)
         backdrop = 0;
 }
 
+void RBScreen::makeCustomUI(QString id)
+{
+    if(namedViewports.value(id, 0) != 0)
+    {
+        QMap<QString, RBViewport*>::iterator i;
+        for(i = namedViewports.begin(); i != namedViewports.end(); i++)
+            (*i)->clearCustomUI();
+        namedViewports.value(id)->makeCustomUI();
+        namedViewports.value(id)->show();
+    }
+}
+
 QColor RBScreen::stringToColor(QString str, QColor fallback)
 {
 
index bc44071..51fa32c 100644 (file)
@@ -59,6 +59,7 @@ public:
     RBImage* getImage(QString name){ return images.value(name, 0); }
 
     void setBackdrop(QString filename);
+    void makeCustomUI(QString id);
 
     static QColor stringToColor(QString str, QColor fallback);
 
index 6f67bae..29d0b0a 100644 (file)
@@ -40,6 +40,12 @@ public:
     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
                QWidget *widget);
 
+    void setBGColor(QColor color){ background = color; }
+    void setFGColor(QColor color){ foreground = color; }
+    void makeCustomUI(){ customUI = true; }
+    void clearCustomUI(){ customUI = false; }
+
+
     void newline();
 
 private:
index 896a23e..edae4f0 100644 (file)
@@ -592,6 +592,42 @@ void ParseTreeNode::render(const RBRenderInfo &info, RBViewport* viewport)
 
             break;
 
+        case 'V':
+
+            switch(element->tag->name[1])
+            {
+
+            case 'b':
+                /* %Vb */
+                viewport->setBGColor(RBScreen::
+                                     stringToColor(QString(element->params[0].
+                                                           data.text),
+                                                   Qt::white));
+                break;
+
+            case 'd':
+                /* %Vd */
+                id = element->params[0].data.text;
+                info.screen()->showViewport(id);
+                break;
+
+            case 'f':
+                /* %Vf */
+                viewport->setFGColor(RBScreen::
+                                     stringToColor(QString(element->params[0].
+                                                           data.text),
+                                                   Qt::black));
+                break;
+
+            case 'I':
+                /* %VI */
+                info.screen()->makeCustomUI(element->params[0].data.text);
+                break;
+
+            }
+
+            break;
+
         case 'X':
 
             switch(element->tag->name[1])