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

Barth Netterfield netterfield at astro.utoronto.ca
Thu Jul 17 00:53:38 CEST 2008


SVN commit 833516 by netterfield:

primitives gain an immediateUpdate command, which propogates an update
(including dependents) immediately.

primitives get an updated() signal, replacing matrixUpdated, 
vectorUpdated, and scalarUpdated().



 M  +1 -1      libkst/datavector.cpp  
 M  +0 -8      libkst/matrix.cpp  
 M  +0 -5      libkst/matrix.h  
 M  +16 -0     libkst/primitive.cpp  
 M  +5 -0      libkst/primitive.h  
 M  +0 -8      libkst/scalar.cpp  
 M  +0 -3      libkst/scalar.h  
 M  +0 -9      libkst/vector.cpp  
 M  +0 -4      libkst/vector.h  
 M  +8 -8      libkstapp/mainwindow.cpp  
 M  +2 -2      libkstmath/csd.cpp  
 M  +12 -12    libkstmath/curve.cpp  
 M  +0 -1      libkstmath/dataobject.cpp  
 M  +1 -0      libkstmath/dataobject.h  
 M  +3 -3      libkstmath/equation.cpp  
 M  +1 -1      libkstmath/histogram.cpp  
 M  +6 -6      libkstmath/image.cpp  
 M  +1 -1      libkstmath/psd.cpp  


--- branches/work/kst/portto4/kst/src/libkst/datavector.cpp #833515:833516
@@ -88,7 +88,7 @@
 #if DEBUG_UPDATE_CYCLE > 1
   qDebug() << "UP - Vector" << shortName() << "has been updated as part of update of" << object->shortName() << "informing dependents";
 #endif
-    emit vectorUpdated(object);
+    emit updated(object);
   }
   UpdateManager::self()->updateFinished(object, this);
   unlock();
--- branches/work/kst/portto4/kst/src/libkst/matrix.cpp #833515:833516
@@ -615,14 +615,6 @@
   setDirty();
 }
 
-
-void Matrix::triggerUpdateSignal(ObjectPtr object) {
-#if DEBUG_UPDATE_CYCLE > 1
-  qDebug() << "UP - Matrix" << shortName() << "has been updated as part of update of" << object->shortName() << "informing dependents";
-#endif
-  emit matrixUpdated(object);
-}
-
 QString Matrix::descriptionTip() const {
     QString tip;
   //QString range_string;
--- branches/work/kst/portto4/kst/src/libkst/matrix.h #833515:833516
@@ -136,11 +136,6 @@
 
     virtual void deleteDependents();
 
-    void triggerUpdateSignal(ObjectPtr object);
-
-  Q_SIGNALS:
-    void matrixUpdated(ObjectPtr object);
-
   protected:
     int _NS;
     int _NRealS; // number of samples with real values
--- branches/work/kst/portto4/kst/src/libkst/primitive.cpp #833515:833516
@@ -21,6 +21,7 @@
 
 #include "kst_i18n.h"
 #include "primitive.h"
+#include "updatemanager.h"
 
 #include <assert.h>
 
@@ -91,6 +92,21 @@
   return name;
 }
 
+void Primitive::triggerUpdateSignal(ObjectPtr object) {
+#if DEBUG_UPDATE_CYCLE > 1
+  qDebug() << "UP - Primitive" << shortName() << "has been updated as part of update of" << object->shortName() << "informing dependents";
+#endif
+  emit updated(object);
 }
 
+
+void Primitive::immediateUpdate() {
+  UpdateManager::self()->updateStarted(this,this);
+  update();
+  triggerUpdateSignal(this);
+  UpdateManager::self()->updateFinished(this,this);
+}
+
+}
+
 // vim: et sw=2 ts=2
--- branches/work/kst/portto4/kst/src/libkst/primitive.h #833515:833516
@@ -43,10 +43,15 @@
     /** Update the primitive via the provider and/or internalUpdate().
         Return true if there was new data. */
     UpdateType update();
+    void immediateUpdate();
 
     void setSlaveName(QString slaveName);
     QString slaveName() { return _slaveName; }
+    void triggerUpdateSignal(ObjectPtr object);
 
+  Q_SIGNALS:
+    void updated(ObjectPtr object);
+
   protected:
     Primitive(ObjectStore *store, Object* provider = 0L);
 
--- branches/work/kst/portto4/kst/src/libkst/scalar.cpp #833515:833516
@@ -152,14 +152,6 @@
   _editable = editable;
 }
 
