[Kst] branches/work/kst/portto4/kst/src

Barth Netterfield netterfield at astro.utoronto.ca
Wed Mar 24 17:02:11 CET 2010


SVN commit 1107021 by netterfield:

Fix some minor auto-label bugs.


 M  +0 -5      libkst/datamatrix.cpp  
 M  +0 -1      libkst/datamatrix.h  
 M  +0 -1      libkst/datavector.cpp  
 M  +0 -1      libkst/datavector.h  
 M  +1 -1      libkst/primitive.cpp  
 M  +10 -3     libkst/vector.cpp  
 M  +4 -5      libkst/vector.h  
 M  +1 -2      libkstapp/plotrenderitem.cpp  
 M  +1 -1      libkstmath/curve.cpp  
 M  +2 -1      libkstmath/equation.cpp  


--- branches/work/kst/portto4/kst/src/libkst/datamatrix.cpp #1107020:1107021
@@ -168,11 +168,6 @@
 }
 
 
-QString DataMatrix::fileLabel() const {
-  return filename();
-}
-
-
 bool DataMatrix::isValid() const {
   if (_file) {
     _file->readLock();
--- branches/work/kst/portto4/kst/src/libkst/datamatrix.h #1107020:1107021
@@ -93,7 +93,6 @@
 
     // labels for this matrix
     virtual QString label() const;
-    virtual QString fileLabel() const;
 
     // returns true if the file and field is valid; false otherwise
     bool isValid() const;
--- branches/work/kst/portto4/kst/src/libkst/datavector.cpp #1107020:1107021
@@ -742,7 +742,6 @@
   return _file->vector().read(field, par);
 }
 
-
 const DataVector::Optional DataVector::opt(const QString& field) const
 {
   _file->readLock();
--- branches/work/kst/portto4/kst/src/libkst/datavector.h #1107020:1107021
@@ -105,7 +105,6 @@
 
     /** return a sensible label for this vector */
     virtual QString label() const;
-    virtual QString fileLabel() const { return filename(); }
 
     /** return the length of the file */
     int fileLength() const;
--- branches/work/kst/portto4/kst/src/libkst/primitive.cpp #1107020:1107021
@@ -55,7 +55,7 @@
 QString Primitive::_automaticDescriptiveName() const {
   QString name;
   if (_provider) {
-    name = _provider->descriptiveName() + "/";
+    name = _provider->descriptiveName() + ":";
   }
   name += _slaveName;
 
--- branches/work/kst/portto4/kst/src/libkst/vector.cpp #1107020:1107021
@@ -64,6 +64,7 @@
     _size = size;
   }
   _is_rising = false;
+  _descriptiveLabel.clear();
 
   CreateScalars(store);
   blank();
@@ -528,9 +529,12 @@
   return _label; // default
 }
 
-
-QString Vector::fileLabel() const {
-  return QString::null;
+QString Vector::descriptiveLabel() const {
+  if (_descriptiveLabel.isEmpty()) {
+    return descriptiveName();
+  } else {
+    return _descriptiveLabel;
+  }
 }
 
 
@@ -547,6 +551,9 @@
   _label = label_in;
 }
 
+void Vector::setDescriptiveLabel(const QString& label_in) {
+  _descriptiveLabel = label_in;
+}
 
 int Vector::getUsage() const {
   int adj = 0;
--- branches/work/kst/portto4/kst/src/libkst/vector.h #1107020:1107021
@@ -106,9 +106,6 @@
     /** reset New Samples and Shifted samples */
     void newSync();
 
-    /** return a sensible top label.... */
-    virtual QString fileLabel() const;
-
     virtual bool resize(int sz, bool init = true);
 
     virtual void setNewAndShift(int inNew, int inShift);
@@ -123,7 +120,10 @@
     void updateScalars();
 
     /** return a sensible label for this vector */
+    void setLabel(const QString& label_in);
+    void setDescriptiveLabel(const QString& label_in);
     virtual QString label() const;
+    virtual QString descriptiveLabel() const;
 
     virtual int getUsage() const;
 
@@ -139,8 +139,6 @@
     const QHash<QString, ScalarPtr>& scalars() const;
     const QHash<QString, StringPtr>& strings() const; // used by datavector
 
-    void setLabel(const QString& label_in);
-
     bool saveable() const;
 
     bool editable() const;
@@ -205,6 +203,7 @@
     virtual void deleteDependents();
 
     QString _label;
+    QString _descriptiveLabel;
 
     friend class DataObject;
     virtual double* realloced(double *memptr, int newSize);
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #1107020:1107021
@@ -506,7 +506,7 @@
   }
 }
 
-
+//FIXME: store event or pos, and re-call this when window is redrawn
 void PlotRenderItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
   ViewItem::hoverMoveEvent(event);
 
@@ -538,7 +538,6 @@
     highlightNearestDataPoint(point);
   } else {
     _highlightPointActive = false;
-    //QString message = QString("(%1, %2)").arg(QString::number(point.x(), 'G', 13)).arg(QString::number(point.y()));
     QString message = QString("(%1, %2)").
                       arg(plotItem()->xAxis()->statusBarString(point.x())).
                       arg(QString::number(point.y()));
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #1107020:1107021
@@ -373,7 +373,7 @@
 
 
 QString Curve::topLabel() const {
-  return _inputVectors[YVECTOR]->descriptiveName();
+  return _inputVectors[YVECTOR]->descriptiveLabel();
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstmath/equation.cpp #1107020:1107021
@@ -258,6 +258,7 @@
 
   _xOutVector->setLabel(xl);
   _yOutVector->setLabel(yl);
+  _yOutVector->setDescriptiveLabel(yl);
 }
 
 void Equation::setExistingXVector(VectorPtr in_xv, bool do_interp) {
@@ -590,7 +591,7 @@
 }
 
 QString Equation::_automaticDescriptiveName() const {
-  return reparsedEquation();
+  return _yOutVector->label();
 }
 
 QString Equation::descriptionTip() const {


More information about the Kst mailing list