[Kst] branches/kst/1.3/kst/src

Adam Treat treat at kde.org
Sat Oct 7 02:16:59 CEST 2006


SVN commit 593181 by treat:

* Backport for #593180.


 M  +1 -1      libkstapp/ksteqdialog_i.cpp  
 M  +4 -17     libkstmath/kstequation.cpp  
 M  +2 -1      libkstmath/kstequation.h  


--- branches/kst/1.3/kst/src/libkstapp/ksteqdialog_i.cpp #593180:593181
@@ -291,7 +291,7 @@
   }
   
   if (_equationDirty) {
-    eqPtr->setEquation(_w->_equation->text(), true);
+    eqPtr->setEquation(_w->_equation->text());
     if (!eqPtr->isValid()) {
       QString parseErrors;
       for (QStringList::ConstIterator i = Equation::errorStack.begin(); i != Equation::errorStack.end(); ++i) {
--- branches/kst/1.3/kst/src/libkstmath/kstequation.cpp #593180:593181
@@ -262,20 +262,15 @@
 }
 
 
-void KstEquation::setEquation(const QString& in_fn, bool lockData) {
+void KstEquation::setEquation(const QString& in_fn) {
   // assert(*_xVector); - ugly, we have to allow this here due to
   // document loading with vector lazy-loading
   setDirty();
   _equation = in_fn;
 
   VectorsUsed.clear();
+  ScalarsUsed.clear();
 
-  KstScalarMap::Iterator it = _inputScalars.begin();
-  for (; it != _inputScalars.end(); ++it) {
-    (*it)->unlock();
-  }
-  _inputScalars.clear();
-
   _ns = 2; // reset the updating
   delete _pe;
   _pe = 0L;
@@ -293,15 +288,7 @@
       Equation::FoldVisitor vis(&ctx, &_pe);
       KstStringMap sm;
 
-      KstScalarMap tmp = _inputScalars;
-      if (_pe->collectObjects(VectorsUsed, tmp, sm)) {
-        _inputScalars = tmp;
-        if (lockData) {
-          KstScalarMap::Iterator it = _inputScalars.begin();
-          for (; it != _inputScalars.end(); ++it) {
-            (*it)->readLock();
-          }
-        }
+      if (_pe->collectObjects(VectorsUsed, ScalarsUsed, sm)) {
         _pe->update(-1, &ctx);
       } else {
         //we have bad objects...
@@ -456,7 +443,7 @@
     if (_pe && rc == 0) {
       Equation::FoldVisitor vis(&ctx, &_pe);
       KstStringMap sm;
-      _pe->collectObjects(VectorsUsed, _inputScalars, sm);
+      _pe->collectObjects(VectorsUsed, ScalarsUsed, sm);
       ParsedEquation = 0L;
     } else {
       delete (Equation::Node*)ParsedEquation;
--- branches/kst/1.3/kst/src/libkstmath/kstequation.h #593180:593181
@@ -43,7 +43,7 @@
     virtual QString propertyString() const;
 
     /** equations used to edit the vector */
-    void setEquation(const QString &Equation, bool lockData = false);
+    void setEquation(const QString &Equation);
     void setExistingXVector(KstVectorPtr xvector, bool do_interp);
 
     virtual QString equation() const { return _equation; }
@@ -77,6 +77,7 @@
     QString _equation;
 
     KstVectorMap VectorsUsed;
+    KstScalarMap ScalarsUsed;
 
     void commonConstructor(const QString& in_tag, const QString& equation);
 


More information about the Kst mailing list