Mercurial > octave
annotate gui/src/FileEditorMdiSubWindow.h @ 13562:a89aa9e05e19
editor: menu bar, run editor file in octave
author | ttl <ttl@justmail.de> |
---|---|
date | Sun, 31 Jul 2011 22:33:50 +0200 |
parents | 248b897d9f36 |
children | e76a22bfe406 |
rev | line source |
---|---|
13504
13e3d60aff2d
Replaced Quint with OctaveGUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13503
diff
changeset
|
1 /* OctaveGUI - A graphical user interface for Octave |
13501 | 2 * Copyright (C) 2011 Jacob Dawid |
3 * jacob.dawid@googlemail.com | |
4 * | |
5 * This program is free software: you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License as published by | |
7 * the Free Software Foundation, either version 3 of the License, or | |
8 * (at your option) any later version. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU General Public License | |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 */ | |
18 | |
19 #ifndef FILEEDITORMDISUBWINDOW_H | |
20 #define FILEEDITORMDISUBWINDOW_H | |
21 | |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
22 #include "OctaveTerminal.h" |
13501 | 23 #include <QMdiSubWindow> |
24 #include <QToolBar> | |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
25 #include <QMenuBar> |
13501 | 26 #include <QStatusBar> |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
27 #include <QCloseEvent> |
13501 | 28 #include <Qsci/qsciscintilla.h> |
13503
5ab40ef3d241
Merged diff from Torsten.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
29 // Not available in the Debian repos yet! |
5ab40ef3d241
Merged diff from Torsten.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
30 // #include <Qsci/qscilexeroctave.h> |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13557
diff
changeset
|
31 #include "lexer/lexeroctavegui.h" |
13501 | 32 |
13529 | 33 const char UNNAMED_FILE[] = "<unnamed>"; |
34 const char SAVE_FILE_FILTER[] = "Octave Files *.m(*.m);;All Files *.*(*.*)"; | |
35 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
36 class FileEditorMdiSubWindow:public QMdiSubWindow |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
37 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
38 Q_OBJECT public: |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
39 FileEditorMdiSubWindow (QWidget * parent = 0); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
40 ~FileEditorMdiSubWindow (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
41 void loadFile (QString fileName); |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
42 void initEditor (OctaveTerminal *terminal, LexerOctaveGui *lexer); |
13501 | 43 |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13557
diff
changeset
|
44 public slots: |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
45 |
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
46 void newFile (); |
13530
8c7390b78911
gui-editor: open new editor window via interface menu
ttl <ttl@justmail.de>
parents:
13529
diff
changeset
|
47 void openFile (); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
48 void saveFile (); |
13529 | 49 void saveFile (QString fileName); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
50 void saveFileAs (); |
13501 | 51 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
52 void showToolTipNew (); |
13530
8c7390b78911
gui-editor: open new editor window via interface menu
ttl <ttl@justmail.de>
parents:
13529
diff
changeset
|
53 void showToolTipOpen (); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
54 void showToolTipSave (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
55 void showToolTipSaveAs (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
56 void showToolTipUndo (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
57 void showToolTipRedo (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
58 void registerModified (bool modified); |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
59 |
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
60 protected: |
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
61 void closeEvent(QCloseEvent *event); |
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
62 |
13501 | 63 private: |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
64 int checkFileModified (QString msg); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
65 void construct (); |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
66 QMenuBar *m_menuBar; |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
67 QToolBar *m_toolBar; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
68 QsciScintilla *m_editor; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
69 QStatusBar *m_statusBar; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
70 QString m_fileName; |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
71 OctaveTerminal* m_octave; |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
72 bool m_modified; |
13557
ad18a8e7fb02
editor: change window title if text is modified
ttl <ttl@justmail.de>
parents:
13530
diff
changeset
|
73 |
ad18a8e7fb02
editor: change window title if text is modified
ttl <ttl@justmail.de>
parents:
13530
diff
changeset
|
74 private slots: |
ad18a8e7fb02
editor: change window title if text is modified
ttl <ttl@justmail.de>
parents:
13530
diff
changeset
|
75 void handleModificationChanged(bool modified); |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
76 void runFile(); |
13557
ad18a8e7fb02
editor: change window title if text is modified
ttl <ttl@justmail.de>
parents:
13530
diff
changeset
|
77 |
13501 | 78 }; |
79 | |
80 #endif // FILEEDITORMDISUBWINDOW_H |