[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Mon Dec 19 18:04:02 CET 2005


SVN commit 489749 by staikos:

two bugs in 2dplot curve handling:
1) Don't allow dupes in the curve list
2) Don't remove the curves of another plot from the legend


 M  +16 -10    kst2dplot.cpp  


--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #489748:489749
@@ -773,21 +773,27 @@
 
 
 void Kst2DPlot::addCurve(KstBaseCurvePtr incurve) {
-  Curves.append(incurve);
-  setDirty();
-  KstApp::inst()->document()->setModified();
-  if (KstViewLegendPtr vl = legend()) {
-    vl->addCurve(incurve);
+  if (!Curves.contains(incurve)) {
+    Curves.append(incurve);
+    setDirty();
+    KstApp::inst()->document()->setModified();
+    if (KstViewLegendPtr vl = legend()) {
+      vl->addCurve(incurve);
+    }
   }
 }
 
 
 void Kst2DPlot::clearCurves() {
-  Curves.clear();
-  setDirty();
-  KstApp::inst()->document()->setModified();
-  if (KstViewLegendPtr vl = legend()) {
-    vl->clear();
+  if (!Curves.isEmpty()) {
+    if (KstViewLegendPtr vl = legend()) {
+      for (KstBaseCurveList::ConstIterator i = Curves.begin(); i != Curves.end(); ++i) {
+        vl->removeCurve(*i);
+      }
+    }
+    Curves.clear();
+    setDirty();
+    KstApp::inst()->document()->setModified();
   }
 }
 


More information about the Kst mailing list