operations.h

Go to the documentation of this file.
00001 /* Copyright (C) 2006 P.L. Lucas
00002  *
00003  * This program is free software; you can redistribute it and/or modify
00004  * it under the terms of the GNU General Public License as published by
00005  * the Free Software Foundation; either version 2 of the License, or
00006  * (at your option) any later version.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, 
00016  * Boston, MA 02111-1307, USA. 
00017  */
00018 
00019 #ifndef __OPERATIONS_H__
00020 #define __OPERATIONS_H__
00021 #include "mainwindow.h"
00022 #include "octave_connection.h"
00023 #include "basewidget.h"
00024 #include "table.h"
00025 #include <QDialog>
00026 #include <QLineEdit>
00027 #include <QTreeWidget>
00028 #include <QComboBox>
00029 #include <QCheckBox>
00030 
00031 
00032 /**This class is used to show plots menus.
00033  */
00034 class Plot:public QDialog
00035 {
00036         Q_OBJECT
00037         public:
00038         /**Menu type.*/
00039         enum Type {PLOT,SEMILOGY, SEMILOGX, LOGLOG, POLAR};
00040         Plot(QWidget *parent=0, Plot::Type type=PLOT);
00041         /**Command to send to Octave.
00042          * @return QString representing command. This command is used by Octave to plot.
00043          */
00044         QString command();
00045         
00046         private:
00047         QLineEdit *x_lineedit, *y_lineedit, *error_x_lineedit, *error_y_lineedit, *title_lineedit;
00048         QVBoxLayout *vlayout;
00049         QComboBox *style_combo, *color_combo, *pointStyle_combo;
00050         QTreeWidget *plots_tree;
00051         QCheckBox *no_title;
00052         Plot::Type type;
00053         
00054         public slots:
00055         void add_callback();
00056         void remove_callback();
00057         void copy_clipboard_callback();
00058 };
00059 
00060 
00061 /*
00062 Muestra asistentes para realizar operaciones básicas con octave. 
00063 */
00064 
00065 class Operations:public QObject
00066 {
00067         Q_OBJECT
00068         public:
00069         Operations( QObject * parent = 0, BaseWidget **active_widget=0, MainWindow *main_window=0 );
00070         void setOctaveConnection(OctaveConnection *octave_connection);
00071         void setMatrix(QString matrix);
00072         
00073         enum MenuResult {ACCEPTED, COPY_CLIPBOARD, CANCEL}; //Se usa para saber el tipo de salida de un menú
00074         
00075         private:
00076         OctaveConnection *octave_connection;
00077         QString matrix;
00078         BaseWidget **active_widget;
00079         MainWindow *main_window;
00080         
00081         bool copy_clipboard_ok;
00082         
00083         public:
00084         /**Shows simple dialog with one label and line edit.
00085          * @param title Dialog title.
00086          * @param label Dialog label.
00087          * @param input Value of line edit
00088          * @return true if user press ok button.
00089          */
00090         bool input_dialog(QString title, QString label, QString &input);
00091         /**Shows simple dialog with one label and line edit, and executes _command with line edit value.
00092          * @param title Dialog title.
00093          * @param label Dialog label.
00094          * @param _command Command to execute.
00095          * @return true if user press ok button.
00096          */
00097         void simple_comand(QString title, QString label, QString _command);
00098         /**Shows dialog with labels and line edits.
00099          * @param title Dialog title.
00100          * @param parameters_labels Dialog labels for input parameters.
00101          * @param parameters Value of line edits for input parameters.
00102          * @param output_labels Dialog labels for output parameters.
00103          * @param output Value of line edits for output parameters.
00104          * @param help Html text with help.
00105          * @param accept_blank_parameters If user lefts parameters in blank, this option lets them. Otherwise function returns CANCEL.
00106          * @return Result of dialog.
00107          */
00108         MenuResult menu_window(QString title, QStringList parameters_labels, QStringList &parameters, QStringList output_labels, QStringList &output, QString help=QString(), bool accept_blank_parameters=false);
00109         public:
00110         /**Shows dialog with labels and line edits, and executes _command with line edit value..
00111          * @param title Dialog title.
00112          * @param _command Command to execute.
00113          * @param parameters_labels Dialog labels for input parameters.
00114          * @param parameters Value of line edits for input parameters.
00115          * @param output_labels Dialog labels for output parameters.
00116          * @param output Value of line edits for output parameters.
00117          * @param help Html text with help.
00118          * @param is_table If focused window is a table window, asigs value to table.
00119          * @param accept_blank_parameters If user lefts parameters in blank, this option lets them. Otherwise function returns.
00120          */
00121         void compex_comand(QString title, QString _command, QStringList parameters_labels, QStringList &parameters, QStringList output_labels, QStringList &output, QString help=QString(), bool is_table=false, bool accept_blank_parameters=false);
00122         
00123         public slots:
00124         /**Makes copy_clipboard_ok true. This callback function deals with menu_window and input_dialog methods.
00125          * @see copy_clipboard_ok, menu_window, input_dialog.
00126          */
00127         void copy_clipboard_callback();
00128         
00129         //Operaciones con matrices
00130         void inverse_callback();
00131         void determinant_callback();
00132         void eigenvalues_callback();
00133         void transpose_callback();
00134         void submatrix_callback();
00135         
00136         //Operaciones estadísticas
00137         void mean_callback();
00138         void median_callback();
00139         void std_callback();
00140         void cov_callback();
00141         void corrcoef_callback();
00142         
00143         //Plot menu
00144         void plot_callback();
00145         void axis_callback();
00146         void title_label_callback();
00147         void to_eps_callback();
00148         void to_pdf_callback();
00149         void to_png_callback();
00150         void semilogy_callback();
00151         void semilogx_callback();
00152         void log_log_callback();
00153         void polar_callback();
00154         void error_bars_callback();
00155         /**Callback for histogram menu. Shows dialog for histogram.*/
00156         void hist_callback();
00157         /**Callback for bar graph menu. Shows dialog for bar graph.*/
00158         void bar_callback();
00159         /**Callback for contour menu. Shows dialog for contour plot of three-dimensional surface.*/
00160         void contour_callback();
00161         /**Callback for mesh menu. Shows dialog for plot of three-dimensional surface.*/
00162         void mesh_callback();
00163         /**Callback for A+B menu.*/
00164         void suma_callback();
00165         /**Callback for A*B menu.*/
00166         void producto_callback();
00167         /**Callback for A**B menu.*/
00168         void exponente_callback();
00169         
00170         //General actions
00171         void editor_callback();
00172         
00173         //Config actions
00174         void general_config_callback();
00175 
00176 };
00177 
00178 
00179 
00180 
00181 
00182 #endif

Generated on Wed Mar 7 10:15:11 2007 for QtOctave by  doxygen 1.4.7