[Kst] branches/work/kst/1.6/kst/src
Andrew Walker
arwalker at sumusltd.com
Thu Dec 6 22:52:48 CET 2007
SVN commit 745717 by arwalker:
general format changes
M +1 -0 libkstapp/kst2dplot.cpp
M +1 -1 libkstapp/ksteqdialog_i.cpp
M +2 -0 libkstmath/enodes.cpp
M +48 -49 libkstmath/kstdataobject.cpp
M +9 -9 libkstmath/kstequation.cpp
M +1 -1 libkstmath/kstequation.h
--- branches/work/kst/1.6/kst/src/libkstapp/kst2dplot.cpp #745716:745717
@@ -931,6 +931,7 @@
_yScaleMode = scalemode_in;
}
+
bool Kst2DPlot::addCurve(KstBaseCurvePtr incurve) {
if (!Curves.contains(incurve)) {
Curves.append(incurve);
--- branches/work/kst/1.6/kst/src/libkstapp/ksteqdialog_i.cpp #745716:745717
@@ -95,7 +95,7 @@
// re-parse to get the latest equation
ep->writeLock();
- ep->reParse();
+ ep->reparse();
ep->unlock();
ep->readLock();
--- branches/work/kst/1.6/kst/src/libkstmath/enodes.cpp #745716:745717
@@ -1051,6 +1051,7 @@
}
return false;
}
+
if (_vector) {
if (vm.contains(_tagName)) {
_vector = vm[_tagName];
@@ -1072,6 +1073,7 @@
return false;
}
}
+
return true;
}
--- branches/work/kst/1.6/kst/src/libkstmath/kstdataobject.cpp #745716:745717
@@ -16,28 +16,28 @@
* *
***************************************************************************/
-#include "kstdataobject.h"
+#include <assert.h>
-#include "ksdebug.h"
-#include "kstdebug.h"
-#include "kstdatacollection.h"
-#include "kstdataobjectcollection.h"
-
+// include files for Qt
#include <qtimer.h>
#include <qdeepcopy.h>
-#include <assert.h>
-
+// include files for KDE
#include <klocale.h>
#include <klibloader.h>
#include <kparts/componentfactory.h>
+// application specific includes
+#include "kstdataobject.h"
#include "kstdataplugin.h"
+#include "ksdebug.h"
+#include "kstdebug.h"
+#include "kstdatacollection.h"
+#include "kstdataobjectcollection.h"
//#define LOCKTRACE
KstDataObject::KstDataObject() : KstObject() {
- //kstdDebug() << "+++ CREATING DATA OBJECT: " << (void*)this << endl;
_curveHints = new KstCurveHintList;
_isInputLoaded = false;
_isRecursed = false;
@@ -45,7 +45,6 @@
KstDataObject::KstDataObject(const QDomElement& e) : KstObject() {
Q_UNUSED(e)
- //kstdDebug() << "+++ CREATING DATA OBJECT: " << (void*)this << endl;
_curveHints = new KstCurveHintList;
_isInputLoaded = false;
_isRecursed = false;
@@ -53,39 +52,36 @@
KstDataObject::~KstDataObject() {
- // Remove our slave vectors, scalars, and strings, and matrices
+ // remove our slave vectors, scalars, and strings, and matrices
KST::stringList.lock().writeLock();
for (KstStringMap::Iterator it = _outputStrings.begin();
- it != _outputStrings.end();
- ++it) {
+ it != _outputStrings.end(); ++it) {
KST::stringList.remove(it.data());
}
KST::stringList.lock().unlock();
KST::scalarList.lock().writeLock();
for (KstScalarMap::Iterator it = _outputScalars.begin();
- it != _outputScalars.end();
- ++it) {
+ it != _outputScalars.end(); ++it) {
KST::scalarList.remove(it.data());
}
KST::scalarList.lock().unlock();
KST::vectorList.lock().writeLock();
for (KstVectorMap::Iterator it = _outputVectors.begin();
- it != _outputVectors.end();
- ++it) {
+ it != _outputVectors.end(); ++it) {
KST::vectorList.remove(it.data());
}
KST::vectorList.lock().unlock();
-
+
KST::matrixList.lock().writeLock();
for (KstMatrixMap::Iterator it = _outputMatrices.begin();
it != _outputMatrices.end();
++it) {
- KST::matrixList.remove(it.data());
+ KST::matrixList.remove(it.data());
}
KST::matrixList.lock().unlock();
-// kstdDebug() << "Destroying Data Object: " << tag().displayString() << endl;
+
delete _curveHints;
}
@@ -122,6 +118,7 @@
}
KstDebug::self()->log(i18n("Could not load data-object plugin %1.").arg(service->name()), KstDebug::Error);
+
return 0L;
}
@@ -151,15 +148,17 @@
for (; it != pluginInfo.end(); ++it) {
list.insert(it.key(), it.data()->kind());
}
+
return list;
}
KstDataObjectPtr KstDataObject::plugin(const QString& name) {
- if (pluginInfo.contains(name)) {
- return pluginInfo[name];
- }
- return 0L;
+ if (pluginInfo.contains(name)) {
+ return pluginInfo[name];
+ }
+
+ return 0L;
}
@@ -172,6 +171,7 @@
return object;
}
}
+
return 0L;
}
@@ -203,7 +203,7 @@
bool KstDataObject::loadInputs() {
bool rc = true;
QValueList<QPair<QString,QString> >::Iterator i;
-
+
KST::vectorList.lock().readLock();
for (i = _inputVectorLoadQueue.begin(); i != _inputVectorLoadQueue.end(); ++i) {
KstVectorList::Iterator it = KST::vectorList.findTag((*i).second);
@@ -257,10 +257,11 @@
_inputScalarLoadQueue.clear();
_inputStringLoadQueue.clear();
_inputMatrixLoadQueue.clear();
-
+
setDirty();
_isInputLoaded = true;
+
return rc;
}
@@ -350,7 +351,7 @@
for (QValueList<KstStringPtr>::Iterator i = sl.begin(); i != sl.end(); ++i) {
outputs += (*i).data();
}
-
+
QValueList<KstScalarPtr> sc = _inputScalars.values();
for (QValueList<KstScalarPtr>::Iterator i = sc.begin(); i != sc.end(); ++i) {
inputs += (*i).data();
@@ -359,7 +360,7 @@
for (QValueList<KstScalarPtr>::Iterator i = sc.begin(); i != sc.end(); ++i) {
outputs += (*i).data();
}
-
+
QValueList<KstVectorPtr> vl = _inputVectors.values();
for (QValueList<KstVectorPtr>::Iterator i = vl.begin(); i != vl.end(); ++i) {
inputs += (*i).data();
@@ -368,7 +369,7 @@
for (QValueList<KstVectorPtr>::Iterator i = vl.begin(); i != vl.end(); ++i) {
outputs += (*i).data();
}
-
+
QValueList<KstMatrixPtr> ml = _inputMatrices.values();
for (QValueList<KstMatrixPtr>::Iterator i = ml.begin(); i != ml.end(); ++i) {
inputs += (*i).data();
@@ -534,7 +535,7 @@
KST::dataObjectList.lock().unlock();
dop->deleteDependents();
}
- }
+ }
return true;
}
@@ -545,7 +546,7 @@
KST::dataObjectList.lock().readLock();
KstDataObjectList dol = QDeepCopy<KstDataObjectList>(KST::dataObjectList);
KST::dataObjectList.lock().unlock();
-
+
for (KstDataObjectList::Iterator i = dol.begin(); i != dol.end(); ++i) {
if ((*i)->uses(this)) {
if (duplicatedMap.contains(*i)) {
@@ -560,14 +561,14 @@
}
}
}
+
return true;
}
void KstDataObject::replaceDependency(KstDataObjectPtr oldObject, KstDataObjectPtr newObject) {
-
// find all connections from this object to old object
-
+
// vectors
for (KstVectorMap::Iterator j = oldObject->outputVectors().begin(); j != oldObject->outputVectors().end(); ++j) {
for (KstVectorMap::Iterator k = _inputVectors.begin(); k != _inputVectors.end(); ++k) {
@@ -586,7 +587,7 @@
}
}
}
-
+
// matrices
for (KstMatrixMap::Iterator j = oldObject->outputMatrices().begin(); j != oldObject->outputMatrices().end(); ++j) {
for (KstMatrixMap::Iterator k = _inputMatrices.begin(); k != _inputMatrices.end(); ++k) {
@@ -601,7 +602,7 @@
for (; scalarDictIter.current(); ++scalarDictIter) {
if (scalarDictIter.current() == k.data()) {
_inputScalars[k.key()] = (((newObject->outputMatrices())[j.key()])->scalars())[scalarDictIter.currentKey()];
- }
+ }
}
}
}
@@ -611,17 +612,17 @@
for (KstScalarMap::Iterator k = _inputScalars.begin(); k != _inputScalars.end(); ++k) {
if (j.data().data() == k.data().data()) {
// replace input with the output from newObject
- _inputScalars[k.key()] = (newObject->outputScalars())[j.key()];
+ _inputScalars[k.key()] = (newObject->outputScalars())[j.key()];
}
- }
+ }
}
-
+
// strings
for (KstStringMap::Iterator j = oldObject->outputStrings().begin(); j != oldObject->outputStrings().end(); ++j) {
for (KstStringMap::Iterator k = _inputStrings.begin(); k != _inputStrings.end(); ++k) {
if (j.data().data() == k.data().data()) {
// replace input with the output from newObject
- _inputStrings[k.key()] = (newObject->outputStrings())[j.key()];
+ _inputStrings[k.key()] = (newObject->outputStrings())[j.key()];
}
}
}
@@ -631,16 +632,16 @@
void KstDataObject::replaceDependency(KstVectorPtr oldVector, KstVectorPtr newVector) {
for (KstVectorMap::Iterator j = _inputVectors.begin(); j != _inputVectors.end(); ++j) {
if (j.data() == oldVector) {
- _inputVectors[j.key()] = newVector;
- }
+ _inputVectors[j.key()] = newVector;
+ }
}
-
+
QDictIterator<KstScalar> scalarDictIter(oldVector->scalars());
for (KstScalarMap::Iterator j = _inputScalars.begin(); j != _inputScalars.end(); ++j) {
for (; scalarDictIter.current(); ++ scalarDictIter) {
if (scalarDictIter.current() == j.data()) {
_inputScalars[j.key()] = (newVector->scalars())[scalarDictIter.currentKey()];
- }
+ }
}
}
}
@@ -649,16 +650,16 @@
void KstDataObject::replaceDependency(KstMatrixPtr oldMatrix, KstMatrixPtr newMatrix) {
for (KstMatrixMap::Iterator j = _inputMatrices.begin(); j != _inputMatrices.end(); ++j) {
if (j.data() == oldMatrix) {
- _inputMatrices[j.key()] = newMatrix;
- }
+ _inputMatrices[j.key()] = newMatrix;
+ }
}
-
+
QDictIterator<KstScalar> scalarDictIter(oldMatrix->scalars());
for (KstScalarMap::Iterator j = _inputScalars.begin(); j != _inputScalars.end(); ++j) {
for (; scalarDictIter.current(); ++ scalarDictIter) {
if (scalarDictIter.current() == j.data()) {
_inputScalars[j.key()] = (newMatrix->scalars())[scalarDictIter.currentKey()];
- }
+ }
}
}
}
@@ -797,6 +798,4 @@
return _isRecursed;
}
-
#include "kstdataobject.moc"
-
--- branches/work/kst/1.6/kst/src/libkstmath/kstequation.cpp #745716:745717
@@ -139,6 +139,7 @@
_pe = 0L;
}
+
void KstEquation::commonConstructor(const QString& in_tag, const QString& in_equation) {
_ns = 2;
_pe = 0L;
@@ -230,7 +231,7 @@
}
-void KstEquation::reParse() {
+void KstEquation::reparse() {
Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED);
if (!_equation.isEmpty()) {
@@ -506,7 +507,7 @@
if (!(*_xOutVector)->resize(iv->length())) {
// FIXME: handle error?
unlockInputsAndOutputs();
- return false;
+ return false;
}
unlockInputsAndOutputs();
@@ -592,7 +593,7 @@
QString newTag = newVector->tagName();
// replace all occurences of oldTag with newTag
- QString newExp = _equation.replace("["+oldTag+"]", "["+newTag+"]");
+ QString newExp = _equation.replace("[" + oldTag + "]", "[" + newTag + "]");
// also replace all occurences of scalar stats for the oldVector
QDictIterator<KstScalar> scalarDictIter(oldVector->scalars());
@@ -608,7 +609,7 @@
// replaces _inputScalars
for (KstVectorMap::Iterator j = _inputVectors.begin(); j != _inputVectors.end(); ++j) {
if (j.data() == oldVector) {
- _inputVectors[j.key()] = newVector;
+ _inputVectors[j.key()] = newVector;
}
}
}
@@ -653,14 +654,13 @@
void KstEquation::setupConnections() {
for (KstScalarMap::iterator i = ScalarsUsed.begin(); i != ScalarsUsed.end(); ++i) {
- disconnect(i.data(), SIGNAL(tagChanged()), this, SLOT(reParse()));
- connect(i.data(), SIGNAL(tagChanged()), this, SLOT(reParse()));
+ disconnect(i.data(), SIGNAL(tagChanged()), this, SLOT(reparse()));
+ connect(i.data(), SIGNAL(tagChanged()), this, SLOT(reparse()));
}
for (KstVectorMap::iterator i = VectorsUsed.begin(); i != VectorsUsed.end(); ++i) {
- disconnect(i.data(), SIGNAL(tagChanged()), this, SLOT(reParse()));
- connect(i.data(), SIGNAL(tagChanged()), this, SLOT(reParse()));
+ disconnect(i.data(), SIGNAL(tagChanged()), this, SLOT(reparse()));
+ connect(i.data(), SIGNAL(tagChanged()), this, SLOT(reparse()));
}
}
#include "kstequation.moc"
-
--- branches/work/kst/1.6/kst/src/libkstmath/kstequation.h #745716:745717
@@ -78,7 +78,7 @@
virtual bool uses(KstObjectPtr p) const;
public slots:
- void reParse();
+ void reparse();
private:
KstVectorMap::Iterator _xInVector, _xOutVector, _yOutVector;
More information about the Kst
mailing list