File indexing completed on 2024-04-21 03:41:34

0001 /*************************************************************************************
0002  *  Copyright (C) 2007 by Aleix Pol <aleixpol@kde.org>                               *
0003  *                                                                                   *
0004  *  This program is free software; you can redistribute it and/or                    *
0005  *  modify it under the terms of the GNU General Public License                      *
0006  *  as published by the Free Software Foundation; either version 2                   *
0007  *  of the License, or (at your option) any later version.                           *
0008  *                                                                                   *
0009  *  This program is distributed in the hope that it will be useful,                  *
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of                   *
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    *
0012  *  GNU General Public License for more details.                                     *
0013  *                                                                                   *
0014  *  You should have received a copy of the GNU General Public License                *
0015  *  along with this program; if not, write to the Free Software                      *
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA   *
0017  *************************************************************************************/
0018 
0019 #ifndef KALGEBRA_H
0020 #define KALGEBRA_H
0021 
0022 #include <QLabel>
0023 #include <QListView>
0024 #include <QMainWindow>
0025 #include <QPushButton>
0026 #include <QTabWidget>
0027 #include <QTreeView>
0028 
0029 namespace Analitza
0030 {
0031 class PlotsView2D;
0032 class PlotsView3DES;
0033 class PlotsModel;
0034 class VariablesModel;
0035 class ExpressionEdit;
0036 }
0037 
0038 class ConsoleHtml;
0039 class FunctionEdit;
0040 class KRecentFilesAction;
0041 
0042 namespace Analitza
0043 {
0044 class Expression;
0045 }
0046 
0047 class KAlgebra : public QMainWindow
0048 {
0049     Q_OBJECT
0050 public:
0051     KAlgebra(QWidget *parent = nullptr);
0052     ~KAlgebra();
0053 
0054     void add2D(const Analitza::Expression &exp);
0055     void add3D(const Analitza::Expression &exp);
0056 
0057 private:
0058     QLabel *m_status;
0059     QTabWidget *m_tabs;
0060 
0061     // consoleeWidget
0062     QMenu *c_menu;
0063     KRecentFilesAction *c_recentScripts;
0064     Analitza::ExpressionEdit *c_exp;
0065     ConsoleHtml *c_results;
0066     QTreeView *c_variables;
0067     QDockWidget *c_dock_vars;
0068     Analitza::VariablesModel *c_varsModel;
0069 
0070     // graf 2d
0071     QMenu *b_menu;
0072     Analitza::PlotsModel *b_funcsModel;
0073     QTreeView *b_funcs;
0074     QTabWidget *b_tools;
0075     Analitza::PlotsView2D *m_graph2d;
0076     QDockWidget *b_dock_funcs;
0077     FunctionEdit *b_funced;
0078     Analitza::VariablesModel *b_varsModel;
0079 
0080     // graph 3d
0081     QMenu *t_menu;
0082     Analitza::ExpressionEdit *t_exp;
0083     Analitza::PlotsView3DES *m_graph3d;
0084     Analitza::PlotsModel *t_model3d;
0085 
0086     // Dictionary
0087     QDockWidget *d_dock;
0088     QListView *d_list;
0089     QLineEdit *d_filter;
0090 
0091 private Q_SLOTS:
0092     void newInstance();
0093     void fullScreen(bool isFull);
0094 
0095     void initializeRecentScripts();
0096     void operate();
0097     void loadScript();
0098     void loadScript(const QUrl &path);
0099     void saveScript();
0100     void saveLog();
0101     void updateInformation();
0102     void consoleCalculate();
0103     void consoleEvaluate();
0104     void insertAns();
0105 
0106     void select(const QModelIndex &idx);
0107     void new_func();
0108     void remove_func();
0109     void edit_func(const QModelIndex &);
0110     void edit_var(const QModelIndex &);
0111     void toggleSquares();
0112     void toggleKeepAspect();
0113     void set_res_low();
0114     void set_res_std();
0115     void set_res_fine();
0116     void set_res_vfine();
0117     void valueChanged();
0118     void varsContextMenu(const QPoint &);
0119 
0120     void new_func3d();
0121     void set_dots();
0122     void set_lines();
0123     void set_solid();
0124     void save3DGraph();
0125 
0126     void saveGraph();
0127     void functools(int);
0128 
0129     void dictionaryFilterChanged(const QString &filter);
0130 
0131     void changeStatusBar(const QString &);
0132     void tabChanged(int);
0133 };
0134 
0135 #endif