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 QTableWidget; 00035 class QStackedWidget; 00036 class QWidget; 00037 class QLineEdit; 00038 class QComboBox; 00039 class QPushButton; 00040 class QSpinBox; 00041 class QLabel; 00042 class QTextEdit; 00043 class DoubleSpinBox; 00044 class ScriptEdit; 00045 class ApplicationWindow; 00046 00048 class FunctionDialog : public QDialog 00049 { 00050 Q_OBJECT 00051 00052 public: 00053 FunctionDialog(ApplicationWindow* parent, bool standAlone = true, Qt::WFlags fl = 0 ); 00054 00055 void setCurveToModify(Graph *g, int curve); 00056 void setCurveToModify(FunctionCurve *c); 00057 void setGraph(Graph *g){graph = g;}; 00058 00059 protected slots: 00060 void raiseWidget(int index); 00061 void insertFunction(); 00062 void updateFunctionExplain(int); 00063 void acceptFunction(); 00064 void acceptParametric(); 00065 void acceptPolar(); 00066 void showFunctionLog(); 00067 void showXParLog(); 00068 void showYParLog(); 00069 void showPolarRadiusLog(); 00070 void showPolarThetaLog(); 00071 void setActiveEditor(ScriptEdit *edit){d_active_editor = edit;}; 00072 void guessConstants(); 00073 00074 public slots: 00075 void accept(); 00076 void clearList(); 00077 00078 private: 00079 void setConstants(FunctionCurve *c, const QMap<QString, double>& constants); 00080 00081 Graph *graph; 00082 int curveID; 00083 00084 ScriptEdit* boxXFunction; 00085 ScriptEdit* boxYFunction; 00086 ScriptEdit* boxPolarRadius; 00087 ScriptEdit* boxPolarTheta; 00088 QComboBox* boxType; 00089 QLabel* textFunction; 00090 DoubleSpinBox* boxFrom; 00091 DoubleSpinBox* boxTo; 00092 QLineEdit* boxParameter; 00093 DoubleSpinBox* boxParFrom; 00094 DoubleSpinBox* boxParTo; 00095 QLineEdit* boxPolarParameter; 00096 DoubleSpinBox* boxPolarFrom; 00097 DoubleSpinBox* boxPolarTo; 00098 QPushButton* buttonClear; 00099 QPushButton* buttonCancel; 00100 QPushButton* buttonOk; 00101 QSpinBox* boxPoints; 00102 QSpinBox* boxParPoints; 00103 QSpinBox* boxPolarPoints; 00104 QStackedWidget* optionStack; 00105 ScriptEdit* boxFunction; 00106 QWidget* functionPage; 00107 QWidget* polarPage; 00108 QWidget* parametricPage; 00109 QTableWidget *boxConstants; 00110 QPushButton *addFunctionBtn; 00111 QComboBox* boxMathFunctions; 00112 QTextEdit* boxFunctionExplain; 00113 QPushButton *buttonFunctionLog, *buttonXParLog, *buttonYParLog, *buttonPolarRadiusLog, *buttonPolarRThetaLog; 00114 00115 ApplicationWindow *d_app; 00116 ScriptEdit *d_active_editor; 00117 bool d_stand_alone; 00118 }; 00119 00120 #endif // FUNCTIONDIALOG_H