Mercurial > octave
annotate libgui/src/m-editor/file-editor.h @ 17635:7945344506ae
Add possibility to run selected text of the editor in the terminal
* octave-qscintilla.cc(contextMenuEvent): new context menu for running selection
(context_run): function for run selection action in editor file menu;
(contextmenu_run): new slot for context menu run selection;
* octave-qscintilla.h: new functions context_run, contextmenu_run
* file-editor-tab.cc(context_run): new slot for run menu action
* file-editor-tab.h: new slot context_run
* file-editor.cc(request_context_run): new slot for run menu entry;
(construct): new entry in run menu for running the selection in editor
(add_file_editor_tab): connect new signal fetab_context_run to the new
slot context_run in file_editor_tab;
(set_shortcuts): enable/disable new shortcut when editor focus changes
(check_actions): enable/disable new action depending on existing tabs
* file-editor.h: new signal fetab_context_run, new slot request_context_edit,
new run action
author | Torsten <ttl@justmail.de> |
---|---|
date | Fri, 11 Oct 2013 22:46:32 +0200 |
parents | 99ffa521ecec |
children | c060ad097056 |
rev | line source |
---|---|
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
1 /* |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
2 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
3 Copyright (C) 2011-2012 Jacob Dawid |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
4 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
5 This file is part of Octave. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
6 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
10 option) any later version. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
11 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
15 for more details. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
16 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
20 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
21 */ |
13501 | 22 |
23 #ifndef FILEEDITORMDISUBWINDOW_H | |
24 #define FILEEDITORMDISUBWINDOW_H | |
25 | |
26 #include <QToolBar> | |
13584 | 27 #include <QAction> |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
28 #include <QMenuBar> |
13501 | 29 #include <QStatusBar> |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
30 #include <QCloseEvent> |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
31 #include <QTabWidget> |
13501 | 32 |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
33 #include <map> |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
34 |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15106
diff
changeset
|
35 #include "file-editor-interface.h" |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15106
diff
changeset
|
36 #include "file-editor-tab.h" |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
15106
diff
changeset
|
37 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
38 class file_editor : public file_editor_interface |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
39 { |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
40 Q_OBJECT |
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
|
41 |
16457
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
42 public: |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
43 |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16457
diff
changeset
|
44 typedef std::map<QString, QWidget *>::iterator editor_tab_map_iterator; |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16457
diff
changeset
|
45 typedef std::map<QString, QWidget *>::const_iterator editor_tab_map_const_iterator; |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16457
diff
changeset
|
46 |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
47 file_editor (QWidget *p); |
16558 | 48 ~file_editor (void); |
16457
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
49 |
15300
fd27e10b9b05
pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
50 void loadFile (const QString& fileName); |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
51 |
16558 | 52 QMenu *get_mru_menu (void) { return _mru_file_menu; } |
53 QMenu *debug_menu (void); | |
54 QToolBar *toolbar (void); | |
13501 | 55 |
16558 | 56 void set_focus (void); |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
57 void handle_enter_debug_mode (void); |
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
58 void handle_exit_debug_mode (void); |
14830
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14825
diff
changeset
|
59 |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
60 void check_actions (void); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
61 signals: |
16558 | 62 |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
63 void fetab_settings_changed (const QSettings *settings); |
16638
3c2e457eeb72
ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents:
16615
diff
changeset
|
64 void fetab_close_request (const QWidget* ID, bool app_closing = false); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
65 void fetab_change_request (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
66 void fetab_file_name_query (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
67 // Save is a ping-pong type of communication |
16558 | 68 void fetab_save_file (const QWidget* ID, const QString& fileName, |
69 bool remove_on_success); | |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
70 // No fetab_open, functionality in editor |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
71 // No fetab_new, functionality in editor |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
72 void fetab_undo (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
73 void fetab_redo (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
74 void fetab_copy (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
75 void fetab_cut (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
76 void fetab_paste (const QWidget* ID); |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
77 void fetab_context_help (const QWidget* ID, bool); |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
78 void fetab_context_edit (const QWidget* ID); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
79 void fetab_save_file (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
80 void fetab_save_file_as (const QWidget* ID); |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
81 void fetab_print_file (const QWidget* ID); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
82 void fetab_run_file (const QWidget* ID); |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
83 void fetab_context_run (const QWidget* ID); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
84 void fetab_toggle_bookmark (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
85 void fetab_next_bookmark (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
86 void fetab_previous_bookmark (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
87 void fetab_remove_bookmark (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
88 void fetab_toggle_breakpoint (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
89 void fetab_next_breakpoint (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
90 void fetab_previous_breakpoint (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
91 void fetab_remove_all_breakpoints (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
92 void fetab_comment_selected_text (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
93 void fetab_uncomment_selected_text (const QWidget* ID); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
94 void fetab_find (const QWidget* ID); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
95 void fetab_goto_line (const QWidget* ID, int line = -1); |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16386
diff
changeset
|
96 void fetab_insert_debugger_pointer (const QWidget* ID, int line = -1); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16386
diff
changeset
|
97 void fetab_delete_debugger_pointer (const QWidget* ID, int line = -1); |
16558 | 98 void fetab_do_breakpoint_marker (bool insert, const QWidget* ID, |
99 int line = -1); | |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15860
diff
changeset
|
100 void fetab_set_focus (const QWidget* ID); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
101 |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13557
diff
changeset
|
102 public slots: |
16457
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
103 void focus (void); |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
104 |
16452
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16443
diff
changeset
|
105 void request_new_file (const QString& commands); |
16566 | 106 void request_new_script (const QString& commands); |
107 void request_new_function (const QString& commands); | |
16558 | 108 void request_open_file (void); |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
109 void request_close_file (bool); |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
110 void request_close_all_files (bool); |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
111 void request_close_other_files (bool); |
16614
49653ed9561b
Use menu triggered signal instead of action triggered signal to rid cast.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16611
diff
changeset
|
112 void request_mru_open_file (QAction *action); |
16558 | 113 void request_print_file (void); |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
114 |
16558 | 115 void request_undo (void); |
116 void request_redo (void); | |
117 void request_copy (void); | |
118 void request_cut (void); | |
119 void request_paste (void); | |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
120 void request_context_help (bool); |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
121 void request_context_doc (bool); |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
122 void request_context_edit (bool); |
16558 | 123 void request_save_file (void); |
124 void request_save_file_as (void); | |
125 void request_run_file (void); | |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
126 void request_context_run (bool); |
16558 | 127 void request_toggle_bookmark (void); |
128 void request_next_bookmark (void); | |
129 void request_previous_bookmark (void); | |
130 void request_remove_bookmark (void); | |
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:
14795
diff
changeset
|
131 |
16558 | 132 void request_toggle_breakpoint (void); |
133 void request_next_breakpoint (void); | |
134 void request_previous_breakpoint (void); | |
135 void request_remove_breakpoint (void); | |
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:
14795
diff
changeset
|
136 |
16558 | 137 void request_comment_selected_text (void); |
138 void request_uncomment_selected_text (void); | |
139 void request_find (void); | |
13501 | 140 |
16558 | 141 void request_goto_line (void); |
16375
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16291
diff
changeset
|
142 |
16558 | 143 void handle_file_name_changed (const QString& fileName, |
144 const QString& toolTip); | |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
145 void handle_tab_close_request (int index); |
16558 | 146 void handle_tab_remove_request (void); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
147 void handle_add_filename_to_list (const QString& fileName, QWidget *ID); |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
148 void active_tab_changed (int index); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
149 void handle_editor_state_changed (bool enableCopy, const QString& fileName); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
150 void handle_mru_add_file (const QString& file_name); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
151 void check_conflict_save (const QString& fileName, bool remove_on_success); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
152 |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16386
diff
changeset
|
153 void handle_insert_debugger_pointer_request (const QString& file, int line); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16386
diff
changeset
|
154 void handle_delete_debugger_pointer_request (const QString& file, int line); |
16558 | 155 void handle_update_breakpoint_marker_request (bool insert, |
156 const QString& file, int line); | |
157 | |
16399
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
158 void handle_edit_file_request (const QString& file); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
159 |
16558 | 160 // Tells the editor to react on changed settings. |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
161 void notice_settings (const QSettings *settings); |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
162 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
163 // Tells the ditor to dis- or enable some shortcuts |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
164 void set_shortcuts (bool set_shortcuts); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
165 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
166 |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
167 protected slots: |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
168 void copyClipboard (); |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
169 void pasteClipboard (); |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
170 |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
171 private slots: |
16558 | 172 |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
173 void request_open_file (const QString& fileName, int line = -1, |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
174 bool debug_pointer = false, |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
175 bool breakpoint_marker = false, bool insert = true); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
176 |
13501 | 177 private: |
16558 | 178 |
179 void construct (void); | |
180 void add_file_editor_tab (file_editor_tab *f, const QString& fn); | |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
181 void save_file_as (QWidget *fetabID = 0); |
16558 | 182 void mru_menu_update (void); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
183 |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16457
diff
changeset
|
184 QWidget *find_tab_widget (const QString& openFileName) const; |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16457
diff
changeset
|
185 |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
186 std::map<QString, QWidget *> editor_tab_map; |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
187 |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
188 QString ced; |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
189 |
16558 | 190 QMenuBar *_menu_bar; |
191 QToolBar *_tool_bar; | |
192 QMenu *_debug_menu; | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
193 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
194 QAction *_comment_selection_action; |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
195 QAction *_uncomment_selection_action; |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
196 |
16558 | 197 QAction *_copy_action; |
198 QAction *_cut_action; | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
199 QAction *_paste_action; |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
200 QAction *_context_help_action; |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
201 QAction *_context_doc_action; |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
202 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
203 QAction *_find_action; |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
204 QAction *_goto_line_action; |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
205 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
206 QAction *_next_bookmark_action; |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
207 QAction *_previous_bookmark_action; |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
208 QAction *_toggle_bookmark_action; |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
209 QAction * _remove_bookmark_action; |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
210 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
211 QAction *_print_action; |
16558 | 212 QAction *_run_action; |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
213 QAction *_context_run_action; |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
214 |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
215 QAction *_context_edit_action; |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
216 QAction *_save_action; |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
217 QAction *_save_as_action; |
16981
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
218 QAction *_close_action; |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
219 QAction *_close_all_action; |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
220 QAction *_close_others_action; |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
221 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
222 QAction *_redo_action; |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
223 QAction *_undo_action; |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
224 |
16558 | 225 QTabWidget *_tab_widget; |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
226 |
16558 | 227 int _marker_breakpoint; |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
228 |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
229 enum { MaxMRUFiles = 10 }; |
15993
41471c02d51c
gui: show menu with recently used editor files also in file menu of main window
Torsten <ttl@justmail.de>
parents:
15984
diff
changeset
|
230 QMenu *_mru_file_menu; |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
231 QAction *_mru_file_actions[MaxMRUFiles]; |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
232 QStringList _mru_files; |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
233 |
13501 | 234 }; |
235 | |
16291
c22a6cecaedd
build: Use AMCOND to build GUI editor if Qscintilla available.
Rik <rik@octave.org>
parents:
16290
diff
changeset
|
236 #endif // FILEEDITORMDISUBWINDOW_H |