[Kst] branches/work/kst/portto4/kst

Barth Netterfield netterfield at astro.utoronto.ca
Thu May 26 02:40:28 CEST 2011


SVN commit 1233562 by netterfield:

BUG: 
The order in the plot dialog contents page was not being respected.

Also, comment out some dead code.



 M  +0 -5      devel-docs/Kst2Specs/Wishlist  
 M  +16 -23    src/libkstapp/plotitemdialog.cpp  
 M  +4 -4      src/libkstapp/plotitemdialog.h  
 M  +9 -0      src/libkstapp/plotrenderitem.cpp  
 M  +1 -0      src/libkstapp/plotrenderitem.h  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Wishlist #1233561:1233562
@@ -1,8 +1,3 @@
-Export eps to vector format.
-  kst 1.x did this by printing to file a .ps file, and then modifying it by adding the bounding box.
-
-------------
-
 Shared axis from the command line
 
 ---------
--- branches/work/kst/portto4/kst/src/libkstapp/plotitemdialog.cpp #1233561:1233562
@@ -177,16 +177,16 @@
   _xMarkersTab->clearTabValues();
   _yMarkersTab->clearTabValues();
   _contentTab->setEnabled(false);
-  foreach(DialogPage* page, _relationPages) {
-    removeDialogPage(page);
+  //foreach(DialogPage* page, _relationPages) {
+  //  removeDialogPage(page);
+  //}
+  //_relationPages.clear();
   }
-  _relationPages.clear();
-}
 
 
 void PlotItemDialog::editSingle() {
   _contentTab->setEnabled(true);
-  updateRelations();
+  //updateRelations();
   setupContent();
   setupAxis();
   setupRange();
@@ -371,6 +371,7 @@
 }
 
 
+#if 0
 void PlotItemDialog::addRelations() {
   foreach (RelationPtr relation, _plotItem->renderItem(PlotRenderItem::Cartesian)->relationList()) {
     if (CurvePtr curve = kst_cast<Curve>(relation)) {
@@ -448,7 +449,6 @@
   }
 }
 
-
 void PlotItemDialog::updateRelations() {
   foreach(DialogPage* page, _relationPages) {
     removeDialogPage(page);
@@ -457,34 +457,26 @@
 
   addRelations();
 }
+#endif
 
 
+
 void PlotItemDialog::contentChanged() {
-  relationChanged();
 
-  QStringList currentRelations;
-  QStringList displayedRelations = _contentTab->displayedRelations();
+  QStringList relation_names = _contentTab->displayedRelations();
+  RelationList relations;
 
-  foreach (RelationPtr relation, _plotItem->renderItem(PlotRenderItem::Cartesian)->relationList()) {
-    currentRelations.append(relation->Name());
-    if (!displayedRelations.contains(relation->Name())) {
-      _plotItem->renderItem(PlotRenderItem::Cartesian)->removeRelation(relation);
-      _plotItem->update();
+  foreach (QString relation_name, relation_names) {
+    if (RelationPtr relation = kst_cast<Relation>(_store->retrieveObject(relation_name))) {
+      relations.append(relation);
     }
-  }
-
-  foreach (QString relationName, displayedRelations) {
-    if (!currentRelations.contains(relationName)) {
-      if (RelationPtr relation = kst_cast<Relation>(_store->retrieveObject(relationName))) {
-        _plotItem->renderItem(PlotRenderItem::Cartesian)->addRelation(relation);
+    _plotItem->renderItem(PlotRenderItem::Cartesian)->setRelationsList(relations);
         _plotItem->update();
       }
-    }
-  }
 
-  updateRelations();
 }
 
+#if 0
 
 void PlotItemDialog::relationChanged() {
   foreach(DialogPage* page, _relationPages) {
@@ -543,6 +535,7 @@
     }
   }
 }
+#endif
 
 
 void PlotItemDialog::rangeChanged() {
--- branches/work/kst/portto4/kst/src/libkstapp/plotitemdialog.h #1233561:1233562
@@ -41,7 +41,7 @@
 
   private Q_SLOTS:
     void contentChanged();
-    void relationChanged();
+    //void relationChanged();
     void xAxisChanged();
     void yAxisChanged();
     void labelsChanged();
@@ -64,8 +64,8 @@
     void setupRange();
     void setupLabels();
     void setupMarkers();
-    void addRelations();
-    void updateRelations();
+    //void addRelations();
+    //void updateRelations();
 
     void saveAxis(PlotAxis *item, AxisTab *axisTab);
     void saveRange(PlotItem *item);
@@ -92,7 +92,7 @@
     DialogPageTab *_labelPage;
 
 
-    QList<DialogPage*> _relationPages;
+    //QList<DialogPage*> _relationPages;
 
     ObjectStore* _store;
 };
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #1233561:1233562
@@ -152,7 +152,16 @@
   plotItem()->zoomMaximum();
 }
 
+void PlotRenderItem::setRelationsList(const RelationList &relations) {
+  _relationList.clear();
 
+  foreach (const RelationPtr & relation, relations) {
+    _relationList.append(relation);
+  }
+  plotItem()->registerChange();
+  UpdateManager::self()->doUpdates(true);
+}
+
 void PlotRenderItem::save(QXmlStreamWriter &xml) {
   Q_UNUSED(xml);
 }
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.h #1233561:1233562
@@ -48,6 +48,7 @@
     void addRelation(RelationPtr relation);
     void removeRelation(RelationPtr relation);
     void clearRelations();
+    void setRelationsList(const RelationList &relations);
 
     virtual void save(QXmlStreamWriter &xml);
     virtual void saveInPlot(QXmlStreamWriter &xml);


More information about the Kst mailing list