[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Sat Apr 23 23:53:38 CEST 2005
CVS commit by staikos:
Add a bit of a hack to fix fit labels, at least for the release. I'm not sure
it's a good idea to expose this as a public method.
M +2 -3 kstfitdialog_i.cpp 1.60
M +26 -21 kstplugin.cpp 1.97
M +2 -0 kstplugin.h 1.38
--- kdeextragear-2/kst/kst/kstfitdialog_i.cpp #1.59:1.60
@@ -401,8 +401,7 @@ bool KstFitDialogI::createCurve(KstPlugi
KstVectorPtr vectorParam = plugin->outputVectors()["Parameters"];
if (vectorParam) {
- QString strParamName;
-
+ plugin->createFitScalars();
for (int i = 0; i < vectorParam->length(); i++) {
- strParamName = plugin->plugin()->parameterName(i);
+ QString strParamName = plugin->plugin()->parameterName(i);
if (!strParamName.isEmpty()) {
if (plugin->outputScalars().contains(strParamName)) {
--- kdeextragear-2/kst/kst/kstplugin.h #1.37:1.38
@@ -50,4 +50,6 @@ class KstPlugin : public KstDataObject {
QString lastError() const;
+ void createFitScalars();
+
protected:
static void countScalarsAndVectors(const QValueList<Plugin::Data::IOValue>& table, unsigned& scalars, unsigned& vectors);
--- kdeextragear-2/kst/kst/kstplugin.cpp #1.96:1.97
@@ -391,25 +391,6 @@ KstObject::UpdateType KstPlugin::update(
}
- // if we have a fit plugin then create the necessary scalars from the parameter vector...
- if (_plugin->data()._isFit) {
- KstVectorPtr vectorParam = _outputVectors["Parameters"];
- if (vectorParam) {
- for (int i = 0; i < vectorParam->length(); i++) {
- const QString& paramName = _plugin->parameterName(i);
- if (!paramName.isEmpty()) {
- QString scalarName = i18n("%1-%2").arg(tagName()).arg(paramName);
- double scalarValue = vectorParam->value(i);
- if (!_outputScalars.contains(paramName)) {
- KstScalarPtr s = new KstScalar(scalarName);
- s->writeLock();
- s->setProvider(this);
- s->writeUnlock();
- _outputScalars.insert(paramName, s);
- }
- _outputScalars[paramName]->setValue(scalarValue);
- }
- }
- }
- }
+ // if we have a fit plugin then create the necessary scalars from the parameter vector
+ createFitScalars();
_lastError = QString::null;
} else if (rc > 0) {
@@ -624,3 +605,27 @@ QString KstPlugin::lastError() const {
}
+
+void KstPlugin::createFitScalars() {
+ if (_plugin->data()._isFit && _outputVectors.contains("Parameters")) {
+ KstVectorPtr vectorParam = _outputVectors["Parameters"];
+ if (vectorParam) {
+ for (int i = 0; i < vectorParam->length(); i++) {
+ const QString& paramName = _plugin->parameterName(i);
+ if (!paramName.isEmpty()) {
+ QString scalarName = i18n("%1-%2").arg(tagName()).arg(paramName);
+ double scalarValue = vectorParam->value(i);
+ if (!_outputScalars.contains(paramName)) {
+ KstScalarPtr s = new KstScalar(scalarName);
+ s->writeLock();
+ s->setProvider(this);
+ s->writeUnlock();
+ _outputScalars.insert(paramName, s);
+ }
+ _outputScalars[paramName]->setValue(scalarValue);
+ }
+ }
+ }
+ }
+}
+
// vim: ts=2 sw=2 et
More information about the Kst
mailing list