File indexing completed on 2024-12-22 04:17:32

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2007 The University of Toronto                        *
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 #ifndef HISTOGRAMDIALOG_H
0014 #define HISTOGRAMDIALOG_H
0015 
0016 #include "datadialog.h"
0017 #include "datatab.h"
0018 
0019 #include "histogram.h"
0020 
0021 #include "ui_histogramtab.h"
0022 
0023 #include <QPointer>
0024 
0025 #include "kst_export.h"
0026 
0027 #ifdef min
0028 #undef min
0029 #endif
0030 
0031 #ifdef max
0032 #undef max
0033 #endif
0034 
0035 namespace Kst {
0036 
0037 class HistogramTab : public DataTab, Ui::HistogramTab {
0038   Q_OBJECT
0039   public:
0040     explicit HistogramTab(QWidget *parent = 0);
0041     virtual ~HistogramTab();
0042 
0043     void setObjectStore(ObjectStore *store);
0044 
0045     VectorPtr vector() const;
0046     bool vectorDirty() const;
0047     void setVector(VectorPtr vector);
0048     bool vectorSelected() const {return _vector->vectorSelected();}
0049 
0050     double min() const;
0051     bool minDirty() const;
0052     void setMin(const double min);
0053 
0054     double max() const;
0055     bool maxDirty() const;
0056     void setMax(const double max);
0057 
0058     int bins() const;
0059     bool binsDirty() const;
0060     void setBins(const int bins);
0061 
0062     bool realTimeAutoBin() const;
0063     bool realTimeAutoBinDirty() const;
0064     void setRealTimeAutoBin(const bool autoBin);
0065 
0066     Histogram::NormalizationType normalizationType() const;
0067     bool normalizationTypeDirty() const;
0068     void setNormalizationType(const Histogram::NormalizationType normalizationType);
0069 
0070     CurveAppearance* curveAppearance() const;
0071     CurvePlacement* curvePlacement() const;
0072 
0073     void hideCurveOptions();
0074     void clearTabValues();
0075 
0076     void resetNormalizationDirty();
0077 
0078   private Q_SLOTS:
0079     void generateAutoBin();
0080     void updateButtons();
0081     void selectionChanged();
0082     void normalizationChanged();
0083 
0084   Q_SIGNALS:
0085     void vectorChanged();
0086 
0087   private:
0088     bool _normalizationDirty;
0089 };
0090 
0091 class HistogramDialog : public DataDialog {
0092   Q_OBJECT
0093   public:
0094     explicit HistogramDialog(ObjectPtr dataObject, QWidget *parent = 0);
0095     virtual ~HistogramDialog();
0096 
0097     void setVector(VectorPtr vector);
0098 
0099     virtual bool dialogValid() const;
0100 
0101   protected:
0102 //     virtual QString tagString() const;
0103     virtual ObjectPtr createNewDataObject();
0104     virtual ObjectPtr editExistingDataObject() const;
0105 
0106   private Q_SLOTS:
0107     void updateButtons();
0108     void editMultipleMode();
0109     void editSingleMode();
0110 
0111   private:
0112     void configureTab(ObjectPtr object=0);
0113 
0114     HistogramTab *_histogramTab;
0115 };
0116 
0117 }
0118 
0119 #endif
0120 
0121 // vim: ts=2 sw=2 et