-
-void Scalar::triggerUpdateSignal(ObjectPtr object) {
-#if DEBUG_UPDATE_CYCLE > 1
-  qDebug() << "UP - Scalar" << shortName() << "has been updated as part of update of" << object->shortName() << "informing dependents";
-#endif
-  emit scalarUpdated(object);
-}
-
 QString Scalar::descriptionTip() const {
   if (_provider) {
     return i18n("Scalar: %1 = %2\n%3").arg(Name()).arg(value()).arg(_provider->descriptionTip());
--- branches/work/kst/portto4/kst/src/libkst/scalar.h #833515:833516
@@ -60,8 +60,6 @@
 
     Scalar& operator=(double v);
 
-    void triggerUpdateSignal(ObjectPtr object);
-
     virtual QString descriptionTip() const;
 
   public slots:
@@ -81,7 +79,6 @@
 
   signals:
     void trigger();
-    void scalarUpdated(ObjectPtr object);
 
   private:
     double _value;
--- branches/work/kst/portto4/kst/src/libkst/vector.cpp #833515:833516
@@ -517,15 +517,6 @@
   return NO_CHANGE;
 }
 
-
-void Vector::triggerUpdateSignal(ObjectPtr object) {
-#if DEBUG_UPDATE_CYCLE > 1
-  qDebug() << "UP - Vector" << shortName() << "has been updated as part of update of" << object->shortName() << "informing dependents";
-#endif
-  emit vectorUpdated(object);
-}
-
-
 void Vector::save(QXmlStreamWriter &s) {
   if (provider()) {
     return;
--- branches/work/kst/portto4/kst/src/libkst/vector.h #833515:833516
@@ -146,11 +146,7 @@
     bool saveData() const;
     virtual void setSaveData(bool save);
 
-    void triggerUpdateSignal(ObjectPtr object);
-
     virtual QString descriptionTip() const;
-  Q_SIGNALS:
-    void vectorUpdated(ObjectPtr object);
 
   protected:
     /** current number of samples */
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #833515:833516
@@ -45,15 +45,15 @@
 #include "changedatasampledialog.h"
 #include "changefiledialog.h"
 #include "datawizard.h"
+#include "datavector.h"
 
 #include <QtGui>
 
 //FIXME Temporaries REMOVE!!
-#include "editablevector.h"
-#include "generatedvector.h"
-#include "datacollection.h"
-#include "equation.h"
-#include "datavector.h"
+//#include "editablevector.h"
+//#include "generatedvector.h"
+//#include "datacollection.h"
+//#include "equation.h"
 
 namespace Kst {
 
@@ -809,7 +809,7 @@
 
     v->writeLock();
     v->changeFrames(-1, nf, skip, do_skip, do_filter);
-    v->update();
+    v->immediateUpdate();
     v->unlock();
   }
 } 
@@ -850,7 +850,7 @@
 
       v->writeLock(); 
       v->changeFrames(f0, nf, skip, do_skip, do_filter);
-      v->update();
+      v->immediateUpdate();
       v->unlock();
     }
   }
@@ -896,7 +896,7 @@
 
       v->writeLock(); 
       v->changeFrames(f0, nf, skip, do_skip, do_filter);
-      v->update();
+      v->immediateUpdate();
       v->unlock();
     }
   }
