[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/kde4/playground/artwork/cokoon/lib
From:       Sandro Giessl <sgiessl () gmail ! com>
Date:       2006-03-01 0:59:58
Message-ID: 1141174798.389487.2356.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 514681 by giessl:

DO switch the object context when properties from different objects are requested...

 M  +4 -3      object.cpp  
 M  +8 -2      tile.cpp  
 M  +7 -4      tilelayout.cpp  
 M  +2 -2      tilesource.cpp  
 M  +2 -0      tilesource.h  


--- branches/work/kde4/playground/artwork/cokoon/lib/object.cpp #514680:514681
@@ -272,8 +272,6 @@
                       int left, int top, int width, int height,
                       const ExpressionVariableBridge *vars) const
 {
-    ExecContext context(this, vars);
-
     m_paintWidth = width;
     m_paintHeight = height;
 
@@ -287,10 +285,13 @@
             QPair<QString, QString> l;
             foreach (l, o->m_paintLayers) {
                 const Object *i;
+                ExecContext context(this, vars);
                 if (l.first.isEmpty() )
                     i = this;
-                else
+                else {
                     i = m_doc->obj(l.first );
+                    context = ExecContext(i, vars);
+                }
 
                 if (i) {
                     const TileLayout *layout = i->layout(l.second );
--- branches/work/kde4/playground/artwork/cokoon/lib/tile.cpp #514680:514681
@@ -74,13 +74,19 @@
 void Tile::paint(const ExecContext *c, QPainter *p,
                         int left, int top, int width, int height) const
 {
+    if (!c)
+        return;
 //     qDebug() << id() << ": paint:" << left << top << "," << width << "x" << \
height;  
+    ExecContext sourceContext(c->obj(), c->vars() );
+
     const Object *si;
     if (m_objId.isEmpty() )
         si = c->obj();
-    else
+    else {
         si = m_obj->doc()->obj(m_objId);
+        sourceContext = ExecContext(si, c->vars() );
+    }
     const TileSource *s;
     if (si && (s = si->tileSource(m_sourceId)) ) {
         int sLeft = eval(c,m_sLeft).toInt();
@@ -96,7 +102,7 @@
             stretchW = width;
         if (m_vertPaintMode == Stretched)
             stretchH = height;
-        QPixmap pm = s->pixmap(c, sLeft, sTop, sWidth, sHeight, stretchW, stretchH);
+        QPixmap pm = s->pixmap(&sourceContext, sLeft, sTop, sWidth, sHeight, \
stretchW, stretchH);  
         if (!pm.isNull() ) {
 //             if (m_horPaintMode == m_vertPaintMode ) {
--- branches/work/kde4/playground/artwork/cokoon/lib/tilelayout.cpp #514680:514681
@@ -168,14 +168,17 @@
         for (int c = 0; c < nc; ++c) {
             QPair<QString, QString> *cell = m_grid[r][c];
             if (cell) {
+                ExecContext ctxt(context->obj(), context->vars() );
                 const Object *i;
-                if (cell->first.isEmpty() )
-                    i = context->obj();
-                else
+                if (cell->first.isEmpty() ) {
+                    i = ctxt.obj();
+                } else {
                     i = m_obj->doc()->obj(cell->first);
+                    ctxt = ExecContext(i, context->vars() );
+                }
                 const Tile *t;
                 if (i && (t = i->tile(cell->second) ) ) {
-                    t->paint(context, p, paintX,paintY, cw[c], rh[r]);
+                    t->paint(&ctxt, p, paintX,paintY, cw[c], rh[r]);
                 } else {
                     qCritical("%s: column %d, row %d: Tile '%s' '%s' does not \
                exist!",
                               qPrintable(id()), c, r, qPrintable(cell->first), \
                qPrintable(cell->second) );
--- branches/work/kde4/playground/artwork/cokoon/lib/tilesource.cpp #514680:514681
@@ -96,7 +96,7 @@
 };
 
 SvgTileSource::SvgTileSource(Object *obj, const QString &id, const QString \
                &fileName)
-    : TileSource(obj,id), m_svg(0)
+    : TileSource(obj,id), m_svg(0), m_fileName(fileName)
 {
     QFile f(fileName);
     if (!f.open(QFile::ReadOnly | QFile::Text)) {
@@ -132,7 +132,7 @@
     }
     m_refBridge.setObjContext(c->obj() );
 
-    QString cacheKey = "$cokoonSvg" + id() + QString::number(left)
+    QString cacheKey = "$cokoonSvg" + m_fileName + QString::number(left)
             + " " + QString::number(top) + " " + QString::number(width)
             + " " + QString::number(height) + " " + QString::number(scaleWidth)
             + " " + QString::number(scaleHeight);
--- branches/work/kde4/playground/artwork/cokoon/lib/tilesource.h #514680:514681
@@ -130,6 +130,8 @@
 
         mutable ObjectPropRefBridge m_refBridge;
 
+        const QString m_fileName;
+
         class SvgTileSourcePrivate * d;
 };
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic