[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Thu Dec 9 01:56:58 CET 2004


CVS commit by arwalker: 

Retain the order of curves when editing a plot.

CCMAIL: 94344-done at bugs.kde.org


  M +1 -3      kst2dplot.h   1.126
  M +29 -20    kstplotdialog_i.cpp   1.113


--- kdeextragear-2/kst/kst/kst2dplot.h  #1.125:1.126
@@ -173,4 +173,5 @@ public:
 
   KstBaseCurveList Curves;
+  KstImageList _images;
 
   void GenerateDefaultLabels();
@@ -429,7 +430,4 @@ private:
   int _autoTickYLast;
   
-  //the list of more than one image
-  KstImageList _images;
-
   // plot markers. This needs to remain sorted
   KstMarkerList _plotMarkers;

--- kdeextragear-2/kst/kst/kstplotdialog_i.cpp  #1.112:1.113
@@ -1187,6 +1187,13 @@ void KstPlotDialogI::updateCurveLists() 
     KstViewObjectPtr obj = static_cast<KstViewWindow*>(c)->view()->findChild(Select->currentText());
     Kst2DPlotPtr plot = kst_cast<Kst2DPlot>(obj);
-    if (!plot) {
-      return;
+
+    if (plot) {
+      //
+      // add curves while retaining the order in the plot...
+      //
+      for (KstBaseCurveList::iterator it = plot->Curves.begin(); it != plot->Curves.end(); it++) {
+        (*it)->readLock();
+        DisplayedCurveList->insertItem((*it)->tagName());
+        (*it)->readUnlock();
     }
     for (KstBaseCurveList::iterator it = curves.begin(); it != curves.end(); it++) {
@@ -1194,6 +1201,4 @@ void KstPlotDialogI::updateCurveLists() 
       if (plot->Curves.find(*it) == plot->Curves.end()) {
         AvailableCurveList->insertItem((*it)->tagName());
-      } else {
-        DisplayedCurveList->insertItem((*it)->tagName());
       }
       (*it)->readUnlock();
@@ -1201,15 +1206,19 @@ void KstPlotDialogI::updateCurveLists() 
     
     //
-    // add images as well
+      // add images while retaining the order in the plot...
     //
-    for (KstImageList::iterator it = images.begin(); it != images.end(); it++) {
+      for (KstImageList::iterator it = plot->_images.begin(); it != plot->_images.end(); it++) {
       (*it)->readLock();
-      if (plot->hasImage(*it)) {
         DisplayedCurveList->insertItem((*it)->tagName());
-      } else {
+        (*it)->readUnlock();
+      }
+      for (KstImageList::iterator it = images.begin(); it != images.end(); it++) {      
+        (*it)->readLock();
+        if (!plot->hasImage(*it)) {
         AvailableCurveList->insertItem((*it)->tagName());
       }
       (*it)->readUnlock();
     }
+    }
   } else {
     for (KstBaseCurveList::iterator it = curves.begin(); it != curves.end(); it++) {





More information about the Kst mailing list