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

Mike Fenton mike at staikos.net
Tue Nov 6 20:56:12 CET 2007


SVN commit 733591 by fenton:

Add Save/Restore for Histogram and fix crash in HistogramDialog.


 M  +2 -1      devel-docs/Kst2Specs/kstfile.txt  
 M  +5 -0      src/libkstapp/histogramdialog.cpp  
 M  +2 -0      src/libkstapp/histogramdialog.h  
 M  +2 -0      src/libkstmath/builtinobjects.cpp  
 M  +5 -20     src/libkstmath/histogram.cpp  
 M  +1 -0      src/libkstmath/histogram.h  
 A             src/libkstmath/histogramfactory.cpp   [License: GPL (v2+)]
 A             src/libkstmath/histogramfactory.h   [License: GPL (v2+)]
 M  +2 -0      src/libkstmath/libkstmath.pro  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/kstfile.txt #733590:733591
@@ -26,8 +26,9 @@
     </editablematrix>
   </variables>
   <objects>
+    <csd tag="" vector="" samplerate="" gaussiansigma="" average="" fftLen="" removemean="" apodize="" apodizefunction="" windowsize="" vectorunits="" rateunits="" outputtype=""></csd>
     <equation tag="" expression="" xvector="" interpolate=""></equation>
-    <csd tag="" vector="" samplerate="" gaussiansigma="" average="" fftLen="" removemean="" apodize="" apodizefunction="" windowsize="" vectorunits="" rateunits="" outputtype=""></csd>
+    <histogram tag="" vector="" numberofbins="" realtimeautobin="" min="" max="" normalizationmode=""></histogram>
     <psd name="">
     </psd>
   </objects>
--- branches/work/kst/portto4/kst/src/libkstapp/histogramdialog.cpp #733590:733591
@@ -128,6 +128,11 @@
 }
 
 
+void HistogramTab::setObjectStore(ObjectStore *store) {
+  _vector->setObjectStore(store);
+}
+
+
 HistogramDialog::HistogramDialog(ObjectPtr dataObject, QWidget *parent)
   : DataDialog(dataObject, parent) {
 
--- branches/work/kst/portto4/kst/src/libkstapp/histogramdialog.h #733590:733591
@@ -31,6 +31,8 @@
     HistogramTab(QWidget *parent = 0);
     virtual ~HistogramTab();
 
+    void setObjectStore(ObjectStore *store);
+
     VectorPtr vector() const;
     CurveAppearance* curveAppearance() const;
     CurvePlacement* curvePlacement() const;
--- branches/work/kst/portto4/kst/src/libkstmath/builtinobjects.cpp #733590:733591
@@ -12,12 +12,14 @@
 #include "builtinobjects.h"
 #include "equationfactory.h"
 #include "csdfactory.h"
+#include "histogramfactory.h"
 
 namespace Kst {
   namespace Builtins {
     void initObjects() {
       new EquationFactory;
       new CSDFactory;
+      new HistogramFactory;
     }
   }
 }
--- branches/work/kst/portto4/kst/src/libkstmath/histogram.cpp #733590:733591
@@ -32,6 +32,7 @@
 namespace Kst {
 
 const QString Histogram::staticTypeString = I18N_NOOP("Histogram");
+const QString Histogram::staticTypeTag = I18N_NOOP("histogram");
 
 static const QLatin1String& RAWVECTOR  = QLatin1String("I");
 static const QLatin1String& BINS = QLatin1String("B");
@@ -356,30 +357,14 @@
 }
 
 void Histogram::save(QXmlStreamWriter &xml) {
-  xml.writeStartElement("histogram");
+  xml.writeStartElement(staticTypeTag);
   xml.writeAttribute("tag", tag().tagString());
-  xml.writeAttribute("vectag", _inputVectors[RAWVECTOR]->tag().tagString());
-  xml.writeAttribute("numbins", QString::number(_NumberOfBins));
+  xml.writeAttribute("vector", _inputVectors[RAWVECTOR]->tag().tagString());
+  xml.writeAttribute("numberofbins", QString::number(_NumberOfBins));
   xml.writeAttribute("realtimeautobin", QVariant(_realTimeAutoBin).toString());
   xml.writeAttribute("min", QString::number(_MinX));
   xml.writeAttribute("max", QString::number(_MaxX));
-
-  QString normString;
-  switch (_NormalizationMode) {
-    case Number:
-      normString = "NUMBER";
-      break;
-    case Percent:
-      normString = "PERCENT";
-      break;
-    case Fraction:
-      normString = "FRACTION";
-      break;
-    case MaximumOne:
-      normString = "MAX_ONE";
-      break;
-  }
-  xml.writeAttribute("normmode", normString);
+  xml.writeAttribute("normalizationmode", QString::number(_NormalizationMode));
   xml.writeEndElement();
 }
 
--- branches/work/kst/portto4/kst/src/libkstmath/histogram.h #733590:733591
@@ -38,6 +38,7 @@
   public:
     static const QString staticTypeString;
     const QString& typeString() const { return staticTypeString; }
+    static const QString staticTypeTag;
 
     virtual UpdateType update(int update_counter = -1);
     virtual void save(QXmlStreamWriter &xml);
--- branches/work/kst/portto4/kst/src/libkstmath/libkstmath.pro #733590:733591
@@ -39,6 +39,7 @@
     image.cpp \
     defaultnames.cpp \
     histogram.cpp \
+    histogramfactory.cpp \
     equation.cpp \
     curvehint.cpp \
     basicplugin.cpp \
@@ -75,6 +76,7 @@
     defaultnames.h \
     equation.h \
     histogram.h \
+    histogramfactory.h \
     image.h \
     linestyle.h \
     objectdefaults.h \


More information about the Kst mailing list