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

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 EQUATIONDIALOG_H
0014 #define EQUATIONDIALOG_H
0015 
0016 #include "datadialog.h"
0017 #include "datatab.h"
0018 #include "equation.h"
0019 
0020 #include "kst_export.h"
0021 
0022 #include "ui_equationtab.h"
0023 
0024 namespace Kst {
0025 
0026 class EquationTab : public DataTab, Ui::EquationTab {
0027   Q_OBJECT
0028   public:
0029     explicit EquationTab(QWidget *parent = 0);
0030     virtual ~EquationTab();
0031 
0032     void setObjectStore(ObjectStore *store);
0033 
0034     VectorPtr xVector() const;
0035     bool xVectorDirty() const;
0036     void setXVector(VectorPtr vector);
0037     bool xVectorSelected() const {return _xVectors->vectorSelected();}
0038 
0039     QString equation() const;
0040     bool equationDirty() const;
0041     void setEquation(const QString &equation);
0042 
0043     bool doInterpolation() const;
0044     bool doInterpolationDirty() const;
0045     void setDoInterpolation(bool doInterpolation);
0046 
0047     CurveAppearance *curveAppearance() const;
0048     CurvePlacement *curvePlacement() const;
0049 
0050     void hideCurveOptions();
0051     void clearTabValues();
0052 
0053     void setToLastX(Document *document, QString lastXVName);
0054 
0055   public Q_SLOTS:
0056     void updateVectorCombos();
0057 
0058   Q_SIGNALS:
0059     void optionsChanged();
0060 
0061   private Q_SLOTS:
0062     void selectionChanged();
0063     void equationUpdate(const QString& string);
0064     void equationOperatorUpdate(const QString& string);
0065 
0066   private:
0067     void populateFunctionList();
0068 };
0069 
0070 class EquationDialog : public DataDialog {
0071   Q_OBJECT
0072   public:
0073     explicit EquationDialog(ObjectPtr dataObject, QWidget *parent = 0);
0074     virtual ~EquationDialog();
0075     virtual bool dialogValid() const;
0076 
0077     static QString _lastXVectorName;
0078   protected:
0079 //     virtual QString tagString() const;
0080     virtual ObjectPtr createNewDataObject();
0081     virtual ObjectPtr editExistingDataObject() const;
0082 
0083   private Q_SLOTS:
0084     void updateButtons();
0085     void editMultipleMode();
0086     void editSingleMode();
0087 
0088   private:
0089     void configureTab(ObjectPtr object);
0090 
0091     EquationTab *_equationTab;
0092 };
0093 
0094 }
0095 
0096 #endif
0097 
0098 // vim: ts=2 sw=2 et