Mercurial > hg > octave-nkf
annotate gui/src/FileEditor.h @ 14599:97cb9286919c gui
Cleaned up code.
* .hgsub: Removed IRC Widget.
* gui.pro: Removed dependency on IRC Widget and removed files.
* class FileEditorMdiSubWindow: Renamed to FileEditor. File editor windows are now independent windows, thus removed the extra close button.
* MainWindow: Removed MDI Area and replaced it with the terminal instead.
* BrowserWidget: Removed browser widget.
* SettingsDialog: Rearranged settings for the editor, removed tab for shortcuts.
* OctaveCallbackThread: Raised update intervals from 0,5s to 1s.
* OctaveLink: Replaced signals names for triggering updates on the symbol table.
* WorkspaceView: Adjusted connect statements to fit the new signal names.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Mon, 07 May 2012 00:53:54 +0200 |
parents | gui/src/FileEditorMdiSubWindow.h@be3e1a14a6de |
children | 7605e7136b50 |
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 |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) |
13501 | 3 * |
4 * This program is free software: you can redistribute it and/or modify | |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14255
diff
changeset
|
5 * it under the terms of the GNU General Public License as |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
6 * published by the Free Software Foundation, either version 3 of the |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
7 * License, or (at your option) any later version. |
13501 | 8 * |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14255
diff
changeset
|
12 * GNU General Public License for more details. |
13501 | 13 * |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14255
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13672
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
13501 | 16 */ |
17 | |
18 #ifndef FILEEDITORMDISUBWINDOW_H | |
19 #define FILEEDITORMDISUBWINDOW_H | |
20 | |
13657
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13654
diff
changeset
|
21 #include "MainWindow.h" |
14255
5dcfb705ce12
GUI: Bundled the new qterminal.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13869
diff
changeset
|
22 |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14307
diff
changeset
|
23 #include <QWidget> |
13501 | 24 #include <QToolBar> |
13584 | 25 #include <QAction> |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
26 #include <QMenuBar> |
13501 | 27 #include <QStatusBar> |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
28 #include <QCloseEvent> |
13501 | 29 #include <Qsci/qsciscintilla.h> |
13503
5ab40ef3d241
Merged diff from Torsten.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
30 // Not available in the Debian repos yet! |
5ab40ef3d241
Merged diff from Torsten.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
31 // #include <Qsci/qscilexeroctave.h> |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13557
diff
changeset
|
32 #include "lexer/lexeroctavegui.h" |
13501 | 33 |
13529 | 34 const char UNNAMED_FILE[] = "<unnamed>"; |
13649
0a19410e88c0
improve save as: auto-add extension .m with check for overwrite
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
35 const char SAVE_FILE_FILTER[] = "Octave Files (*.m);;All Files (*.*)"; |
13584 | 36 enum MARKER |
37 { | |
38 MARKER_BOOKMARK, | |
39 MARKER_BREAKPOINT | |
40 }; | |
13529 | 41 |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14307
diff
changeset
|
42 class FileEditor : public QWidget |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
43 { |
14307
be3e1a14a6de
Added an interface settings tab to the settings dialog. Made a few improvements on the editor. Wrote a small welcome text in the welcome wizard. Moved configuration file to ~/.config/octave-gui/settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14290
diff
changeset
|
44 Q_OBJECT |
be3e1a14a6de
Added an interface settings tab to the settings dialog. Made a few improvements on the editor. Wrote a small welcome text in the welcome wizard. Moved configuration file to ~/.config/octave-gui/settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14290
diff
changeset
|
45 |
be3e1a14a6de
Added an interface settings tab to the settings dialog. Made a few improvements on the editor. Wrote a small welcome text in the welcome wizard. Moved configuration file to ~/.config/octave-gui/settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14290
diff
changeset
|
46 public: |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14307
diff
changeset
|
47 FileEditor (QWidget * parent = 0); |
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14307
diff
changeset
|
48 ~FileEditor (); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
49 void loadFile (QString fileName); |
14255
5dcfb705ce12
GUI: Bundled the new qterminal.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13869
diff
changeset
|
50 void initEditor (QTerminal *terminalView, |
13657
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13654
diff
changeset
|
51 LexerOctaveGui *lexer, |
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13654
diff
changeset
|
52 MainWindow *mainWindow); |
13501 | 53 |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13557
diff
changeset
|
54 public slots: |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
55 |
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
56 void newFile (); |
13530
8c7390b78911
gui-editor: open new editor window via interface menu
ttl <ttl@justmail.de>
parents:
13529
diff
changeset
|
57 void openFile (); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
58 void saveFile (); |
13529 | 59 void saveFile (QString fileName); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
60 void saveFileAs (); |
13501 | 61 |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14307
diff
changeset
|
62 void setModified (bool modified); |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
63 |
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
64 protected: |
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
65 void closeEvent(QCloseEvent *event); |
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
66 |
13501 | 67 private: |
13657
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13654
diff
changeset
|
68 int checkFileModified (QString msg, int cancelButton); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
69 void construct (); |
13654
c67f7d390a1a
editor: comment/uncomment selected text
ttl <ttl@justmail.de>
parents:
13650
diff
changeset
|
70 void doCommentSelectedText (bool comment); |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
71 QMenuBar *m_menuBar; |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
72 QToolBar *m_toolBar; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
73 QsciScintilla *m_editor; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
74 QStatusBar *m_statusBar; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
75 QString m_fileName; |
13672
c9501268a194
filename with or without full path in tabs of the editor
ttl <ttl@justmail.de>
parents:
13657
diff
changeset
|
76 QString m_fileNameShort; |
14255
5dcfb705ce12
GUI: Bundled the new qterminal.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13869
diff
changeset
|
77 QTerminal* m_terminalView; |
13584 | 78 QAction* m_copyAction; |
79 QAction* m_cutAction; | |
13657
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13654
diff
changeset
|
80 MainWindow* m_mainWindow; |
13584 | 81 int m_markerBookmark; |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
82 bool m_modified; |
13672
c9501268a194
filename with or without full path in tabs of the editor
ttl <ttl@justmail.de>
parents:
13657
diff
changeset
|
83 bool m_longTitle; |
13557
ad18a8e7fb02
editor: change window title if text is modified
ttl <ttl@justmail.de>
parents:
13530
diff
changeset
|
84 |
ad18a8e7fb02
editor: change window title if text is modified
ttl <ttl@justmail.de>
parents:
13530
diff
changeset
|
85 private slots: |
13672
c9501268a194
filename with or without full path in tabs of the editor
ttl <ttl@justmail.de>
parents:
13657
diff
changeset
|
86 void newWindowTitle(bool modified); |
13584 | 87 void handleMarginClicked(int line, int margin, Qt::KeyboardModifiers state); |
88 void handleCopyAvailable(bool enableCopy); | |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
89 void runFile(); |
13650
b93bfa9486ad
editor: bookmarks now toggled by F7 (bug #34066), menu entry for removing all bookmarks
ttl <ttl@justmail.de>
parents:
13649
diff
changeset
|
90 void removeBookmark (); |
13584 | 91 void toggleBookmark (); |
92 void nextBookmark(); | |
93 void prevBookmark(); | |
13654
c67f7d390a1a
editor: comment/uncomment selected text
ttl <ttl@justmail.de>
parents:
13650
diff
changeset
|
94 void commentSelectedText(); |
c67f7d390a1a
editor: comment/uncomment selected text
ttl <ttl@justmail.de>
parents:
13650
diff
changeset
|
95 void uncommentSelectedText(); |
13557
ad18a8e7fb02
editor: change window title if text is modified
ttl <ttl@justmail.de>
parents:
13530
diff
changeset
|
96 |
13501 | 97 }; |
98 | |
99 #endif // FILEEDITORMDISUBWINDOW_H |