[Kst] kdeextragear-2/kst/kst
Barth Netterfield
netterfield at astro.utoronto.ca
Sun Aug 1 05:05:09 CEST 2004
CVS commit by netterfield:
-Minor fixes to labels from fits
-Start at re-working automatic tagnames for data objects in an attempt
to avoid such monstocities as 'F1-P2-C2-V3-T_BL_SSHIELD'
-Added KST::suggestCurveName(vectorname): strips the V?- from vectorname.
M +5 -4 datawizard.ui.h 1.66
M +20 -0 kstdatacollection.cpp 1.11
M +2 -0 kstdatacollection.h 1.16
M +6 -6 kstfitdialog_i.cpp 1.28
M +0 -1 kstpsdcurve.cpp 1.34
--- kdeextragear-2/kst/kst/datawizard.ui.h #1.65:1.66
@@ -491,8 +491,9 @@ void DataWizard::finished()
for (KstVectorList::Iterator it = l.begin(); it != l.end(); ++it) {
if (_radioButtonPlotData->isChecked() || _radioButtonPlotDataPSD->isChecked()) {
- name = i18n("C%1-%2").arg(KST::dataObjectList.count()).arg((*it)->tagName());
- while (KST::dataObjectList.findTag(name) != KST::dataObjectList.end()) {
- name += "'";
- }
+ name = KST::suggestCurveName((*it)->tagName());
+/* name = i18n("C%1-%2").arg(KST::dataObjectList.count()).arg((*it)->tagName()); */
+/* while (KST::dataObjectList.findTag(name) != KST::dataObjectList.end()) { */
+/* name += "'"; */
+/* } */
KstBaseCurvePtr c = new KstVCurve(name, xv, *it, 0L, 0L,
KstColorSequence::next(static_cast<Kst2DPlot*>((*pit).data())->backgroundColor()));
--- kdeextragear-2/kst/kst/kstdatacollection.cpp #1.10:1.11
@@ -20,4 +20,5 @@
#include <stdlib.h>
+#include <qregexp.h>
#include "kstdatacollection.h"
#include "kstrvector.h"
@@ -54,4 +55,23 @@ QString KST::suggestWinName() {
}
+/* takes a vector name of the form V2-GYRO1 and returns a unique */
+/* name of the form C1-GYRO1 */
+QString KST::suggestCurveName( const QString vector_name ) {
+ QString name;
+ QString field;
+ KstVCurveList curves =
+ kstObjectSubList<KstDataObject, KstVCurve>(KST::dataObjectList);
+
+ field = vector_name;
+ field.remove( QRegExp( "^V[0-9]{1,2}\\-" ) );
+ int n = KST::curves.count();
+ do {
+ name = QString("C%1-%2").arg(n).arg(field);
+ n++;
+ } while ( KST::dataObjectList.findTag(name) != KST::dataObjectList.end() );
+
+ return name;
+}
+
void KST::addVectorToList(KstVectorPtr v) {
KST::vectorList.lock().writeLock();
--- kdeextragear-2/kst/kst/kstdatacollection.h #1.15:1.16
@@ -52,4 +52,6 @@ namespace KST {
extern QString suggestWinName();
+ extern QString suggestCurveName(const QString vector_name);
+
/** Save a vector to a file */
extern int vectorToFile(KstVectorPtr v, QFile *f, void *parent = 0L);
--- kdeextragear-2/kst/kst/kstfitdialog_i.cpp #1.27:1.28
@@ -359,5 +359,5 @@ bool KstFitDialogI::createCurve(KstPlugi
// create the necessary label...
//
- strLabel = i18n("%1: %2\n").arg(c_name).arg(plugin->plugin()->data()._readableName);
+ strLabel = i18n("%1: %2\\n").arg(c_name.replace( '_', "\\_" )).arg(plugin->plugin()->data()._readableName);
KstVectorPtr vectorParam = plugin->outputVectors()["Parameters"];
@@ -372,5 +372,5 @@ bool KstFitDialogI::createCurve(KstPlugi
if (scalar) {
- strLabel += i18n("%1: [%2]\n").arg(strParamName).arg(scalar->tagName());
+ strLabel += i18n("%1: [%2]\\n").arg(strParamName).arg(scalar->tagName());
}
}
--- kdeextragear-2/kst/kst/kstpsdcurve.cpp #1.33:1.34
@@ -348,5 +348,4 @@ KstObject::UpdateType KstPSDCurve::updat
void KstPSDCurve::point(int i, double &x, double &y) {
x = (*_fVector)->interpolate(i, NS);
-//xxxdouble(i)/double(NS) * MaxX;
y = (*_sVector)->interpolate(i, NS);
}
More information about the Kst
mailing list