Mercurial > octave-nkf
annotate libgui/src/m-editor/file-editor.cc @ 17740:e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
* settings-dialog.ui: adding checkbox for new preference
* settings-dialog.cc(constructor): reading new option from the settings and
initializing new checkbox;
(write_changed_settings): write checkbox state into the settings file
* file_editor.cc(request_opren_file): when file to open does not exist
read new option from the settings and skip the dialog accordingly
author | Torsten <ttl@justmail.de> |
---|---|
date | Wed, 23 Oct 2013 22:20:06 +0200 |
parents | 6a2e483125dd |
children | d63878346099 |
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 |
15286
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
24 #include <config.h> |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
25 #endif |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
26 |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15861
diff
changeset
|
27 #ifdef HAVE_QSCINTILLA |
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15861
diff
changeset
|
28 |
14707
674740c44c09
Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14703
diff
changeset
|
29 #include "file-editor.h" |
15356
842ab161c10a
GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents:
15321
diff
changeset
|
30 #include "resource-manager.h" |
13501 | 31 #include <QVBoxLayout> |
32 #include <QApplication> | |
33 #include <QFile> | |
13584 | 34 #include <QFont> |
13501 | 35 #include <QFileDialog> |
36 #include <QMessageBox> | |
37 #include <QStyle> | |
38 #include <QTextStream> | |
16407
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
39 #include <QProcess> |
13501 | 40 |
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
|
41 #include "octave-link.h" |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
42 #include "utils.h" |
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
|
43 |
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
|
44 file_editor::file_editor (QWidget *p) |
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
|
45 : file_editor_interface (p) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
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 // Set current editing directory before construct because loaded |
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
|
48 // files will change ced accordingly. |
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
|
49 ced = QDir::currentPath (); |
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
|
50 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
51 construct (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
52 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
53 setVisible (false); |
13501 | 54 } |
55 | |
16558 | 56 file_editor::~file_editor (void) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
57 { |
15356
842ab161c10a
GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents:
15321
diff
changeset
|
58 QSettings *settings = resource_manager::get_settings (); |
16558 | 59 |
16740
cfefcc2a4dae
do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents:
16739
diff
changeset
|
60 // Have all file editor tabs signal what their file names are. |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
61 editor_tab_map.clear (); |
16740
cfefcc2a4dae
do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents:
16739
diff
changeset
|
62 emit fetab_file_name_query (0); |
16558 | 63 |
16740
cfefcc2a4dae
do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents:
16739
diff
changeset
|
64 // save file names (even if last session will not be restored next time) |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
65 QStringList fetFileNames; |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
66 for (editor_tab_map_const_iterator p = editor_tab_map.begin (); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
67 p != editor_tab_map.end (); p++) |
16740
cfefcc2a4dae
do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents:
16739
diff
changeset
|
68 { |
cfefcc2a4dae
do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents:
16739
diff
changeset
|
69 QString file_name = p->first; |
cfefcc2a4dae
do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents:
16739
diff
changeset
|
70 if (!file_name.isEmpty () && file_name.at (file_name.size () - 1) != '/') |
cfefcc2a4dae
do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents:
16739
diff
changeset
|
71 fetFileNames.append (p->first); // do not append unnamed files |
cfefcc2a4dae
do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents:
16739
diff
changeset
|
72 } |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
73 |
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
|
74 settings->setValue ("editor/savedSessionTabs", fetFileNames); |
15356
842ab161c10a
GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents:
15321
diff
changeset
|
75 settings->sync (); |
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
|
76 |
16638
3c2e457eeb72
ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents:
16637
diff
changeset
|
77 for (int index = _tab_widget->count ()-1; index >= 0; index--) |
3c2e457eeb72
ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents:
16637
diff
changeset
|
78 emit fetab_close_request (_tab_widget->widget (index),true); // true: app closing |
3c2e457eeb72
ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents:
16637
diff
changeset
|
79 |
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
|
80 if (_mru_file_menu) |
41471c02d51c
gui: show menu with recently used editor files also in file menu of main window
Torsten <ttl@justmail.de>
parents:
15984
diff
changeset
|
81 delete _mru_file_menu; |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
82 } |
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
83 |
16457
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
84 void |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
85 file_editor::focus (void) |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
86 { |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
87 set_focus (); |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
88 } |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
89 |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
90 // set focus to editor and its current tab |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
91 void |
16558 | 92 file_editor::set_focus (void) |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
93 { |
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
|
94 if (!isVisible ()) |
41471c02d51c
gui: show menu with recently used editor files also in file menu of main window
Torsten <ttl@justmail.de>
parents:
15984
diff
changeset
|
95 setVisible (true); |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
96 setFocus (); |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
97 activateWindow (); |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
98 raise (); |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
99 QWidget *fileEditorTab = _tab_widget->currentWidget (); |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
100 if (fileEditorTab) |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
101 emit fetab_set_focus (fileEditorTab); |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
102 } |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
103 |
14795
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
104 QMenu * |
16558 | 105 file_editor::debug_menu (void) |
14795
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
106 { |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
107 return _debug_menu; |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
108 } |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
109 |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
110 QToolBar * |
16558 | 111 file_editor::toolbar (void) |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
112 { |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
113 return _tool_bar; |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
114 } |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
115 |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
116 void |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
117 file_editor::handle_enter_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:
14829
diff
changeset
|
118 { |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
119 _run_action->setEnabled (false); |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
120 } |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
121 |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
122 void |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
123 file_editor::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:
14829
diff
changeset
|
124 { |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
125 _run_action->setEnabled (true); |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
126 } |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
127 |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
128 void |
16452
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16443
diff
changeset
|
129 file_editor::request_new_file (const QString& commands) |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
130 { |
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
|
131 // New file isn't a file_editor_tab function since the file |
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
|
132 // editor tab has yet to be created and there is no object to |
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
|
133 // pass a signal to. Hence, functionality is here. |
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
|
134 |
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
|
135 file_editor_tab *fileEditorTab = new file_editor_tab (ced); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
136 if (fileEditorTab) |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
137 { |
15982
131d40cd805b
gui: cleanup some string constants for translations
Torsten <ttl@justmail.de>
parents:
15980
diff
changeset
|
138 add_file_editor_tab (fileEditorTab, ""); // new tab with empty title |
16452
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16443
diff
changeset
|
139 fileEditorTab->new_file (commands); // title is updated here |
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
|
140 set_focus (); // focus editor and new tab |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
141 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
142 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
143 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
144 void |
16566 | 145 file_editor::request_new_script (const QString& commands) |
146 { | |
147 request_new_file (commands); | |
148 } | |
149 | |
150 void | |
151 file_editor::request_new_function (const QString& commands) | |
152 { | |
153 QString text = commands; | |
154 | |
155 if (text.isEmpty ()) | |
156 text = "## Copyright (C)\n" | |
157 "\n" | |
158 "## -*- texinfo -*-\n" | |
159 "## @deftypefn {Function File} {[outputs] =} unamed_function (inputs)\n" | |
160 "## @end deftypefn\n" | |
161 "\n" | |
162 "function [outputs] = unnamed_function (inputs)\n" | |
163 "\n" | |
164 "endfunction\n"; | |
165 | |
166 request_new_file (text); | |
167 } | |
168 | |
169 void | |
16558 | 170 file_editor::request_open_file (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
171 { |
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
|
172 // Open file isn't a file_editor_tab function since the file |
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
|
173 // editor tab has yet to be created and there is no object to |
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
|
174 // pass a signal to. Hence, functionality is here. |
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
|
175 |
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 // Create a NonModal message. |
16558 | 177 QFileDialog *fileDialog = new QFileDialog (this); |
16560
ebec000cbfc5
gui: fix editor file name filters to allow all files
Mike Miller <mtmiller@ieee.org>
parents:
16558
diff
changeset
|
178 fileDialog->setNameFilter (tr ("Octave Files (*.m);;All Files (*)")); |
16912
6bd74153c3ae
no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
179 |
6bd74153c3ae
no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
180 // Giving trouble under KDE (problem is related to Qt signal handling on unix, |
6bd74153c3ae
no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
181 // see https://bugs.kde.org/show_bug.cgi?id=260719 , |
6bd74153c3ae
no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
182 // it had/has no effect on Windows, though) |
6bd74153c3ae
no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
183 fileDialog->setOption(QFileDialog::DontUseNativeDialog, true); |
6bd74153c3ae
no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
184 |
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
|
185 fileDialog->setAcceptMode (QFileDialog::AcceptOpen); |
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
|
186 fileDialog->setViewMode (QFileDialog::Detail); |
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
|
187 fileDialog->setDirectory (ced); |
16558 | 188 |
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
|
189 connect (fileDialog, SIGNAL (fileSelected (const QString&)), |
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
|
190 this, SLOT (request_open_file (const QString&))); |
16558 | 191 |
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
|
192 fileDialog->setWindowModality (Qt::NonModal); |
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
|
193 fileDialog->setAttribute (Qt::WA_DeleteOnClose); |
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
|
194 fileDialog->show (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
195 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
196 |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
197 // Check whether this file is already open in the editor. |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
198 QWidget * |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
199 file_editor::find_tab_widget (const QString& file) const |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
200 { |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
201 QWidget *retval = 0; |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
202 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
203 for (editor_tab_map_const_iterator p = editor_tab_map.begin (); |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
204 p != editor_tab_map.end (); p++) |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
205 { |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
206 QString tab_file = p->first; |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
207 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
208 if (same_file (file.toStdString (), tab_file.toStdString ())) |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
209 { |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
210 retval = p->second; |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
211 break; |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
212 } |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
213 } |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
214 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
215 return retval; |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
216 } |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
217 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
218 void |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
219 file_editor::request_open_file (const QString& openFileName, int line, |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
220 bool debug_pointer, |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
221 bool breakpoint_marker, bool insert) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
222 { |
16407
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
223 // Check if the user wants to use a custom file editor. |
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
224 QSettings *settings = resource_manager::get_settings (); |
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
225 if (settings->value ("useCustomFileEditor").toBool ()) |
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
226 { |
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
227 QString editor = settings->value ("customFileEditor").toString (); |
16558 | 228 editor.replace ("%f", openFileName); |
229 editor.replace ("%l", QString::number (line)); | |
16407
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
230 QProcess::startDetached (editor); |
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
231 if (line < 0) |
16558 | 232 handle_mru_add_file (QDir::cleanPath (openFileName)); |
16407
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
233 return; |
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
234 } |
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
235 |
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
|
236 if (openFileName.isEmpty ()) |
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:
14681
diff
changeset
|
237 { |
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
|
238 // ?? Not sure this will happen. This routine isn't even called |
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
|
239 // if the user hasn't selected a file. |
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:
14681
diff
changeset
|
240 } |
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
|
241 else |
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
|
242 { |
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
|
243 // Have all file editor tabs signal what their file names are. |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
244 editor_tab_map.clear (); |
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
|
245 emit fetab_file_name_query (0); |
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:
14681
diff
changeset
|
246 |
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
|
247 // Check whether this file is already open in the editor. |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
248 QWidget *tab = find_tab_widget (openFileName); |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
249 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
250 if (tab) |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
251 { |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
252 _tab_widget->setCurrentWidget (tab); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
253 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
254 if (line > 0) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
255 { |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
256 emit fetab_goto_line (tab, line); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
257 |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
258 if (debug_pointer) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
259 emit fetab_insert_debugger_pointer (tab, line); |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
260 |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
261 if (breakpoint_marker) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
262 emit fetab_do_breakpoint_marker (insert, tab, line); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
263 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
264 |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
265 emit fetab_set_focus (tab); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
266 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
267 else |
15356
842ab161c10a
GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents:
15321
diff
changeset
|
268 { |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
269 file_editor_tab *fileEditorTab = new file_editor_tab (); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
270 if (fileEditorTab) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
271 { |
16558 | 272 QString result = fileEditorTab->load_file (openFileName); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
273 if (result == "") |
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
|
274 { |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
275 // Supply empty title then have the file_editor_tab update |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
276 // with full or short name. |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
277 add_file_editor_tab (fileEditorTab, ""); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
278 fileEditorTab->update_window_title (false); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
279 // file already loaded, add file to mru list here |
17706
97ed9dd479ab
make sure all entries in the editor's mru-menu have an absolute path
Torsten <ttl@justmail.de>
parents:
17676
diff
changeset
|
280 QFileInfo file_info = QFileInfo (openFileName); |
97ed9dd479ab
make sure all entries in the editor's mru-menu have an absolute path
Torsten <ttl@justmail.de>
parents:
17676
diff
changeset
|
281 handle_mru_add_file (file_info.canonicalFilePath ()); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
282 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
283 if (line > 0) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
284 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
285 emit fetab_goto_line (fileEditorTab, line); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
286 |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
287 if (debug_pointer) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
288 emit fetab_insert_debugger_pointer (fileEditorTab, |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
289 line); |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
290 if (breakpoint_marker) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
291 emit fetab_do_breakpoint_marker (insert, fileEditorTab, |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
292 line); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
293 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
294 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
295 else |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
296 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
297 delete fileEditorTab; |
17736
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
298 |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
299 if (QFile::exists (openFileName)) |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
300 { |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
301 // File not readable: create a NonModal message about error. |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
302 QMessageBox *msgBox |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
303 = new QMessageBox (QMessageBox::Critical, |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
304 tr ("Octave Editor"), |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
305 tr ("Could not open file\n%1\nfor read: %2."). |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
306 arg (openFileName).arg (result), |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
307 QMessageBox::Ok, this); |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
308 |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
309 msgBox->setWindowModality (Qt::NonModal); |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
310 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
311 msgBox->show (); |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
312 } |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
313 else |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
314 { |
17740
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
315 // File does not exist, should it be crated? |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
316 QMessageBox *msgBox; |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
317 int answer; |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
318 if (settings->value ("editor/create_new_file",false).toBool ()) |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
319 { |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
320 answer = QMessageBox::Yes; |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
321 } |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
322 else |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
323 { |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
324 msgBox = new QMessageBox (QMessageBox::Question, |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
325 tr ("Octave Editor"), |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
326 tr ("File\n%1\ndoes not exist. " |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
327 "Do you want to create it?").arg (openFileName), |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
328 QMessageBox::Yes | QMessageBox::No, this); |
16558 | 329 |
17740
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
330 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
331 answer = msgBox->exec (); |
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
332 } |
17736
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
333 |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
334 if (answer == QMessageBox::Yes) |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
335 { |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
336 // create the file and call the editor again |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
337 QFile file (openFileName); |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
338 if (!file.open (QIODevice::WriteOnly)) |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
339 { |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
340 // error opening the file |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
341 msgBox = new QMessageBox (QMessageBox::Critical, |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
342 tr ("Octave Editor"), |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
343 tr ("Could not open file\n%1\nfor write: %2."). |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
344 arg (openFileName).arg (file.errorString ()), |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
345 QMessageBox::Ok, this); |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
346 |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
347 msgBox->setWindowModality (Qt::NonModal); |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
348 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
349 msgBox->show (); |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
350 } |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
351 else |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
352 { |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
353 file.close (); |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
354 request_open_file (openFileName); |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
355 } |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
356 } |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
357 } |
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
|
358 } |
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
|
359 } |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
360 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
361 // really show editor and the current editor tab |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
362 set_focus (); |
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
|
363 } |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
364 } |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
365 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
366 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
367 // open a file from the mru list |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
368 void |
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
|
369 file_editor::request_mru_open_file (QAction *action) |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
370 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
371 if (action) |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
372 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
373 request_open_file (action->data ().toString ()); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
374 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
375 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
376 |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
377 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
378 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
|
379 file_editor::check_conflict_save (const QString& saveFileName, 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
|
380 { |
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
|
381 // Have all file editor tabs signal what their file names are. |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
382 editor_tab_map.clear (); |
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
|
383 emit fetab_file_name_query (0); |
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
|
384 |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
385 // Check whether this file is already open in the editor. |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
386 QWidget *tab = find_tab_widget (saveFileName); |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
387 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
388 if (tab) |
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
|
389 { |
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
|
390 // Note: to overwrite the contents of some other file editor tab |
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
|
391 // with the same name requires identifying which file editor tab |
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
|
392 // that is (not too difficult) then close that tab. Of course, |
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
|
393 // that could trigger another dialog box if the file editor tab |
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
|
394 // with the same name has modifications in it. This could become |
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
|
395 // somewhat confusing to the user. For now, opt to do nothing. |
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
|
396 |
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
|
397 // Create a NonModal message about error. |
16558 | 398 QMessageBox *msgBox |
399 = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"), | |
400 tr ("File not saved! A file with the selected name\n%1\n" | |
401 "is already open in the editor"). | |
402 arg (saveFileName), | |
403 QMessageBox::Ok, 0); | |
404 | |
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
|
405 msgBox->setWindowModality (Qt::NonModal); |
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
|
406 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
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
|
407 msgBox->show (); |
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
|
408 |
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
|
409 return; |
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
|
410 } |
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
|
411 |
16558 | 412 QObject *saveFileObject = sender (); |
413 QWidget *saveFileWidget = 0; | |
414 | |
415 for (int i = 0; i < _tab_widget->count (); i++) | |
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
|
416 { |
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
|
417 if (_tab_widget->widget (i) == saveFileObject) |
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
|
418 { |
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
|
419 saveFileWidget = _tab_widget->widget (i); |
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
|
420 break; |
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
|
421 } |
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
|
422 } |
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
|
423 if (!saveFileWidget) |
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
|
424 { |
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
|
425 // Create a NonModal message about error. |
16558 | 426 QMessageBox *msgBox |
427 = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"), | |
428 tr ("The associated file editor tab has disappeared. It was likely closed by some means."), | |
429 QMessageBox::Ok, 0); | |
430 | |
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
|
431 msgBox->setWindowModality (Qt::NonModal); |
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
|
432 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
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
|
433 msgBox->show (); |
16558 | 434 |
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
|
435 return; |
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
|
436 } |
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
|
437 |
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
|
438 // Can save without conflict, have the file editor tab do so. |
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
|
439 emit fetab_save_file (saveFileWidget, saveFileName, 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
|
440 } |
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
|
441 |
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
|
442 void |
16558 | 443 file_editor::handle_insert_debugger_pointer_request (const QString& file, |
444 int line) | |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
445 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
446 request_open_file (file, line, true); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
447 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
448 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
449 void |
16558 | 450 file_editor::handle_delete_debugger_pointer_request (const QString& file, |
451 int line) | |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
452 { |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
453 if (! file.isEmpty ()) |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
454 { |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
455 // Have all file editor tabs signal what their file names are. |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
456 editor_tab_map.clear (); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
457 emit fetab_file_name_query (0); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
458 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
459 // Check whether this file is already open in the editor. |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
460 QWidget *tab = find_tab_widget (file); |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
461 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
462 if (tab) |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
463 { |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
464 _tab_widget->setCurrentWidget (tab); |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
465 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
466 if (line > 0) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
467 emit fetab_delete_debugger_pointer (tab, line); |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
468 |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
469 emit fetab_set_focus (tab); |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
470 } |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
471 } |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
472 } |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
473 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
474 void |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
475 file_editor::handle_update_breakpoint_marker_request (bool insert, |
16558 | 476 const QString& file, |
477 int line) | |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
478 { |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
479 request_open_file (file, line, false, true, insert); |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
480 } |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
481 |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
482 void |
16399
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
483 file_editor::handle_edit_file_request (const QString& file) |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
484 { |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
485 request_open_file (file); |
16739
6960ac6ed127
* file-editor.cc(handle_edit_file_request): set focus to the editor widget
Torsten <ttl@justmail.de>
parents:
16737
diff
changeset
|
486 set_focus (); |
16399
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
487 } |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
488 |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
489 void |
16558 | 490 file_editor::request_undo (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
491 { |
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
|
492 emit fetab_undo (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
493 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
494 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
495 void |
16558 | 496 file_editor::request_redo (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
497 { |
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
|
498 emit fetab_redo (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
499 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
500 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
501 void |
16558 | 502 file_editor::request_copy (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
503 { |
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
|
504 emit fetab_copy (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
505 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
506 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
507 void |
16558 | 508 file_editor::request_cut (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
509 { |
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
|
510 emit fetab_cut (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
511 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
512 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
513 void |
16558 | 514 file_editor::request_paste (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
515 { |
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
|
516 emit fetab_paste (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
517 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
518 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
519 void |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
520 file_editor::request_context_help (bool) |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
521 { |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
522 emit fetab_context_help (_tab_widget->currentWidget (), false); |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
523 } |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
524 void |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
525 file_editor::request_context_doc (bool) |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
526 { |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
527 emit fetab_context_help (_tab_widget->currentWidget (), true); |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
528 } |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
529 |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
530 void |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
531 file_editor::request_context_edit (bool) |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
532 { |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
533 emit fetab_context_edit (_tab_widget->currentWidget ()); |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
534 } |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
535 |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
536 void |
16558 | 537 file_editor::request_save_file (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
538 { |
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
|
539 emit fetab_save_file (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
540 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
541 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
542 void |
16558 | 543 file_editor::request_save_file_as (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
544 { |
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
|
545 emit fetab_save_file_as (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
546 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
547 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
548 void |
16558 | 549 file_editor::request_print_file (void) |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
550 { |
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
551 emit fetab_print_file (_tab_widget->currentWidget ()); |
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
552 } |
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
553 |
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
554 |
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
555 void |
16558 | 556 file_editor::request_run_file (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
557 { |
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
|
558 emit fetab_run_file (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
559 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
560 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
561 void |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
562 file_editor::request_context_run (bool) |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
563 { |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
564 emit fetab_context_run (_tab_widget->currentWidget ()); |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
565 } |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
566 |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
567 void |
16558 | 568 file_editor::request_toggle_bookmark (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
569 { |
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
|
570 emit fetab_toggle_bookmark (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
571 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
572 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
573 void |
16558 | 574 file_editor::request_next_bookmark (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
575 { |
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
|
576 emit fetab_next_bookmark (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
577 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
578 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
579 void |
16558 | 580 file_editor::request_previous_bookmark (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
581 { |
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
|
582 emit fetab_previous_bookmark (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
583 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
584 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
585 void |
16558 | 586 file_editor::request_remove_bookmark (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
587 { |
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
|
588 emit fetab_remove_bookmark (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
589 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
590 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
591 void |
16558 | 592 file_editor::request_toggle_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:
14812
diff
changeset
|
593 { |
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
|
594 emit fetab_toggle_breakpoint (_tab_widget->currentWidget ()); |
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:
14812
diff
changeset
|
595 } |
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:
14812
diff
changeset
|
596 |
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:
14812
diff
changeset
|
597 void |
16558 | 598 file_editor::request_next_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:
14812
diff
changeset
|
599 { |
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
|
600 emit fetab_next_breakpoint (_tab_widget->currentWidget ()); |
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:
14812
diff
changeset
|
601 } |
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:
14812
diff
changeset
|
602 |
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:
14812
diff
changeset
|
603 void |
16558 | 604 file_editor::request_previous_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:
14812
diff
changeset
|
605 { |
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
|
606 emit fetab_previous_breakpoint (_tab_widget->currentWidget ()); |
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:
14812
diff
changeset
|
607 } |
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:
14812
diff
changeset
|
608 |
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:
14812
diff
changeset
|
609 void |
16558 | 610 file_editor::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:
14812
diff
changeset
|
611 { |
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
|
612 emit fetab_remove_all_breakpoints (_tab_widget->currentWidget ()); |
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:
14812
diff
changeset
|
613 } |
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:
14812
diff
changeset
|
614 |
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:
14812
diff
changeset
|
615 void |
16558 | 616 file_editor::request_comment_selected_text (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
617 { |
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
|
618 emit fetab_comment_selected_text (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
619 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
620 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
621 void |
16558 | 622 file_editor::request_uncomment_selected_text (void) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
623 { |
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
|
624 emit fetab_uncomment_selected_text (_tab_widget->currentWidget ()); |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
625 } |
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
626 |
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
627 void |
16558 | 628 file_editor::request_find (void) |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
629 { |
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
|
630 emit fetab_find (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
631 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
632 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
633 void |
16558 | 634 file_editor::request_goto_line (void) |
16375
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
635 { |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
636 emit fetab_goto_line (_tab_widget->currentWidget ()); |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
637 } |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
638 |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
639 |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
640 void |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
641 file_editor::handle_mru_add_file (const QString& file_name) |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
642 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
643 _mru_files.removeAll (file_name); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
644 _mru_files.prepend (file_name); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
645 mru_menu_update (); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
646 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
647 |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
648 void |
16558 | 649 file_editor::mru_menu_update (void) |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
650 { |
16558 | 651 int num_files = qMin (_mru_files.size (), int (MaxMRUFiles)); |
652 | |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
653 // configure and show active actions of mru-menu |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
654 for (int i = 0; i < num_files; ++i) |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
655 { |
16558 | 656 QString text = tr ("&%1 %2"). |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
657 arg ((i+1) % int (MaxMRUFiles)).arg (_mru_files.at (i)); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
658 _mru_file_actions[i]->setText (text); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
659 _mru_file_actions[i]->setData (_mru_files.at (i)); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
660 _mru_file_actions[i]->setVisible (true); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
661 } |
16558 | 662 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
663 // hide unused mru-menu entries |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
664 for (int j = num_files; j < MaxMRUFiles; ++j) |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
665 _mru_file_actions[j]->setVisible (false); |
16558 | 666 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
667 // delete entries in string-list beyond MaxMRUFiles |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
668 while (_mru_files.size () > MaxMRUFiles) |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
669 _mru_files.removeLast (); |
16558 | 670 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
671 // save actual mru-list in settings |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
672 QSettings *settings = resource_manager::get_settings (); |
16558 | 673 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
674 // FIXME -- what should happen if settings is 0? |
16558 | 675 settings->setValue ("editor/mru_file_list", _mru_files); |
16175
6f83158c714c
gui: make sure settings are really written into the settings file
Torsten <ttl@justmail.de>
parents:
16057
diff
changeset
|
676 settings->sync (); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
677 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
678 |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
679 void |
16307
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
680 file_editor::handle_file_name_changed (const QString& fname, |
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
681 const QString& tip) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
682 { |
16558 | 683 QObject *fileEditorTab = sender (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
684 if (fileEditorTab) |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
685 { |
16558 | 686 for (int i = 0; i < _tab_widget->count (); i++) |
14602
c8453a013000
Cleaned up code. Fixed bug that causes the GUI to freeze when launching another editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14599
diff
changeset
|
687 { |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
688 if (_tab_widget->widget (i) == fileEditorTab) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
689 { |
16307
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
690 _tab_widget->setTabText (i, fname); |
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
691 _tab_widget->setTabToolTip (i, tip); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
692 } |
14602
c8453a013000
Cleaned up code. Fixed bug that causes the GUI to freeze when launching another editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14599
diff
changeset
|
693 } |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
694 } |
13501 | 695 } |
696 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
697 void |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
698 file_editor::request_close_file (bool) |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
699 { |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
700 emit fetab_close_request (_tab_widget->currentWidget ()); |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
701 } |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
702 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
703 void |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
704 file_editor::request_close_all_files (bool) |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
705 { |
16637
b3f4bdd7e5f4
fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents:
16635
diff
changeset
|
706 // loop over all tabs starting from last one otherwise deletion changes index |
b3f4bdd7e5f4
fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents:
16635
diff
changeset
|
707 for (int index = _tab_widget->count ()-1; index >= 0; index--) |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
708 emit fetab_close_request (_tab_widget->widget (index)); |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
709 } |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
710 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
711 void |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
712 file_editor::request_close_other_files (bool) |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
713 { |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
714 QWidget *tabID = _tab_widget->currentWidget (); |
16637
b3f4bdd7e5f4
fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents:
16635
diff
changeset
|
715 // loop over all tabs starting from last one otherwise deletion changes index |
b3f4bdd7e5f4
fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents:
16635
diff
changeset
|
716 for (int index = _tab_widget->count ()-1; index >= 0; index--) |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
717 { |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
718 if (tabID != _tab_widget->widget (index)) |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
719 emit fetab_close_request (_tab_widget->widget (index)); |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
720 } |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
721 } |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
722 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
723 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
724 void |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
725 file_editor::handle_tab_close_request (int index) |
13529 | 726 { |
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
|
727 // Signal to the tabs a request to close whomever matches the identifying |
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
|
728 // tag (i.e., unique widget pointer). The reason for this indirection is |
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
|
729 // that it will enable a file editor widget to toss up a non-static |
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
|
730 // dialog box and later signal that it wants to be removed. |
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
|
731 QWidget *tabID = _tab_widget->widget (index); |
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
|
732 emit fetab_close_request (tabID); |
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
|
733 } |
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
|
734 |
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
|
735 void |
16558 | 736 file_editor::handle_tab_remove_request (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
|
737 { |
16558 | 738 QObject *fileEditorTab = sender (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
739 if (fileEditorTab) |
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
|
740 { |
16558 | 741 for (int i = 0; i < _tab_widget->count (); i++) |
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
|
742 { |
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
|
743 if (_tab_widget->widget (i) == fileEditorTab) |
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
|
744 { |
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
|
745 _tab_widget->removeTab (i); |
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
|
746 delete fileEditorTab; |
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
|
747 } |
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
|
748 } |
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
|
749 } |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
750 check_actions (); |
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
|
751 } |
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
|
752 |
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
|
753 void |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
754 file_editor::handle_add_filename_to_list (const QString& fileName, 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
|
755 { |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
756 // Should we allow multiple tabs for a single file? |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
757 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
758 editor_tab_map[fileName] = ID; |
13501 | 759 } |
760 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
761 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
|
762 file_editor::active_tab_changed (int index) |
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
|
763 { |
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
|
764 emit fetab_change_request (_tab_widget->widget (index)); |
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
|
765 } |
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
|
766 |
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
|
767 void |
16558 | 768 file_editor::handle_editor_state_changed (bool copy_available, |
769 const QString& file_name) | |
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:
14681
diff
changeset
|
770 { |
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
|
771 // In case there is some scenario where traffic could be coming from |
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
|
772 // all the file editor tabs, just process info from the current active tab. |
16558 | 773 if (sender () == _tab_widget->currentWidget ()) |
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
|
774 { |
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
|
775 _copy_action->setEnabled (copy_available); |
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
|
776 _cut_action->setEnabled (copy_available); |
17636
230ffaf80ac9
fix enabling copy, cut and run selection actions depending on selected text
Torsten <ttl@justmail.de>
parents:
17635
diff
changeset
|
777 _context_run_action->setEnabled (copy_available); |
16558 | 778 |
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
|
779 if (!file_name.isEmpty ()) |
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
|
780 { |
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
|
781 ced = QDir::cleanPath (file_name); |
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
|
782 int lastslash = ced.lastIndexOf ('/'); |
16558 | 783 |
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
|
784 // Test against > 0 because if somehow the directory is "/" the |
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
|
785 // slash should be retained. Otherwise, last slash is removed. |
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
|
786 if (lastslash > 0 && lastslash != ced.count ()) |
16558 | 787 ced = ced.left (lastslash); |
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
|
788 } |
16558 | 789 |
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
|
790 setFocusProxy (_tab_widget->currentWidget ()); |
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
|
791 } |
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
|
792 } |
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
|
793 |
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
|
794 void |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16407
diff
changeset
|
795 file_editor::notice_settings (const QSettings *settings) |
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
|
796 { |
16558 | 797 int icon_size = settings->value ("toolbar_icon_size", 24).toInt (); |
798 _tool_bar->setIconSize (QSize (icon_size, icon_size)); | |
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
|
799 // Relay signal to file editor tabs. |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16407
diff
changeset
|
800 emit fetab_settings_changed (settings); |
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:
14681
diff
changeset
|
801 } |
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:
14681
diff
changeset
|
802 |
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:
14681
diff
changeset
|
803 void |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
804 file_editor::request_preferences (bool) |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
805 { |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
806 emit request_settings_dialog ("editor"); |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
807 } |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
808 |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
809 void |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
810 file_editor::request_styles_preferences (bool) |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
811 { |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
812 emit request_settings_dialog ("editor_styles"); |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
813 } |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
814 |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
815 void |
16558 | 816 file_editor::construct (void) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
817 { |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
818 QWidget *editor_widget = new QWidget (this); |
15894
9cd14e53e906
eliminate some compiler warnings for GUI code
John W. Eaton <jwe@octave.org>
parents:
15873
diff
changeset
|
819 |
9cd14e53e906
eliminate some compiler warnings for GUI code
John W. Eaton <jwe@octave.org>
parents:
15873
diff
changeset
|
820 // FIXME -- what was the intended purpose of this unused variable? |
9cd14e53e906
eliminate some compiler warnings for GUI code
John W. Eaton <jwe@octave.org>
parents:
15873
diff
changeset
|
821 // QStyle *editor_style = QApplication::style (); |
13566
d22b9973120f
Renamed language files to match convention.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13562
diff
changeset
|
822 |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
823 _menu_bar = new QMenuBar (editor_widget); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
824 _tool_bar = new QToolBar (editor_widget); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
825 _tab_widget = new QTabWidget (editor_widget); |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
826 _tab_widget->setTabsClosable (true); |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
827 |
16558 | 828 QAction *new_action = new QAction (QIcon (":/actions/icons/filenew.png"), |
829 tr ("&New File"), _tool_bar); | |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
830 |
16558 | 831 QAction *open_action = new QAction (QIcon (":/actions/icons/fileopen.png"), |
832 tr ("&Open File"), _tool_bar); | |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
833 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
834 _save_action = new QAction (QIcon (":/actions/icons/filesave.png"), |
16558 | 835 tr ("&Save File"), _tool_bar); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
836 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
837 _save_as_action = new QAction (QIcon (":/actions/icons/filesaveas.png"), |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
838 tr ("Save File &As"), _tool_bar); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
839 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
840 _print_action = new QAction ( QIcon (":/actions/icons/fileprint.png"), |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
841 tr ("Print"), _tool_bar); |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
842 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
843 _undo_action = new QAction (QIcon (":/actions/icons/undo.png"), |
16558 | 844 tr ("&Undo"), _tool_bar); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
845 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
846 _redo_action = new QAction (QIcon (":/actions/icons/redo.png"), |
16558 | 847 tr ("&Redo"), _tool_bar); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
848 |
16558 | 849 _copy_action = new QAction (QIcon (":/actions/icons/editcopy.png"), |
15045
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
850 tr ("&Copy"), _tool_bar); |
17636
230ffaf80ac9
fix enabling copy, cut and run selection actions depending on selected text
Torsten <ttl@justmail.de>
parents:
17635
diff
changeset
|
851 _copy_action->setEnabled (false); |
15045
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
852 |
16558 | 853 _cut_action = new QAction (QIcon (":/actions/icons/editcut.png"), |
15045
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
854 tr ("Cu&t"), _tool_bar); |
17636
230ffaf80ac9
fix enabling copy, cut and run selection actions depending on selected text
Torsten <ttl@justmail.de>
parents:
17635
diff
changeset
|
855 _cut_action->setEnabled (false); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
856 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
857 _paste_action |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
858 = new QAction (QIcon (":/actions/icons/editpaste.png"), |
16558 | 859 tr ("Paste"), _tool_bar); |
860 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
861 _next_bookmark_action = new QAction (tr ("&Next Bookmark"), _tool_bar); |
16558 | 862 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
863 _previous_bookmark_action = new QAction (tr ("Pre&vious Bookmark"), _tool_bar); |
16558 | 864 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
865 _toggle_bookmark_action = new QAction (tr ("Toggle &Bookmark"), _tool_bar); |
16558 | 866 |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
867 _remove_bookmark_action |
16558 | 868 = new QAction (tr ("&Remove All Bookmarks"), _tool_bar); |
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:
14812
diff
changeset
|
869 |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
870 QAction *next_breakpoint_action |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
871 = new QAction (QIcon (":/actions/icons/bp_next.png"), |
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
872 tr ("&Next breakpoint"), _tool_bar); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
873 QAction *previous_breakpoint_action |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
874 = new QAction (QIcon (":/actions/icons/bp_prev.png"), |
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
875 tr ("Pre&vious breakpoint"), _tool_bar); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
876 QAction *toggle_breakpoint_action |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
877 = new QAction (QIcon (":/actions/icons/bp_toggle.png"), |
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
878 tr ("Toggle &breakpoint"), _tool_bar); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
879 QAction *remove_all_breakpoints_action |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
880 = new QAction (QIcon (":/actions/icons/bp_rm_all.png"), |
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
881 tr ("&Remove All breakpoints"), _tool_bar); |
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:
14812
diff
changeset
|
882 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
883 _comment_selection_action |
16737
e81084a745a9
GUI: change (un)comment handling of selection, allow (un)comment of current line
Thorsten Liebig <thorsten.liebig@gmx.de>
parents:
16731
diff
changeset
|
884 = new QAction (tr ("&Comment"), _tool_bar); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
885 _uncomment_selection_action |
16737
e81084a745a9
GUI: change (un)comment handling of selection, allow (un)comment of current line
Thorsten Liebig <thorsten.liebig@gmx.de>
parents:
16731
diff
changeset
|
886 = new QAction (tr ("&Uncomment"), _tool_bar); |
16558 | 887 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
888 _find_action = new QAction (QIcon (":/actions/icons/search.png"), |
15105
f4ea22ef2beb
Incorporated patch that adds replace from Torsten and modified it.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15080
diff
changeset
|
889 tr ("&Find and Replace"), _tool_bar); |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
890 |
16558 | 891 _run_action = new QAction (QIcon (":/actions/icons/artsbuilderexecute.png"), |
892 tr ("Save File And Run"), _tool_bar); | |
13501 | 893 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
894 _goto_line_action = new QAction (tr ("Go&to Line"), _tool_bar); |
16375
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
895 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
896 // the mru-list and an empty array of actions |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
897 QSettings *settings = resource_manager::get_settings (); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
898 // FIXME -- what should happen if settings is 0? |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
899 _mru_files = settings->value ("editor/mru_file_list").toStringList (); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
900 for (int i = 0; i < MaxMRUFiles; ++i) |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
901 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
902 _mru_file_actions[i] = new QAction (this); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
903 _mru_file_actions[i]->setVisible (false); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
904 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
905 |
13584 | 906 // some actions are disabled from the beginning |
16558 | 907 _copy_action->setEnabled (false); |
908 _cut_action->setEnabled (false); | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
909 |
16558 | 910 _run_action->setShortcutContext (Qt::WindowShortcut); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
911 _save_action->setShortcutContext (Qt::WindowShortcut); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
912 _save_as_action->setShortcutContext (Qt::WindowShortcut); |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
913 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
914 _print_action->setShortcutContext (Qt::WindowShortcut); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
915 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
916 _next_bookmark_action->setShortcutContext (Qt::WindowShortcut); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
917 _previous_bookmark_action->setShortcutContext (Qt::WindowShortcut); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
918 _toggle_bookmark_action->setShortcutContext (Qt::WindowShortcut); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
919 _comment_selection_action->setShortcutContext (Qt::WindowShortcut); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
920 _uncomment_selection_action->setShortcutContext (Qt::WindowShortcut); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
921 _find_action->setShortcutContext (Qt::WindowShortcut); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
922 _goto_line_action->setShortcutContext (Qt::WindowShortcut); |
13556
0d18b0e168ae
editor: shortcuts for toolbar actions, window icon
ttl <ttl@justmail.de>
parents:
13555
diff
changeset
|
923 |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
924 // toolbar |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
925 _tool_bar->addAction (new_action); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
926 _tool_bar->addAction (open_action); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
927 _tool_bar->addAction (_save_action); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
928 _tool_bar->addAction (_save_as_action); |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
929 _tool_bar->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
930 _tool_bar->addAction (_print_action); |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
931 _tool_bar->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
932 _tool_bar->addAction (_undo_action); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
933 _tool_bar->addAction (_redo_action); |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
934 _tool_bar->addAction (_copy_action); |
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
935 _tool_bar->addAction (_cut_action); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
936 _tool_bar->addAction (_paste_action); |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
937 _tool_bar->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
938 _tool_bar->addAction (_find_action); |
14830
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
939 _tool_bar->addAction (_run_action); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
940 _tool_bar->addSeparator (); |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
941 _tool_bar->addAction (toggle_breakpoint_action); |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
942 _tool_bar->addAction (next_breakpoint_action); |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
943 _tool_bar->addAction (previous_breakpoint_action); |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
944 _tool_bar->addAction (remove_all_breakpoints_action); |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
945 |
14669
7605e7136b50
Discarded initFileEditor, instead put that in the constructor. Speedup for updating the symbol table by lowering complexity from n² to n. Fixed problem with hangup on quit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14602
diff
changeset
|
946 // menu bar |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
947 QMenu *fileMenu = new QMenu (tr ("&File"), _menu_bar); |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
948 |
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
|
949 _mru_file_menu = new QMenu (tr ("&Recent Editor Files"), fileMenu); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
950 for (int i = 0; i < MaxMRUFiles; ++i) |
16558 | 951 _mru_file_menu->addAction (_mru_file_actions[i]); |
952 | |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
953 fileMenu->addAction (new_action); |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
954 fileMenu->addAction (open_action); |
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
|
955 fileMenu->addMenu (_mru_file_menu); |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
956 fileMenu->addSeparator (); |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
957 _context_edit_action = |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
958 fileMenu->addAction (QIcon (), tr ("&Edit Function"), |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
959 this, SLOT (request_context_edit (bool))); |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
960 fileMenu->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
961 fileMenu->addAction (_save_action); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
962 fileMenu->addAction (_save_as_action); |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
963 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
964 fileMenu->addSeparator (); |
16981
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
965 _close_action = |
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
966 fileMenu->addAction (QIcon::fromTheme("window-close", |
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
967 QIcon (":/actions/icons/fileclose.png")), |
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
968 tr ("&Close"), this, SLOT (request_close_file (bool))); |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
969 _close_all_action = |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
970 fileMenu->addAction (QIcon::fromTheme("window-close", |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
971 QIcon (":/actions/icons/fileclose.png")), |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
972 tr ("Close All"), |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
973 this, SLOT (request_close_all_files (bool))); |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
974 _close_others_action = |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
975 fileMenu->addAction (QIcon::fromTheme("window-close", |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
976 QIcon (":/actions/icons/fileclose.png")), |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
977 tr ("Close Other Files"), |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
978 this, SLOT (request_close_other_files (bool))); |
13501 | 979 |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
980 fileMenu->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
981 fileMenu->addAction (_print_action); |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
982 |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
983 _menu_bar->addMenu (fileMenu); |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
984 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
985 |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
986 QMenu *editMenu = new QMenu (tr ("&Edit"), _menu_bar); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
987 editMenu->addAction (_undo_action); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
988 editMenu->addAction (_redo_action); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
989 editMenu->addSeparator (); |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
990 editMenu->addAction (_copy_action); |
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
991 editMenu->addAction (_cut_action); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
992 editMenu->addAction (_paste_action); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
993 editMenu->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
994 editMenu->addAction (_find_action); |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
995 editMenu->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
996 editMenu->addAction (_comment_selection_action); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
997 editMenu->addAction (_uncomment_selection_action); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
998 editMenu->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
999 editMenu->addAction (_toggle_bookmark_action); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1000 editMenu->addAction (_next_bookmark_action); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1001 editMenu->addAction (_previous_bookmark_action); |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1002 editMenu->addAction (_remove_bookmark_action); |
16375
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
1003 editMenu->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1004 editMenu->addAction (_goto_line_action); |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1005 editMenu->addSeparator (); |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1006 _preferences_action = |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1007 editMenu->addAction (QIcon (":/actions/icons/configure.png"), |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1008 tr ("&Preferences"), this, SLOT (request_preferences (bool))); |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1009 _styles_preferences_action = |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1010 editMenu->addAction (QIcon (":/actions/icons/configure.png"), |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1011 tr ("&Styles Preferences"), this, SLOT (request_styles_preferences (bool))); |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
1012 _menu_bar->addMenu (editMenu); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1013 |
14778
f43916137064
Added debug menu to file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
1014 _debug_menu = new QMenu (tr ("&Debug"), _menu_bar); |
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:
14812
diff
changeset
|
1015 _debug_menu->addAction (toggle_breakpoint_action); |
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:
14812
diff
changeset
|
1016 _debug_menu->addAction (next_breakpoint_action); |
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:
14812
diff
changeset
|
1017 _debug_menu->addAction (previous_breakpoint_action); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
1018 _debug_menu->addAction (remove_all_breakpoints_action); |
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:
14812
diff
changeset
|
1019 _debug_menu->addSeparator (); |
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:
14812
diff
changeset
|
1020 // The other debug actions will be added by the main window. |
14778
f43916137064
Added debug menu to file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
1021 _menu_bar->addMenu (_debug_menu); |
f43916137064
Added debug menu to file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
1022 |
14830
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
1023 QMenu *_run_menu = new QMenu (tr ("&Run"), _menu_bar); |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
1024 _run_menu->addAction (_run_action); |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
1025 _context_run_action = |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
1026 _run_menu->addAction (QIcon (), tr ("Run &Selection"), |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
1027 this, SLOT (request_context_run (bool))); |
17636
230ffaf80ac9
fix enabling copy, cut and run selection actions depending on selected text
Torsten <ttl@justmail.de>
parents:
17635
diff
changeset
|
1028 _context_run_action->setEnabled (false); |
14830
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
1029 _menu_bar->addMenu (_run_menu); |
13566
d22b9973120f
Renamed language files to match convention.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13562
diff
changeset
|
1030 |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1031 QMenu *_help_menu = new QMenu (tr ("&Help"), _menu_bar); |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1032 _context_help_action = |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1033 _help_menu->addAction (QIcon (), tr ("&Help on Keyword"), |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1034 this, SLOT (request_context_help (bool))); |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1035 _context_doc_action = |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1036 _help_menu->addAction (QIcon (), tr ("&Documentation on Keyword"), |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1037 this, SLOT (request_context_doc (bool))); |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1038 _menu_bar->addMenu (_help_menu); |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1039 |
16981
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
1040 // shortcuts |
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
1041 set_shortcuts (true); |
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
1042 |
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
1043 // layout |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1044 QVBoxLayout *vbox_layout = new QVBoxLayout (); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1045 vbox_layout->addWidget (_menu_bar); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1046 vbox_layout->addWidget (_tool_bar); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1047 vbox_layout->addWidget (_tab_widget); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1048 vbox_layout->setMargin (0); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1049 editor_widget->setLayout (vbox_layout); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1050 setWidget (editor_widget); |
13501 | 1051 |
16981
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
1052 // signals |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1053 connect (this, SIGNAL (request_settings_dialog (const QString&)), |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1054 main_win (), SLOT (process_settings_dialog_request (const QString&))); |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1055 |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
16740
diff
changeset
|
1056 connect (main_win (), SIGNAL (new_file_signal (const QString&)), |
16457
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
1057 this, SLOT (request_new_file (const QString&))); |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
1058 |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
16740
diff
changeset
|
1059 connect (main_win (), SIGNAL (open_file_signal (const QString&)), |
16457
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
1060 this, SLOT (request_open_file (const QString&))); |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
1061 |
16558 | 1062 connect (new_action, SIGNAL (triggered ()), |
1063 this, SLOT (request_new_file ())); | |
1064 | |
1065 connect (open_action, SIGNAL (triggered ()), | |
1066 this, SLOT (request_open_file ())); | |
1067 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1068 connect (_undo_action, SIGNAL (triggered ()), |
16558 | 1069 this, SLOT (request_undo ())); |
1070 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1071 connect (_redo_action, SIGNAL (triggered ()), |
16558 | 1072 this, SLOT (request_redo ())); |
1073 | |
1074 connect (_copy_action, SIGNAL (triggered ()), | |
1075 this, SLOT (request_copy ())); | |
1076 | |
1077 connect (_cut_action, SIGNAL (triggered ()), | |
1078 this, SLOT (request_cut ())); | |
1079 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1080 connect (_paste_action, SIGNAL (triggered ()), |
16558 | 1081 this, SLOT (request_paste ())); |
1082 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1083 connect (_save_action, SIGNAL (triggered ()), |
16558 | 1084 this, SLOT (request_save_file ())); |
1085 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1086 connect (_save_as_action, SIGNAL (triggered ()), |
16558 | 1087 this, SLOT (request_save_file_as ())); |
1088 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1089 connect (_print_action, SIGNAL (triggered ()), |
16558 | 1090 this, SLOT (request_print_file ())); |
1091 | |
1092 connect (_run_action, SIGNAL (triggered ()), | |
1093 this, SLOT (request_run_file ())); | |
16375
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
1094 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1095 connect (_toggle_bookmark_action, SIGNAL (triggered ()), |
16558 | 1096 this, SLOT (request_toggle_bookmark ())); |
1097 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1098 connect (_next_bookmark_action, SIGNAL (triggered ()), |
16558 | 1099 this, SLOT (request_next_bookmark ())); |
1100 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1101 connect (_previous_bookmark_action, SIGNAL (triggered ()), |
16558 | 1102 this, SLOT (request_previous_bookmark ())); |
1103 | |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1104 connect (_remove_bookmark_action, SIGNAL (triggered ()), |
16558 | 1105 this, SLOT (request_remove_bookmark ())); |
1106 | |
1107 connect (toggle_breakpoint_action, SIGNAL (triggered ()), | |
1108 this, SLOT (request_toggle_breakpoint ())); | |
1109 | |
1110 connect (next_breakpoint_action, SIGNAL (triggered ()), | |
1111 this, SLOT (request_next_breakpoint ())); | |
1112 | |
1113 connect (previous_breakpoint_action, SIGNAL (triggered ()), | |
1114 this, SLOT (request_previous_breakpoint ())); | |
1115 | |
1116 connect (remove_all_breakpoints_action, SIGNAL (triggered ()), | |
1117 this, SLOT (request_remove_breakpoint ())); | |
1118 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1119 connect (_comment_selection_action, SIGNAL (triggered ()), |
16558 | 1120 this, SLOT (request_comment_selected_text ())); |
1121 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1122 connect (_uncomment_selection_action, SIGNAL (triggered ()), |
16558 | 1123 this, SLOT (request_uncomment_selected_text ())); |
1124 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1125 connect (_find_action, SIGNAL (triggered ()), |
16558 | 1126 this, SLOT (request_find ())); |
1127 | |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1128 connect (_goto_line_action, SIGNAL (triggered ()), |
16558 | 1129 this, SLOT (request_goto_line ())); |
1130 | |
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
|
1131 connect (_mru_file_menu, SIGNAL (triggered (QAction *)), |
49653ed9561b
Use menu triggered signal instead of action triggered signal to rid cast.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16611
diff
changeset
|
1132 this, SLOT (request_mru_open_file (QAction *))); |
16558 | 1133 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1134 mru_menu_update (); |
16558 | 1135 |
1136 connect (_tab_widget, SIGNAL (tabCloseRequested (int)), | |
1137 this, SLOT (handle_tab_close_request (int))); | |
1138 | |
1139 connect (_tab_widget, SIGNAL (currentChanged (int)), | |
1140 this, SLOT (active_tab_changed (int))); | |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1141 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1142 resize (500, 400); |
16558 | 1143 setWindowIcon (QIcon (":/actions/icons/logo.png")); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
16740
diff
changeset
|
1144 set_title ("Editor"); |
15356
842ab161c10a
GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents:
15321
diff
changeset
|
1145 |
842ab161c10a
GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents:
15321
diff
changeset
|
1146 //restore previous session |
16558 | 1147 if (settings->value ("editor/restoreSession", true).toBool ()) |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
1148 { |
16558 | 1149 QStringList sessionFileNames |
1150 = settings->value ("editor/savedSessionTabs", QStringList ()).toStringList (); | |
15356
842ab161c10a
GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents:
15321
diff
changeset
|
1151 |
16558 | 1152 for (int n = 0; n < sessionFileNames.count (); ++n) |
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
|
1153 request_open_file (sessionFileNames.at (n)); |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
1154 } |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1155 |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1156 check_actions (); |
13501 | 1157 } |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1158 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1159 void |
16558 | 1160 file_editor::add_file_editor_tab (file_editor_tab *f, const QString& fn) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1161 { |
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
|
1162 _tab_widget->addTab (f, fn); |
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
|
1163 |
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
|
1164 // Signals from the file editor_tab |
15984
1eb3c67139f6
Add full-length-name tool tip to editor file tab when name is not full length.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15982
diff
changeset
|
1165 connect (f, SIGNAL (file_name_changed (const QString&, const QString&)), |
16558 | 1166 this, SLOT (handle_file_name_changed (const QString&, |
1167 const QString&))); | |
1168 | |
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
|
1169 connect (f, SIGNAL (editor_state_changed (bool, const QString&)), |
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
|
1170 this, SLOT (handle_editor_state_changed (bool, const QString&))); |
16558 | 1171 |
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
|
1172 connect (f, SIGNAL (tab_remove_request ()), |
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
|
1173 this, SLOT (handle_tab_remove_request ())); |
16558 | 1174 |
1175 connect (f, SIGNAL (add_filename_to_list (const QString&, QWidget*)), | |
1176 this, SLOT (handle_add_filename_to_list (const QString&, QWidget*))); | |
1177 | |
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
|
1178 connect (f, SIGNAL (editor_check_conflict_save (const QString&, bool)), |
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
|
1179 this, SLOT (check_conflict_save (const QString&, bool))); |
16558 | 1180 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1181 connect (f, SIGNAL (mru_add_file (const QString&)), |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1182 this, SLOT (handle_mru_add_file (const QString&))); |
16558 | 1183 |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16615
diff
changeset
|
1184 connect (f, SIGNAL (run_file_signal (const QFileInfo&)), |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
16740
diff
changeset
|
1185 main_win (), SLOT (run_file_in_terminal (const QFileInfo&))); |
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
|
1186 |
16731
01d523d5f796
add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
16686
diff
changeset
|
1187 connect (f, SIGNAL (execute_command_in_terminal_signal (const QString&)), |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
16740
diff
changeset
|
1188 main_win (), SLOT (execute_command_in_terminal (const QString&))); |
16731
01d523d5f796
add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
16686
diff
changeset
|
1189 |
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
|
1190 // Signals from the file_editor non-trivial operations |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16407
diff
changeset
|
1191 connect (this, SIGNAL (fetab_settings_changed (const QSettings *)), |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16407
diff
changeset
|
1192 f, SLOT (notice_settings (const QSettings *))); |
16558 | 1193 |
16638
3c2e457eeb72
ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents:
16637
diff
changeset
|
1194 connect (this, SIGNAL (fetab_close_request (const QWidget*,bool)), |
3c2e457eeb72
ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents:
16637
diff
changeset
|
1195 f, SLOT (conditional_close (const QWidget*,bool))); |
16558 | 1196 |
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
|
1197 connect (this, SIGNAL (fetab_change_request (const QWidget*)), |
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
|
1198 f, SLOT (change_editor_state (const QWidget*))); |
16558 | 1199 |
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
|
1200 connect (this, SIGNAL (fetab_file_name_query (const QWidget*)), |
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
|
1201 f, SLOT (file_name_query (const QWidget*))); |
16558 | 1202 |
1203 connect (this, SIGNAL (fetab_save_file (const QWidget*, const QString&, | |
1204 bool)), | |
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
|
1205 f, SLOT (save_file (const QWidget*, const QString&, bool))); |
16558 | 1206 |
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
|
1207 // Signals from the file_editor trivial operations |
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
|
1208 connect (this, SIGNAL (fetab_undo (const QWidget*)), |
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
|
1209 f, SLOT (undo (const QWidget*))); |
16558 | 1210 |
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
|
1211 connect (this, SIGNAL (fetab_redo (const QWidget*)), |
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
|
1212 f, SLOT (redo (const QWidget*))); |
16558 | 1213 |
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
|
1214 connect (this, SIGNAL (fetab_copy (const QWidget*)), |
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
|
1215 f, SLOT (copy (const QWidget*))); |
16558 | 1216 |
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
|
1217 connect (this, SIGNAL (fetab_cut (const QWidget*)), |
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
|
1218 f, SLOT (cut (const QWidget*))); |
16558 | 1219 |
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
|
1220 connect (this, SIGNAL (fetab_paste (const QWidget*)), |
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
|
1221 f, SLOT (paste (const QWidget*))); |
16558 | 1222 |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1223 connect (this, SIGNAL (fetab_context_help (const QWidget*, bool)), |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1224 f, SLOT (context_help (const QWidget*, bool))); |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1225 |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
1226 connect (this, SIGNAL (fetab_context_edit (const QWidget*)), |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
1227 f, SLOT (context_edit (const QWidget*))); |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
1228 |
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
|
1229 connect (this, SIGNAL (fetab_save_file (const QWidget*)), |
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
|
1230 f, SLOT (save_file (const QWidget*))); |
16558 | 1231 |
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
|
1232 connect (this, SIGNAL (fetab_save_file_as (const QWidget*)), |
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
|
1233 f, SLOT (save_file_as (const QWidget*))); |
16558 | 1234 |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
1235 connect (this, SIGNAL (fetab_print_file (const QWidget*)), |
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
1236 f, SLOT (print_file (const QWidget*))); |
16558 | 1237 |
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
|
1238 connect (this, SIGNAL (fetab_run_file (const QWidget*)), |
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
|
1239 f, SLOT (run_file (const QWidget*))); |
16558 | 1240 |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
1241 connect (this, SIGNAL (fetab_context_run (const QWidget*)), |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
1242 f, SLOT (context_run (const QWidget*))); |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
1243 |
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
|
1244 connect (this, SIGNAL (fetab_toggle_bookmark (const QWidget*)), |
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
|
1245 f, SLOT (toggle_bookmark (const QWidget*))); |
16558 | 1246 |
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
|
1247 connect (this, SIGNAL (fetab_next_bookmark (const QWidget*)), |
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
|
1248 f, SLOT (next_bookmark (const QWidget*))); |
16558 | 1249 |
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
|
1250 connect (this, SIGNAL (fetab_previous_bookmark (const QWidget*)), |
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
|
1251 f, SLOT (previous_bookmark (const QWidget*))); |
16558 | 1252 |
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
|
1253 connect (this, SIGNAL (fetab_remove_bookmark (const QWidget*)), |
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
|
1254 f, SLOT (remove_bookmark (const QWidget*))); |
16558 | 1255 |
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
|
1256 connect (this, SIGNAL (fetab_toggle_breakpoint (const QWidget*)), |
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
|
1257 f, SLOT (toggle_breakpoint (const QWidget*))); |
16558 | 1258 |
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
|
1259 connect (this, SIGNAL (fetab_next_breakpoint (const QWidget*)), |
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
|
1260 f, SLOT (next_breakpoint (const QWidget*))); |
16558 | 1261 |
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
|
1262 connect (this, SIGNAL (fetab_previous_breakpoint (const QWidget*)), |
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
|
1263 f, SLOT (previous_breakpoint (const QWidget*))); |
16558 | 1264 |
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
|
1265 connect (this, SIGNAL (fetab_remove_all_breakpoints (const QWidget*)), |
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
|
1266 f, SLOT (remove_all_breakpoints (const QWidget*))); |
16558 | 1267 |
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
|
1268 connect (this, SIGNAL (fetab_comment_selected_text (const QWidget*)), |
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
|
1269 f, SLOT (comment_selected_text (const QWidget*))); |
16558 | 1270 |
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
|
1271 connect (this, SIGNAL (fetab_uncomment_selected_text (const QWidget*)), |
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
|
1272 f, SLOT (uncomment_selected_text (const QWidget*))); |
16558 | 1273 |
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
|
1274 connect (this, SIGNAL (fetab_find (const QWidget*)), |
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
|
1275 f, SLOT (find (const QWidget*))); |
16558 | 1276 |
1277 connect (this, SIGNAL (fetab_goto_line (const QWidget*, int)), | |
1278 f, SLOT (goto_line (const QWidget*, int))); | |
1279 | |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
1280 connect (this, SIGNAL (fetab_set_focus (const QWidget*)), |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
1281 f, SLOT (set_focus (const QWidget*))); |
16558 | 1282 |
1283 connect (this, SIGNAL (fetab_insert_debugger_pointer (const QWidget*, int)), | |
1284 f, SLOT (insert_debugger_pointer (const QWidget*, int))); | |
1285 | |
1286 connect (this, SIGNAL (fetab_delete_debugger_pointer (const QWidget*, int)), | |
1287 f, SLOT (delete_debugger_pointer (const QWidget*, int))); | |
1288 | |
1289 connect (this, SIGNAL (fetab_do_breakpoint_marker (bool, const QWidget*, | |
1290 int)), | |
1291 f, SLOT (do_breakpoint_marker (bool, const QWidget*, int))); | |
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
|
1292 |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
1293 _tab_widget->setCurrentWidget (f); |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1294 |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1295 check_actions (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1296 } |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15861
diff
changeset
|
1297 |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1298 void |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1299 file_editor::copyClipboard () |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1300 { |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1301 QWidget * foc_w = focusWidget (); |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1302 |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1303 if(foc_w && foc_w->inherits ("octave_qscintilla")) |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1304 { |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1305 request_copy (); |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1306 } |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1307 } |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1308 void |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1309 file_editor::pasteClipboard () |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1310 { |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1311 QWidget * foc_w = focusWidget (); |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1312 |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1313 if(foc_w && foc_w->inherits ("octave_qscintilla")) |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1314 { |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1315 request_paste (); |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1316 } |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1317 } |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1318 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1319 void |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1320 file_editor::set_shortcuts (bool set) |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1321 { |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1322 if (set) |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1323 { |
17637 | 1324 _comment_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_R); |
17639
e693b2622f72
fix ambigous editor shortcut for uncommenting
Torsten <ttl@justmail.de>
parents:
17637
diff
changeset
|
1325 _uncomment_selection_action->setShortcut (Qt::SHIFT + Qt::ControlModifier + Qt::Key_R); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1326 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1327 _copy_action->setShortcut (QKeySequence::Copy); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1328 _cut_action->setShortcut (QKeySequence::Cut); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1329 _paste_action->setShortcut (QKeySequence::Paste); |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1330 _context_help_action->setShortcut (QKeySequence::HelpContents); |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1331 _context_doc_action->setShortcut (Qt::SHIFT + Qt::Key_F1); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1332 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1333 _find_action->setShortcut (QKeySequence::Find); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1334 _goto_line_action->setShortcut (Qt::ControlModifier+ Qt::Key_G); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1335 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1336 _next_bookmark_action->setShortcut (Qt::Key_F2); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1337 _previous_bookmark_action->setShortcut (Qt::SHIFT + Qt::Key_F2); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1338 _toggle_bookmark_action->setShortcut (Qt::Key_F7); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1339 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1340 _print_action->setShortcut (QKeySequence::Print); |
17637 | 1341 _run_action->setShortcut (Qt::Key_F5); |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
1342 _context_run_action->setShortcut (Qt::Key_F9); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1343 |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
1344 _context_edit_action->setShortcut (Qt::ControlModifier + Qt::Key_E); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1345 _save_action->setShortcut (QKeySequence::Save); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1346 _save_as_action->setShortcut (QKeySequence::SaveAs); |
16981
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
1347 _close_action->setShortcut (QKeySequence::Close); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1348 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1349 _redo_action->setShortcut (QKeySequence::Redo); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1350 _undo_action->setShortcut (QKeySequence::Undo); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1351 } |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1352 else |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1353 { |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1354 QKeySequence no_key = QKeySequence (); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1355 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1356 _comment_selection_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1357 _uncomment_selection_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1358 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1359 _copy_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1360 _cut_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1361 _paste_action->setShortcut (no_key); |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1362 _context_help_action->setShortcut (no_key); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1363 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1364 _find_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1365 _goto_line_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1366 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1367 _next_bookmark_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1368 _previous_bookmark_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1369 _toggle_bookmark_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1370 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1371 _print_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1372 _run_action->setShortcut (no_key); |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
1373 _context_run_action->setShortcut (no_key); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1374 |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
1375 _context_edit_action->setShortcut (no_key); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1376 _save_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1377 _save_as_action->setShortcut (no_key); |
16981
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
1378 _close_action->setShortcut (no_key); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1379 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1380 _redo_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1381 _undo_action->setShortcut (no_key); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1382 } |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1383 } |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1384 |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1385 void |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1386 file_editor::check_actions () |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1387 { |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1388 bool have_tabs = _tab_widget->count () > 0; |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1389 |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1390 _comment_selection_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1391 _uncomment_selection_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1392 |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1393 _paste_action->setEnabled (have_tabs); |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1394 _context_help_action->setEnabled (have_tabs); |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1395 _context_doc_action->setEnabled (have_tabs); |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1396 |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1397 _find_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1398 _goto_line_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1399 |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1400 _next_bookmark_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1401 _previous_bookmark_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1402 _toggle_bookmark_action->setEnabled (have_tabs); |
17636
230ffaf80ac9
fix enabling copy, cut and run selection actions depending on selected text
Torsten <ttl@justmail.de>
parents:
17635
diff
changeset
|
1403 _remove_bookmark_action->setEnabled (have_tabs); |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1404 |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1405 _print_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1406 _run_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1407 |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
1408 _context_edit_action->setEnabled (have_tabs); |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1409 _save_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1410 _save_as_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1411 _close_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1412 _close_all_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1413 _close_others_action->setEnabled (have_tabs && _tab_widget->count () > 1); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1414 |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1415 _undo_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1416 _redo_action->setEnabled (have_tabs); |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1417 } |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1418 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1419 |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15861
diff
changeset
|
1420 #endif |