QtiPlot  0.9.8.2
FunctionDialog.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : FunctionDialog.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2006 - 2009 by Ion Vasilief
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr
00007     Description          : Function dialog
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
00027  *                                                                         *
00028  ***************************************************************************/
00029 #ifndef FUNCTIONDIALOG_H
00030 #define FUNCTIONDIALOG_H
00031 
00032 #include <Graph.h>
00033 
00034 class QAbstractButton;
00035 class QDialogButtonBox;
00036 class QTableWidget;
00037 class QStackedWidget;
00038 class QWidget;
00039 class QLineEdit;
00040 class QComboBox;
00041 class QPushButton;
00042 class QSpinBox;
00043 class QLabel;
00044 class QTextEdit;
00045 class DoubleSpinBox;
00046 class ScriptEdit;
00047 class ApplicationWindow;
00048 
00050 class FunctionDialog : public QDialog
00051 {
00052     Q_OBJECT
00053 
00054 public:
00055     FunctionDialog(ApplicationWindow* parent, bool standAlone = true, Qt::WFlags fl = 0 );
00056 
00057     void setCurveToModify(Graph *g, int curve);
00058     void setCurveToModify(FunctionCurve *c);
00059     void setGraph(Graph *g){graph = g;};
00060 
00061 public slots:
00062     bool apply();
00063 
00064 private slots:
00065     void raiseWidget(int index);
00066     void insertFunction();
00067     void updateFunctionExplain(int);
00068     void accept();
00069     bool acceptFunction();
00070     bool acceptParametric();
00071     bool acceptPolar();
00072     void showFunctionLog();
00073     void showXParLog();
00074     void showYParLog();
00075     void showPolarRadiusLog();
00076     void showPolarThetaLog();
00077     void setActiveEditor(ScriptEdit *edit){d_active_editor = edit;};
00078     void guessConstants();
00079     void buttonClicked(QAbstractButton *);
00080     void clearList();
00081 
00082 private:
00083     void setConstants(FunctionCurve *c, const QMap<QString, double>& constants);
00084 
00085     Graph *graph;
00086     int curveID;
00087 
00088     ScriptEdit* boxXFunction;
00089     ScriptEdit* boxYFunction;
00090     ScriptEdit* boxPolarRadius;
00091     ScriptEdit* boxPolarTheta;
00092     QComboBox* boxType;
00093     QLabel* textFunction;
00094     DoubleSpinBox* boxFrom;
00095     DoubleSpinBox* boxTo;
00096     QLineEdit* boxParameter;
00097     DoubleSpinBox* boxParFrom;
00098     DoubleSpinBox* boxParTo;
00099     QLineEdit* boxPolarParameter;
00100     DoubleSpinBox* boxPolarFrom;
00101     DoubleSpinBox* boxPolarTo;
00102     QPushButton* buttonClear;
00103     QSpinBox* boxPoints;
00104     QSpinBox* boxParPoints;
00105     QSpinBox* boxPolarPoints;
00106     QStackedWidget* optionStack;
00107     ScriptEdit* boxFunction;
00108     QWidget* functionPage;
00109     QWidget* polarPage;
00110     QWidget* parametricPage;
00111     QTableWidget *boxConstants;
00112     QPushButton *addFunctionBtn;
00113     QComboBox* boxMathFunctions;
00114     QTextEdit* boxFunctionExplain;
00115     QPushButton *buttonFunctionLog, *buttonXParLog, *buttonYParLog, *buttonPolarRadiusLog, *buttonPolarRThetaLog;
00116     QDialogButtonBox *buttonBox;
00117 
00118     ApplicationWindow *d_app;
00119     ScriptEdit *d_active_editor;
00120     bool d_stand_alone;
00121 };
00122 
00123 #endif // FUNCTIONDIALOG_H