--- branches/work/kst/portto4/kst/src/libkstmath/csd.cpp #833515:833516
@@ -53,7 +53,7 @@
     const QString& in_rateUnits) {
 
   if (_inputVectors[INVECTOR]) {
-    disconnect(_inputVectors[INVECTOR], SIGNAL(vectorUpdated(ObjectPtr)));
+    disconnect(_inputVectors[INVECTOR], SIGNAL(updated(ObjectPtr)));
   }
 
   _inputVectors[INVECTOR] = in_V;
@@ -92,7 +92,7 @@
     max_csdnum = _csdnum;
   _csdnum++;
 
-  connect(_inputVectors[INVECTOR], SIGNAL(vectorUpdated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
+  connect(_inputVectors[INVECTOR], SIGNAL(updated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
 
   setDirty();
 }
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #833515:833516
@@ -344,9 +344,9 @@
 void Curve::setXVector(VectorPtr new_vx) {
   if (new_vx) {
     _inputVectors[COLOR_XVECTOR] = new_vx;
-    connect(new_vx, SIGNAL(vectorUpdated(ObjectPtr)), this, SLOT(vectorUpdated(ObjectPtr)));
+    connect(new_vx, SIGNAL(updated(ObjectPtr)), this, SLOT(vectorUpdated(ObjectPtr)));
   } else {
-    disconnect(_inputVectors[COLOR_XVECTOR], SIGNAL(vectorUpdated(ObjectPtr)));
+    disconnect(_inputVectors[COLOR_XVECTOR], SIGNAL(updated(ObjectPtr)));
     _inputVectors.remove(COLOR_XVECTOR);
   }
   setDirty();
@@ -356,9 +356,9 @@
 void Curve::setYVector(VectorPtr new_vy) {
   if (new_vy) {
     _inputVectors[COLOR_YVECTOR] = new_vy;
-    connect(new_vy, SIGNAL(vectorUpdated(ObjectPtr)), this, SLOT(vectorUpdated(ObjectPtr)));
+    connect(new_vy, SIGNAL(updated(ObjectPtr)), this, SLOT(vectorUpdated(ObjectPtr)));
   } else {
-    disconnect(_inputVectors[COLOR_YVECTOR], SIGNAL(vectorUpdated(ObjectPtr)));
+    disconnect(_inputVectors[COLOR_YVECTOR], SIGNAL(updated(ObjectPtr)));
     _inputVectors.remove(COLOR_YVECTOR);
   }
   setDirty();
@@ -368,10 +368,10 @@
 void Curve::setXError(VectorPtr new_ex) {
   if (new_ex) {
     _inputVectors[EXVECTOR] = new_ex;
-    connect(new_ex, SIGNAL(vectorUpdated(ObjectPtr)), this, SLOT(vectorUpdated(ObjectPtr)));
+    connect(new_ex, SIGNAL(updated(ObjectPtr)), this, SLOT(vectorUpdated(ObjectPtr)));
   } else {
     if (_inputVectors[EXVECTOR]) {
-      disconnect(_inputVectors[EXVECTOR], SIGNAL(vectorUpdated(ObjectPtr)));
+      disconnect(_inputVectors[EXVECTOR], SIGNAL(updated(ObjectPtr)));
     }
     _inputVectors.remove(EXVECTOR);
   }
@@ -382,10 +382,10 @@
 void Curve::setYError(VectorPtr new_ey) {
   if (new_ey) {
     _inputVectors[EYVECTOR] = new_ey;
-    connect(new_ey, SIGNAL(vectorUpdated(ObjectPtr)), this, SLOT(vectorUpdated(ObjectPtr)));
+    connect(new_ey, SIGNAL(updated(ObjectPtr)), this, SLOT(vectorUpdated(ObjectPtr)));
   } else {
     if (_inputVectors[EYVECTOR]) {
-      disconnect(_inputVectors[EYVECTOR], SIGNAL(vectorUpdated(ObjectPtr)));
+      disconnect(_inputVectors[EYVECTOR], SIGNAL(updated(ObjectPtr)));
     }
     _inputVectors.remove(EYVECTOR);
   }
@@ -396,10 +396,10 @@
 void Curve::setXMinusError(VectorPtr new_ex) {
   if (new_ex) {
     _inputVectors[EXMINUSVECTOR] = new_ex;
-    connect(new_ex, SIGNAL(vectorUpdated(ObjectPtr)), this, SLOT(vectorUpdated(ObjectPtr)));
+    connect(new_ex, SIGNAL(updated(ObjectPtr)), this, SLOT(vectorUpdated(ObjectPtr)));
   } else {
     if (_inputVectors[EXMINUSVECTOR]) {
-      disconnect(_inputVectors[EXMINUSVECTOR], SIGNAL(vectorUpdated(ObjectPtr)));
+      disconnect(_inputVectors[EXMINUSVECTOR], SIGNAL(updated(ObjectPtr)));
     }
     _inputVectors.remove(EXMINUSVECTOR);
   }
@@ -410,10 +410,10 @@
 void Curve::setYMinusError(VectorPtr new_ey) {
   if (new_ey) {
     _inputVectors[EYMINUSVECTOR] = new_ey;
-    connect(new_ey, SIGNAL(vectorUpdated(ObjectPtr)), this, SLOT(vectorUpdated(ObjectPtr)));
+    connect(new_ey, SIGNAL(updated(ObjectPtr)), this, SLOT(vectorUpdated(ObjectPtr)));
   } else {
     if (_inputVectors[EYMINUSVECTOR]) {
-      disconnect(_inputVectors[EYMINUSVECTOR], SIGNAL(vectorUpdated(ObjectPtr)));
+      disconnect(_inputVectors[EYMINUSVECTOR], SIGNAL(updated(ObjectPtr)));
     }
     _inputVectors.remove(EYMINUSVECTOR);
   }
--- branches/work/kst/portto4/kst/src/libkstmath/dataobject.cpp #833515:833516
@@ -845,6 +845,5 @@
   return true;
 }
 
-
 }
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstmath/dataobject.h #833515:833516
@@ -63,6 +63,7 @@
     static DataObjectPtr createPlugin(const QString& name, ObjectStore *store, DataObjectConfigWidget *configWidget, bool setupInputsOutputs = true);
 
     virtual UpdateType update() = 0;
+
     virtual const QString& typeString() const { return _typeString; }
     virtual QString propertyString() const = 0;
     virtual const QString& type() const { return _type; }
--- branches/work/kst/portto4/kst/src/libkstmath/equation.cpp #833515:833516
@@ -266,10 +266,10 @@
   if (_isValid) {
     _equation = reparsedEquation(); // update the string
     foreach (VectorPtr vector, VectorsUsed) {
-      connect(vector, SIGNAL(vectorUpdated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
+      connect(vector, SIGNAL(updated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
     }
     foreach (ScalarPtr scalar, ScalarsUsed) {
-      connect(scalar, SIGNAL(scalarUpdated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
+      connect(scalar, SIGNAL(updated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
     }
   }
 }
@@ -287,7 +287,7 @@
   _xInVector = in_xv;
   _inputVectors.insert(XINVECTOR, in_xv);
 
-  connect(in_xv, SIGNAL(vectorUpdated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
+  connect(in_xv, SIGNAL(updated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
 
   _ns = 2; // reset the updating
   _doInterp = do_interp;
--- branches/work/kst/portto4/kst/src/libkstmath/histogram.cpp #833515:833516
@@ -262,7 +262,7 @@
 
 void Histogram::setVector(VectorPtr new_v) {
   if (new_v) {
-    connect(new_v, SIGNAL(vectorUpdated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
+    connect(new_v, SIGNAL(updated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
     _inputVectors[RAWVECTOR] = new_v;
   }
 }
--- branches/work/kst/portto4/kst/src/libkstmath/image.cpp #833515:833516
@@ -217,7 +217,7 @@
     double upperZ, bool autoThreshold, const QString &paletteName) {
 
   if (_inputMatrices[THEMATRIX]) {
-    disconnect(_inputMatrices[THEMATRIX], SIGNAL(matrixUpdated(ObjectPtr)));
+    disconnect(_inputMatrices[THEMATRIX], SIGNAL(updated(ObjectPtr)));
   }
 
   _inputMatrices[THEMATRIX] = in_matrix;
@@ -231,7 +231,7 @@
   _hasColorMap = true;
   _hasContourMap = false;
 
-  connect(in_matrix, SIGNAL(matrixUpdated(ObjectPtr)), this, SLOT(matrixUpdated(ObjectPtr)));
+  connect(in_matrix, SIGNAL(updated(ObjectPtr)), this, SLOT(matrixUpdated(ObjectPtr)));
 
   setDirty();
 }
@@ -241,7 +241,7 @@
     const QColor& contourColor, int contourWeight) {
 
   if (_inputMatrices[THEMATRIX]) {
-    disconnect(_inputMatrices[THEMATRIX], SIGNAL(matrixUpdated(ObjectPtr)));
+    disconnect(_inputMatrices[THEMATRIX], SIGNAL(updated(ObjectPtr)));
   }
 
   _inputMatrices[THEMATRIX] = in_matrix;
@@ -251,7 +251,7 @@
   _hasColorMap = false;
   _hasContourMap = true;
 
-  connect(in_matrix, SIGNAL(matrixUpdated(ObjectPtr)), this, SLOT(matrixUpdated(ObjectPtr)));
+  connect(in_matrix, SIGNAL(updated(ObjectPtr)), this, SLOT(matrixUpdated(ObjectPtr)));
 
   setDirty();
 }
@@ -262,7 +262,7 @@
     int numContours, const QColor& contourColor, int contourWeight) {
 
   if (_inputMatrices[THEMATRIX]) {
-    disconnect(_inputMatrices[THEMATRIX], SIGNAL(matrixUpdated(ObjectPtr)));
+    disconnect(_inputMatrices[THEMATRIX], SIGNAL(updated(ObjectPtr)));
   }
 
   _inputMatrices[THEMATRIX] = in_matrix;
@@ -279,7 +279,7 @@
   _hasColorMap = true;
   _hasContourMap = true;
 
-  connect(in_matrix, SIGNAL(matrixUpdated(ObjectPtr)), this, SLOT(matrixUpdated(ObjectPtr)));
+  connect(in_matrix, SIGNAL(updated(ObjectPtr)), this, SLOT(matrixUpdated(ObjectPtr)));
 
   setDirty();
 }
--- branches/work/kst/portto4/kst/src/libkstmath/psd.cpp #833515:833516
@@ -307,7 +307,7 @@
   _inputVectors.remove(INVECTOR);
   new_v->writeLock();
   _inputVectors[INVECTOR] = new_v;
-  connect(new_v, SIGNAL(vectorUpdated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
+  connect(new_v, SIGNAL(updated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
   setDirty();
 }
 


More information about the Kst mailing list