QtiPlot  0.9.8.2
Note.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : Note.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2006 - 2009 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : Notes window class
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef NOTE_H
30 #define NOTE_H
31 
32 #include <MdiSubWindow.h>
33 #include <ScriptEdit.h>
34 #include <LineNumberDisplay.h>
35 #include <QTextEdit>
36 #include <QTabWidget>
37 
38 class ScriptingEnv;
39 
43 class Note: public MdiSubWindow
44 {
45  Q_OBJECT
46 
47 public:
48 
49  Note(ScriptingEnv *env, const QString& label, ApplicationWindow* parent, const QString& name = QString(), Qt::WFlags f=0);
50  ~Note(){};
51 
52  void init(ScriptingEnv *env);
53  void setName(const QString& name);
54  void setTabStopWidth(int length);
56  ScriptEdit* editor(int index);
58  int tabs(){return d_tab_widget->count();};
59  void renameTab(int, const QString&);
60 
61  void save(const QString& fn, const QString &info, bool = false);
62  void restore(const QStringList&);
63 
64 public slots:
65  bool autoexec() const { return autoExec; }
66  void setAutoexec(bool);
67  void modifiedNote();
68 
69  // ScriptEdit methods
70  QString text() { if(currentEditor()) return currentEditor()->text(); return QString::null;};
71  void setText(const QString &s) { if(currentEditor()) currentEditor()->setText(s); };
72  void print() { if(currentEditor()) currentEditor()->print(); };
73  void print(QPrinter *printer) { if(currentEditor()) currentEditor()->print(printer); };
74  void exportPDF(const QString& fileName){if(currentEditor()) currentEditor()->exportPDF(fileName);};
75  QString exportASCII(const QString &file=QString::null) { if(currentEditor()) return currentEditor()->exportASCII(file); return QString::null;};
76  QString importASCII(const QString &file=QString::null){ if(currentEditor()) return currentEditor()->importASCII(file); return QString::null;};
77  void execute() { if(currentEditor()) currentEditor()->execute(); };
79  void evaluate() { if(currentEditor()) currentEditor()->evaluate(); };
80  void setDirPath(const QString& path){if(currentEditor()) currentEditor()->setDirPath(path);};
81 
83  void showLineNumbers(bool show = true);
85 
86  void setFont(const QFont& f);
87  void addTab();
88  void removeTab(int = -1);
89  void renameCurrentTab();
90 
91  signals:
92  void dirPathChanged(const QString& path);
93  void currentEditorChanged();
94 
95 private:
96  void saveTab(int index, const QString &fn);
97 
99  QWidget *d_frame;
100  QTabWidget *d_tab_widget;
102  bool autoExec;
103 };
104 
105 #endif