[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Mar 16 00:11:01 CET 2005


CVS commit by staikos: 

rework equation update:
1) update VectorsUsed first (!!)
2) only FillY when the vectors used have changed, the x vector has changed, or
a forced update happens
3) Return a proper return code


  M +14 -3     kstequation.cpp   1.24


--- kdeextragear-2/kst/kst/kstequation.cpp  #1.23:1.24
@@ -177,4 +177,6 @@ bool KstEquation::isValid() const {
 KstObject::UpdateType KstEquation::update(int update_counter) {
   bool force = false;
+  bool xUpdated = false;
+  bool usedUpdated = false;
 
   if (!_pe) {
@@ -193,5 +195,5 @@ KstObject::UpdateType KstEquation::updat
       ctx.sampleCount = _ns;
       ctx.xVector = *_xVector;
-      _pe->update(update_counter, &ctx);
+      xUpdated = KstObject::UPDATE == _pe->update(update_counter, &ctx);
     }
   }
@@ -204,10 +206,19 @@ KstObject::UpdateType KstEquation::updat
   }
 
+  // Update used vectors
+  for (KstVectorMap::Iterator i = VectorsUsed.begin(); i != VectorsUsed.end(); ++i) {
+    usedUpdated = (KstObject::UPDATE == (*i)->update(update_counter)) || usedUpdated;
+  }
+
   KstVectorPtr v = *_xVector;
+  KstObject::UpdateType rc = NO_CHANGE;
+  if (force || xUpdated || usedUpdated) {
   _isValid = FillY(force);
+    rc = UPDATE;
+  }
   v = *_yVector;
   v->update(update_counter);
 
-  return setLastUpdateResult(UPDATE);
+  return setLastUpdateResult(rc);
 }
 




More information about the Kst mailing list