[Kst] extragear/graphics/kst/src/libkstapp

Andrew Walker arwalker at sumusltd.com
Fri May 5 01:25:29 CEST 2006


SVN commit 537509 by arwalker:

add item to view manager when curves are dragged-and-dropped within the view manager

 M  +4 -1      kst2dplot.cpp  
 M  +1 -1      kst2dplot.h  
 M  +9 -2      kstviewmanager_i.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.cpp #537508:537509
@@ -822,7 +822,7 @@
 }
 
 
-void Kst2DPlot::addCurve(KstBaseCurvePtr incurve) {
+bool Kst2DPlot::addCurve(KstBaseCurvePtr incurve) {
   if (!Curves.contains(incurve)) {
     Curves.append(incurve);
     setDirty();
@@ -830,7 +830,10 @@
     if (KstViewLegendPtr vl = legend()) {
       vl->addCurve(incurve);
     }
+    return true;
   }
+  
+  return false;
 }
 
 
--- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.h #537508:537509
@@ -110,7 +110,7 @@
   void drawDotAt(QPainter& p, double x, double y);
   void drawPlusAt(QPainter& p, double x, double y);
   void internalAlignment(KstPainter& p, QRect& plotRegion);
-  void addCurve(KstBaseCurvePtr curve);
+  bool addCurve(KstBaseCurvePtr curve);
   void removeCurve(KstBaseCurvePtr curve);
   void clearCurves();
   void setXScaleMode(KstScaleModeType scalemode);
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewmanager_i.cpp #537508:537509
@@ -200,14 +200,21 @@
           QByteArray data = e->encodedData("application/x-kst-curve-list");
           QDataStream ds(data, IO_ReadOnly);
           QStringList entries;
+          bool added = false;
+          
           ds >> entries;
           for (QStringList::ConstIterator i = entries.begin(); i != entries.end(); ++i) {
             KstBaseCurveList::Iterator it = curves.findTag(*i);
             if (it != curves.end()) {
-              plot->addCurve(*it);
+              if (plot->addCurve(*it)) {
+                new KstViewObjectItem(this, *it, _vm);
+                added = true;
+              }
             }
           }
-          win->view()->paint(KstPainter::P_PLOT);
+          if (added) {          
+            win->view()->paint(KstPainter::P_PLOT);
+          }
           accepted = true;
         }
       }


More information about the Kst mailing list