Bug 94344 - kst automatically re-orders curves
Summary: kst automatically re-orders curves
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.0.0
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-03 20:04 UTC by D. V. Wiebe
Modified: 2004-12-09 01:57 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description D. V. Wiebe 2004-12-03 20:04:37 UTC
Version:           1.0.0 (using KDE 3.3.1, compiled sources)
Compiler:          gcc version 3.3.4
OS:                Linux (i686) release 2.6.9

Editing a plot (ie. changing axes, labels, &c.) has the unfortunate side effect that it re-orders the diplayed objects in the plot.  This is undesirable if you have one curve that you want to see on top of another curve.
Comment 1 Andrew Walker 2004-12-09 01:57:05 UTC
CVS commit by arwalker: 

Retain the order of curves when editing a plot.

CCMAIL: 94344-done@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++) {