Mercurial > hg > octave-nkf
annotate libgui/src/m-editor/file-editor-tab.h @ 15196:017f0b2e6933
rename gui directory to libgu
* libgui: Rename from gui.
* .hgsub (libgui/qterminal): Rename from gui/qterminal.
* Makefile.am (GUIDIR): Set to libgui instead of gui if
AMCOND_BUILD_GUI is true.
* configure.ac (AC_CONFIG_FILES): Update list for directory renaming.
* Makefile.am (.NOTPARALLEL): Delete.
List octave.html/index.html as the primary HTML target, not
octave.html.
(octave.html): New target for making the octave.html directory.
(octave.pdf): Depend on octave.dvi.
* images.awk: In generated rules for png files, depend on octave.html,
not octave.html/index.html.
* src/Makefile.am (OCTAVE_GUI_CPPFLAGS, OCTAVE_GUI_LIBS): Update for
directory renaming.
(CLEANFILES): Fix typo.
* fntests.m (src_tree): Use libinterp, not src.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 18 Aug 2012 18:10:09 -0400 |
parents | gui/src/m-editor/file-editor-tab.h@4c4f2fb07a50 |
children | 359098ad343e |
rev | line source |
---|---|
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
1 /* OctaveGUI - A graphical user interface for Octave |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
3 * |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
4 * This program is free software: you can redistribute it and/or modify |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
6 * published by the Free Software Foundation, either version 3 of the |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
7 * License, or (at your option) any later version. |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
8 * |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
12 * GNU General Public License for more details. |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
13 * |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
16 */ |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
17 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
18 #ifndef FILEEDITORTAB_H |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
19 #define FILEEDITORTAB_H |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
20 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
21 #include <Qsci/qsciscintilla.h> |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
22 #include <QWidget> |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
23 #include <QCloseEvent> |
14690
ca733a66be7a
Fixed bug with not opening the editor when clicking a file from the file browser. Implemented watching the file on disk.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14680
diff
changeset
|
24 #include <QFileSystemWatcher> |
14804
a565c560e654
Replaced a lot of terminal interaction with events: Clearing, loading and saving workspace, running a file. Default location for saving a new file is now the current working directory. Fixed bad settings with a fresh installation of the GUI by providing a file with default settings and installing it when appropriate.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
25 #include "octave-event-observer.h" |
a565c560e654
Replaced a lot of terminal interaction with events: Clearing, loading and saving workspace, running a file. Default location for saving a new file is now the current working directory. Fixed bad settings with a fresh installation of the GUI by providing a file with default settings and installing it when appropriate.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
26 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
27 class file_editor; |
14804
a565c560e654
Replaced a lot of terminal interaction with events: Clearing, loading and saving workspace, running a file. Default location for saving a new file is now the current working directory. Fixed bad settings with a fresh installation of the GUI by providing a file with default settings and installing it when appropriate.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
28 class file_editor_tab : public QWidget, public octave_event_observer |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
29 { |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
30 Q_OBJECT |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
31 public: |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
32 file_editor_tab (file_editor *fileEditor); |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
33 bool copy_available (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
34 |
14804
a565c560e654
Replaced a lot of terminal interaction with events: Clearing, loading and saving workspace, running a file. Default location for saving a new file is now the current working directory. Fixed bad settings with a fresh installation of the GUI by providing a file with default settings and installing it when appropriate.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
35 void event_accepted (octave_event *e); |
a565c560e654
Replaced a lot of terminal interaction with events: Clearing, loading and saving workspace, running a file. Default location for saving a new file is now the current working directory. Fixed bad settings with a fresh installation of the GUI by providing a file with default settings and installing it when appropriate.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
36 void event_reject (octave_event *e); |
a565c560e654
Replaced a lot of terminal interaction with events: Clearing, loading and saving workspace, running a file. Default location for saving a new file is now the current working directory. Fixed bad settings with a fresh installation of the GUI by providing a file with default settings and installing it when appropriate.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
37 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
38 public slots: |
14788
85daba52b2d4
Fixed bug with editor complaining that a file has been modified by another application when saving.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
39 void update_window_title(bool modified); |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
40 void handle_copy_available(bool enableCopy); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
41 void handle_margin_clicked (int line, int margin, Qt::KeyboardModifiers state); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
42 void comment_selected_text (); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
43 void uncomment_selected_text (); |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14873
diff
changeset
|
44 void find (); |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
45 void remove_bookmark (); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
46 void toggle_bookmark (); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
47 void next_bookmark (); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
48 void previous_bookmark (); |
14829
e97be88fc478
Fixed removing all breakpoints.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14827
diff
changeset
|
49 void remove_all_breakpoints (); |
14825
eae0e9f2a8c6
Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14804
diff
changeset
|
50 void toggle_breakpoint (); |
eae0e9f2a8c6
Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14804
diff
changeset
|
51 void next_breakpoint (); |
eae0e9f2a8c6
Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14804
diff
changeset
|
52 void previous_breakpoint (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
53 void cut (); |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
54 void copy (); |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
55 void paste (); |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
56 void undo (); |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
57 void redo (); |
14825
eae0e9f2a8c6
Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14804
diff
changeset
|
58 void set_debugger_position (int line); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
59 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
60 void set_modified (bool modified = true); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
61 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
62 bool open_file (); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
63 void load_file (QString fileName); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
64 void new_file (); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
65 bool save_file (); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
66 bool save_file(QString saveFileName); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
67 bool save_file_as(); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
68 void run_file (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
69 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
70 void file_has_changed (QString fileName); |
14690
ca733a66be7a
Fixed bug with not opening the editor when clicking a file from the file browser. Implemented watching the file on disk.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14680
diff
changeset
|
71 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
72 signals: |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
73 void file_name_changed (QString fileName); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
74 void editor_state_changed (); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
75 void close_request (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
76 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
77 protected: |
14680
628eeaf879f7
Copy/Paste buttons get greyed out in the editor correctly again. Removed margin in editor tabs and status bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
78 void closeEvent (QCloseEvent *event); |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
79 void set_file_name (QString fileName); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
80 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
81 private: |
14869
db3c84d38345
Now supporting c/cc/cpp syntax highlighting.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14829
diff
changeset
|
82 void update_lexer (); |
14827
6b90737f69cc
Very basic breakpoint setting and removing in the editor works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14825
diff
changeset
|
83 void request_add_breakpoint (int line); |
6b90737f69cc
Very basic breakpoint setting and removing in the editor works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14825
diff
changeset
|
84 void request_remove_breakpoint (int line); |
6b90737f69cc
Very basic breakpoint setting and removing in the editor works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14825
diff
changeset
|
85 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
86 void update_tracked_file (); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
87 int check_file_modified (QString msg, int cancelButton); |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
88 void do_comment_selected_text (bool comment); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
89 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
90 file_editor * _file_editor; |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
91 QsciScintilla * _edit_area; |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
92 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
93 QString _file_name; |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
94 QString _file_name_short; |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
95 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
96 bool _long_title; |
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
97 bool _copy_available; |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
98 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
99 QFileSystemWatcher _file_system_watcher; |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
100 }; |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
101 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
102 #endif // FILEEDITORTAB_H |