[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Thu Dec 22 16:05:24 CET 2005
SVN commit 490629 by staikos:
add duplicate name guards. Shouldn't matrices use the same namespace as
vectors? (and scalars and strings, for that matter?)
M +5 -1 kstcsd.cpp
M +5 -1 kstequation.cpp
M +5 -1 ksteventmonitorentry.cpp
M +5 -1 ksthistogram.cpp
M +5 -1 kstimage.cpp
M +13 -0 kstmatrix.cpp
M +5 -1 kstpsd.cpp
M +2 -2 kstvector.cpp
--- trunk/extragear/graphics/kst/kst/kstcsd.cpp #490628:490629
@@ -400,7 +400,11 @@
KstDataObjectPtr KstCSD::makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap) {
- KstCSDPtr csd = new KstCSD(tagName() + "'", _inputVectors[INVECTOR], _frequency, _average, _removeMean,
+ QString name(tagName() + '\'');
+ while (KST::dataTagNameNotUnique(name, false)) {
+ name += '\'';
+ }
+ KstCSDPtr csd = new KstCSD(name, _inputVectors[INVECTOR], _frequency, _average, _removeMean,
_apodize, _apodizeFxn, _windowSize, _length, _gaussianSigma, _vectorUnits, _rateUnits);
duplicatedMap.insert(this, KstDataObjectPtr(csd));
return KstDataObjectPtr(csd);
--- trunk/extragear/graphics/kst/kst/kstequation.cpp #490628:490629
@@ -447,7 +447,11 @@
KstDataObjectPtr KstEquation::makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap) {
- KstEquationPtr eq = new KstEquation(tagName() + "'", _equation, _inputVectors[XVECTOR], _doInterp);
+ QString name(tagName() + '\'');
+ while (KST::dataTagNameNotUnique(name, false)) {
+ name += '\'';
+ }
+ KstEquationPtr eq = new KstEquation(name, _equation, _inputVectors[XVECTOR], _doInterp);
duplicatedMap.insert(this, KstDataObjectPtr(eq));
return KstDataObjectPtr(eq);
}
--- trunk/extragear/graphics/kst/kst/ksteventmonitorentry.cpp #490628:490629
@@ -383,7 +383,11 @@
KstDataObjectPtr EventMonitorEntry::makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap) {
- EventMonitorEntryPtr event = new EventMonitorEntry(tagName() + "'");
+ QString name(tagName() + '\'');
+ while (KST::dataTagNameNotUnique(name, false)) {
+ name += '\'';
+ }
+ EventMonitorEntryPtr event = new EventMonitorEntry(name);
event->setEvent(_strEvent);
event->setDescription(_strDescription);
event->setLevel(_level);
--- trunk/extragear/graphics/kst/kst/ksthistogram.cpp #490628:490629
@@ -448,7 +448,11 @@
KstDataObjectPtr KstHistogram::makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap) {
- KstHistogramPtr histogram = new KstHistogram(tagName() + "'", _inputVectors[RAWVECTOR],
+ QString name(tagName() + '\'');
+ while (KST::dataTagNameNotUnique(name, false)) {
+ name += '\'';
+ }
+ KstHistogramPtr histogram = new KstHistogram(name, _inputVectors[RAWVECTOR],
_MinX, _MaxX, _NBins, _NormMode);
duplicatedMap.insert(this, KstDataObjectPtr(histogram));
return KstDataObjectPtr(histogram);
--- trunk/extragear/graphics/kst/kst/kstimage.cpp #490628:490629
@@ -444,7 +444,11 @@
newPalette = new KPalette(*_pal);
}
- KstImagePtr image = new KstImage(tagName() + "'", _inputMatrices[THEMATRIX], _zLower, _zUpper, _autoThreshold, newPalette);
+ QString name(tagName() + '\'');
+ while (KST::dataTagNameNotUnique(name, false)) {
+ name += '\'';
+ }
+ KstImagePtr image = new KstImage(name, _inputMatrices[THEMATRIX], _zLower, _zUpper, _autoThreshold, newPalette);
duplicatedMap.insert(this, KstDataObjectPtr(image));
return KstDataObjectPtr(image);
}
--- trunk/extragear/graphics/kst/kst/kstmatrix.cpp #490628:490629
@@ -34,6 +34,8 @@
// used for resizing; set to 1 for loop zeroing, 2 to use memset
#define ZERO_MEMORY 2
+static int anonymousMatrixCounter = 1;
+
KstMatrix::KstMatrix(const QString &in_tag, uint nX, uint nY, double minX, double minY, double stepX, double stepY) : KstObject() {
_nX = nX;
@@ -51,6 +53,17 @@
// must create scalars before setting tag name
createScalars();
setTagName(in_tag);
+ if (in_tag.isEmpty()) {
+ QString nt = i18n("Anonymous Matrix %1");
+
+ do {
+ KstObject::setTagName(nt.arg(anonymousMatrixCounter++));
+ } while (KST::matrixTagNameNotUnique(tagName(), false));
+ } else {
+ while (KST::matrixTagNameNotUnique(tagName(), false)) {
+ KstObject::setTagName(tagName() + '\'');
+ }
+ }
setDirty();
}
--- trunk/extragear/graphics/kst/kst/kstpsd.cpp #490628:490629
@@ -614,7 +614,11 @@
KstDataObjectPtr KstPSD::makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap) {
- KstPSDPtr psd = new KstPSD(tagName() + "'", _inputVectors[INVECTOR], _Freq,
+ QString name(tagName() + '\'');
+ while (KST::dataTagNameNotUnique(name, false)) {
+ name += '\'';
+ }
+ KstPSDPtr psd = new KstPSD(name, _inputVectors[INVECTOR], _Freq,
_Average, _Len, _Apodize, _RemoveMean, _vUnits, _rUnits,
_apodizeFxn, _gaussianSigma);
duplicatedMap.insert(this, KstDataObjectPtr(psd));
--- trunk/extragear/graphics/kst/kst/kstvector.cpp #490628:490629
@@ -31,7 +31,7 @@
#include "kstvector.h"
#include "kstvcurve.h"
-static int anonymousVectorCounter = 0;
+static int anonymousVectorCounter = 1;
// Use 1 for a simple for() loop
#define ZERO_MEMORY 2
@@ -69,7 +69,7 @@
} while (KST::vectorTagNameNotUnique(tagName(), false));
} else {
while (KST::vectorTagNameNotUnique(tagName(), false)) {
- KstObject::setTagName(tagName() + "'");
+ KstObject::setTagName(tagName() + '\'');
}
}
More information about the Kst
mailing list