[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Tue Dec 20 15:45:31 CET 2005


SVN commit 490029 by staikos:

Remove curves from the legend too - another case of not using the accessor.
Also some minor cleanups and a FIXME for something that could be inefficient.
BUG: 118457


 M  +2 -4      kst2dplot.cpp  
 M  +1 -1      kstdatacollection-gui.cpp  
 M  +7 -27     kstiface_impl.cpp  
 M  +4 -1      kstplotdialog_i.cpp  


--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #490028:490029
@@ -3176,17 +3176,15 @@
 void Kst2DPlot::removeCurve(int id) {
   KstBaseCurvePtr curve = *(Curves.findTag(_curveRemoveMap[id]));
   if (curve) {
-    Curves.remove(curve);
-    setDirty();
+    removeCurve(curve);
     if (_menuView) {
       _menuView->paint();
     }
-    KstApp::inst()->document()->setModified();
   }
 }
 
 
-bool Kst2DPlot::popupMenu (KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topLevelParent) {
+bool Kst2DPlot::popupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topLevelParent) {
   bool hasEntry = false;
   KstMouseModeType mode;
 
--- trunk/extragear/graphics/kst/kst/kstdatacollection-gui.cpp #490028:490029
@@ -229,7 +229,7 @@
 void KST::removeCurveFromPlots(KstBaseCurve *c) {
   Kst2DPlotList pl = Kst2DPlot::globalPlotList();
   for (Kst2DPlotList::Iterator i = pl.begin(); i != pl.end(); ++i) {
-    (*i)->Curves.remove(c);
+    (*i)->removeCurve(c);
   }
 }
 
--- trunk/extragear/graphics/kst/kst/kstiface_impl.cpp #490028:490029
@@ -660,6 +660,7 @@
   return false;
 }
 
+
 QStringList KstIfaceImpl::plotContents(const QString& name) {
   //iterate through the windows until plot is found
   KstApp *app = KstApp::inst();
@@ -681,6 +682,7 @@
   return QStringList();
 }
 
+
 bool KstIfaceImpl::addCurveToPlot(KMdiChildView *win, const QString& plot, const QString& curve) {
   KstViewWindow *w = dynamic_cast<KstViewWindow*>(win);
 
@@ -693,13 +695,8 @@
         KstBaseCurveList::Iterator ci = bcl.findTag(curve);
         Kst2DPlotPtr p = *(plots.findTag(plot));
         if (p && ci != bcl.end()) {
-          (*ci)->writeLock();
           p->addCurve(*ci);
-          (*ci)->writeUnlock();
-
           _doc->forceUpdate();
-          _doc->setModified();
-
           return true;
         }
       }
@@ -711,18 +708,12 @@
 
 
 bool KstIfaceImpl::addCurveToPlot(const QString& window, const QString& plot, const QString& curve) {
-  KstApp *app = KstApp::inst();
-  KMdiChildView *activewin = app->findWindow(window);
-
-  return addCurveToPlot(activewin, plot, curve);
+  return addCurveToPlot(KstApp::inst()->findWindow(window), plot, curve);
 }
 
 
 bool KstIfaceImpl::addCurveToPlot(const QString& plot, const QString& curve) {
-  KstApp *app = KstApp::inst();
-  KMdiChildView *activewin = app->activeWindow();
-
-  return addCurveToPlot(activewin, plot, curve);
+  return addCurveToPlot(KstApp::inst()->activeWindow(), plot, curve);
 }
 
 
@@ -738,13 +729,8 @@
         KstBaseCurveList bcl = kstObjectSubList<KstDataObject,KstBaseCurve>(KST::dataObjectList);
         KstBaseCurveList::Iterator ci = bcl.findTag(curve);
         if (p && ci != bcl.end()) {
-          (*ci)->readLock();
-          p->Curves.remove(*ci);
-          (*ci)->readUnlock();
-
+          p->removeCurve(*ci);
           _doc->forceUpdate();
-          _doc->setModified();
-
           return true;
         }
       }
@@ -755,18 +741,12 @@
 }
 
 bool KstIfaceImpl::removeCurveFromPlot(const QString& window, const QString& plot, const QString& curve) {
-  KstApp *app = KstApp::inst();
-  KMdiChildView *activewin = app->findWindow(window);
-
-  return removeCurveFromPlot(activewin, plot, curve);
+  return removeCurveFromPlot(KstApp::inst()->findWindow(window), plot, curve);
 }
 
 
 bool KstIfaceImpl::removeCurveFromPlot(const QString& plot, const QString& curve) {
-  KstApp *app = KstApp::inst();
-  KMdiChildView *activewin = app->activeWindow();
-
-  return removeCurveFromPlot(activewin, plot, curve);
+  return removeCurveFromPlot(KstApp::inst()->activeWindow(), plot, curve);
 }
 
 
--- trunk/extragear/graphics/kst/kst/kstplotdialog_i.cpp #490028:490029
@@ -817,9 +817,12 @@
     static_cast<KstViewWindow*>(c)->view()->cleanup(_plotColumns->value());
   }
 
+  // FIXME: be more efficient here.  Only remove the curves that we need, only
+  //        add the curves that we need
+
   // add the curves
   KstBaseCurveList curves = kstObjectSubList<KstDataObject, KstBaseCurve>(KST::dataObjectList);
-  plot->Curves.clear();
+  plot->clearCurves();
   for (unsigned i = 0; i < DisplayedCurveList->count(); i++) {
     KstBaseCurveList::Iterator it = curves.findTag(DisplayedCurveList->text(i));
     if (it != curves.end()) {


More information about the Kst mailing list