Mercurial > hg > octave-nkf
annotate libgui/src/m-editor/file-editor.cc @ 19608:ed0df431631b gui-release
allow to cancel exiting if editor tabs are modified and exit is requested in gui
* file-editor-interface.h: new function check_closing
* file-editor-tab.cc (ctor): set default for app_closing to 0 (not closing);
(check_file_modified): dialog boxes for modified editor tabs depending on
app closing or not;
(conditional_close): no slot, but ordinary function returning close result;
* file-editor-tab.h: conditional_close is function, not a slot;
_app_closing is now int for closing from gui, from octave, not closing
* file-editor.cc (dtor): calling new function check_closing if there are
open tabs (exit requested octave), do not save session here since the tabs
might already have been closed;
(check_closing): new function saving session info and closing all tabs,
stop closing tabs and returning false if user cancels exiting if there is
a modified tab;
(request_close_file, request_close_all_files, request_close_other_files,
handle_tab_close_request):
use conditional_close instead of signal;
(construct): do not connect old signal for closing the tabs
* file-editor.h: remove signal fetab_close_request, new function check_closing
* main-window.cc (confirm_exit_octave): call file_editor::check_closing
before really closing the app
author | Torsten <ttl@justmail.de> |
---|---|
date | Sat, 20 Dec 2014 17:26:53 +0100 |
parents | 2b708273548d |
children | 3c038da18218 |
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 |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17740
diff
changeset
|
3 Copyright (C) 2011-2013 Jacob Dawid |
15204
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" |
18759
086093fbdc1a
first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
18710
diff
changeset
|
31 #include "shortcut-manager.h" |
086093fbdc1a
first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
18710
diff
changeset
|
32 |
13501 | 33 #include <QVBoxLayout> |
34 #include <QApplication> | |
35 #include <QFile> | |
13584 | 36 #include <QFont> |
13501 | 37 #include <QFileDialog> |
38 #include <QMessageBox> | |
39 #include <QStyle> | |
40 #include <QTextStream> | |
18467
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
41 #include <QTabBar> |
16407
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
42 #include <QProcess> |
17901
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
43 #include <QInputDialog> |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
44 #include <Qsci/qscicommandset.h> |
13501 | 45 |
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
|
46 #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
|
47 #include "utils.h" |
18613
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
48 #include "main-window.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
|
49 |
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 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
|
51 : file_editor_interface (p) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
52 { |
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
|
53 // 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
|
54 // 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
|
55 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
|
56 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
57 construct (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
58 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
59 setVisible (false); |
18806
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
60 |
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
61 setAcceptDrops(true); |
13501 | 62 } |
63 | |
16558 | 64 file_editor::~file_editor (void) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
65 { |
19608
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
66 // Close open tabs, if existing. In this case app closing must be |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
67 // initiated by octave. All tabs will be definetly closed and the |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
68 // user can not cancel exiting (close state -1) |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
69 if (_tab_widget->count ()) |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
70 check_closing (-1); |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
71 |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
72 if (_mru_file_menu) |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
73 delete _mru_file_menu; |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
74 } |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
75 |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
76 bool |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
77 file_editor::check_closing (int closing_state) |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
78 { |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
79 // Save open files for restoring in next session; this only is possible |
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
|
80 QSettings *settings = resource_manager::get_settings (); |
16558 | 81 |
16740
cfefcc2a4dae
do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents:
16739
diff
changeset
|
82 // 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
|
83 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
|
84 emit fetab_file_name_query (0); |
16558 | 85 |
16740
cfefcc2a4dae
do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents:
16739
diff
changeset
|
86 // 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
|
87 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
|
88 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
|
89 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
|
90 { |
cfefcc2a4dae
do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents:
16739
diff
changeset
|
91 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
|
92 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
|
93 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
|
94 } |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
95 |
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
|
96 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
|
97 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
|
98 |
19608
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
99 // Close all tabs. If exit is requested by the gui (octave still running) |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
100 // check whether closing a tab is successful or whether user wnats to cancel |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
101 // exiting the program. Return false in the latter case. |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
102 file_editor_tab *editor_tab; |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
103 |
16638
3c2e457eeb72
ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents:
16637
diff
changeset
|
104 for (int index = _tab_widget->count ()-1; index >= 0; index--) |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
105 { |
19608
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
106 editor_tab = static_cast <file_editor_tab *> (_tab_widget->widget (index)); |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
107 if ((! editor_tab->conditional_close (closing_state)) && closing_state == 1) |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
108 return false; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
109 } |
16638
3c2e457eeb72
ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents:
16637
diff
changeset
|
110 |
19608
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
111 // Here, we really want to exit and all tabs are closed |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
112 return true; |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
113 } |
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
114 |
19608
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
115 |
16457
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
116 void |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
117 file_editor::focus (void) |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
118 { |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
119 set_focus (); |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
120 } |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
121 |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
122 // 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
|
123 void |
16558 | 124 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
|
125 { |
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
|
126 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
|
127 setVisible (true); |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
128 setFocus (); |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
129 activateWindow (); |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
130 raise (); |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
131 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
|
132 if (fileEditorTab) |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
133 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
|
134 } |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
135 |
14795
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
136 QMenu * |
16558 | 137 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
|
138 { |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
139 return _debug_menu; |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
140 } |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
141 |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
142 QToolBar * |
16558 | 143 file_editor::toolbar (void) |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
144 { |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
145 return _tool_bar; |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
146 } |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
147 |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
148 void |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
149 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
|
150 { |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
151 _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
|
152 } |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
153 |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
154 void |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
155 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
|
156 { |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
157 _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
|
158 } |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
159 |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
160 void |
16452
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16443
diff
changeset
|
161 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
|
162 { |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
163 // Custom editor? If yes, we can only call the editor without passing |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
164 // some initial contents and even without being sure a new file is opened |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
165 if (call_custom_editor ()) |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
166 return; |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
167 |
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
|
168 // 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
|
169 // 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
|
170 // 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
|
171 |
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 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
|
173 if (fileEditorTab) |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
174 { |
15982
131d40cd805b
gui: cleanup some string constants for translations
Torsten <ttl@justmail.de>
parents:
15980
diff
changeset
|
175 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
|
176 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
|
177 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
|
178 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
179 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
180 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
181 void |
16566 | 182 file_editor::request_new_script (const QString& commands) |
183 { | |
184 request_new_file (commands); | |
185 } | |
186 | |
187 void | |
17901
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
188 file_editor::request_new_function (bool) |
16566 | 189 { |
17901
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
190 bool ok; |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
191 // get the name of the new function |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
192 QString new_name = QInputDialog::getText (this, tr ("New Function"), |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
193 tr ("New function name:\n"), QLineEdit::Normal, "", &ok); |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
194 if (ok && new_name.length () > 0) |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
195 { |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
196 // append suffix if it not already exists |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
197 if (new_name.rightRef (2) != ".m") |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
198 new_name.append (".m"); |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
199 // check whether new files are created without prompt |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
200 QSettings *settings = resource_manager::get_settings (); |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
201 if (! settings->value ("editor/create_new_file",false).toBool ()) |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
202 { |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
203 // no, so enable this settings and wait for end of new file loading |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
204 settings->setValue ("editor/create_new_file",true); |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
205 connect (this, SIGNAL (file_loaded_signal ()), |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
206 this, SLOT (restore_create_file_setting ())); |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
207 } |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
208 // start the edit command |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
209 emit execute_command_in_terminal_signal ("edit " + new_name); |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
210 } |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
211 } |
16566 | 212 |
17901
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
213 void |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
214 file_editor::restore_create_file_setting () |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
215 { |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
216 // restore the new files creation setting |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
217 QSettings *settings = resource_manager::get_settings (); |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
218 settings->setValue ("editor/create_new_file",false); |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
219 disconnect (this, SIGNAL (file_loaded_signal ()), |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
220 this, SLOT (restore_create_file_setting ())); |
16566 | 221 } |
222 | |
223 void | |
16558 | 224 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
|
225 { |
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
|
226 // 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
|
227 // 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
|
228 // 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
|
229 |
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
|
230 // Create a NonModal message. |
16558 | 231 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
|
232 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
|
233 |
6bd74153c3ae
no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
234 // 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
|
235 // 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
|
236 // 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
|
237 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
|
238 |
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
|
239 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
|
240 fileDialog->setViewMode (QFileDialog::Detail); |
18589
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18554
diff
changeset
|
241 fileDialog->setFileMode (QFileDialog::ExistingFiles); |
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
|
242 fileDialog->setDirectory (ced); |
16558 | 243 |
18589
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18554
diff
changeset
|
244 connect (fileDialog, SIGNAL (filesSelected (const QStringList&)), |
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18554
diff
changeset
|
245 this, SLOT (request_open_files (const QStringList&))); |
16558 | 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 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
|
248 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
|
249 fileDialog->show (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
250 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
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 // 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
|
253 QWidget * |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
254 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
|
255 { |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
256 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
|
257 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
258 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
|
259 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
|
260 { |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
261 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
|
262 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
263 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
|
264 { |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
265 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
|
266 break; |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
267 } |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
268 } |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
269 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
270 return retval; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
271 } |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
272 |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
273 bool |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
274 file_editor::call_custom_editor (const QString& file_name, int line) |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
275 { |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
276 // Check if the user wants to use a custom file editor. |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
277 QSettings *settings = resource_manager::get_settings (); |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
278 |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
279 if (settings->value ("useCustomFileEditor").toBool ()) |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
280 { |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
281 QString editor = settings->value ("customFileEditor").toString (); |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
282 editor.replace ("%f", file_name); |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
283 editor.replace ("%l", QString::number (line)); |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
284 |
19175
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
285 bool started_ok = QProcess::startDetached (editor); |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
286 |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
287 if (started_ok != true) |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
288 { |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
289 QMessageBox *msgBox |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
290 = new QMessageBox (QMessageBox::Critical, |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
291 tr ("Octave Editor"), |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
292 tr ("Could not start custom file editor\n%1"). |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
293 arg (editor), |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
294 QMessageBox::Ok, this); |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
295 |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
296 msgBox->setWindowModality (Qt::NonModal); |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
297 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
298 msgBox->show (); |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
19161
diff
changeset
|
299 } |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
300 |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
301 if (line < 0 && ! file_name.isEmpty ()) |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
302 handle_mru_add_file (QFileInfo (file_name).canonicalFilePath ()); |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
303 |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
304 return true; |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
305 } |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
306 |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
307 return false; |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
308 } |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
309 |
18613
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
310 bool |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
311 file_editor::is_editor_console_tabbed () |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
312 { |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
313 main_window *w = static_cast<main_window *>(main_win ()); |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
314 QList<QDockWidget *> w_list = w->tabifiedDockWidgets (this); |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
315 QDockWidget *console = |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
316 static_cast<QDockWidget *> (w->get_dock_widget_list ().at (0)); |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
317 |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
318 for (int i = 0; i < w_list.count (); i++) |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
319 { |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
320 if (w_list.at (i) == console) |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
321 return true; |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
322 } |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
323 |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
324 return false; |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
325 } |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
326 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
327 void |
18589
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18554
diff
changeset
|
328 file_editor::request_open_files (const QStringList& open_file_names) |
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18554
diff
changeset
|
329 { |
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18554
diff
changeset
|
330 for (int i = 0; i < open_file_names.count (); i++) |
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18554
diff
changeset
|
331 request_open_file (open_file_names.at (i)); |
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18554
diff
changeset
|
332 } |
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18554
diff
changeset
|
333 |
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18554
diff
changeset
|
334 void |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
335 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
|
336 bool debug_pointer, |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
337 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
|
338 { |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
339 if (call_custom_editor (openFileName, line)) |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
340 return; // custom editor called |
16407
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
341 |
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
|
342 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
|
343 { |
17941
9799a996b2c1
* file-editor.cc (request_open_file): new edit tab when file name is empty
Torsten <ttl@justmail.de>
parents:
17935
diff
changeset
|
344 // This happens if edit is calles without an argument |
9799a996b2c1
* file-editor.cc (request_open_file): new edit tab when file name is empty
Torsten <ttl@justmail.de>
parents:
17935
diff
changeset
|
345 // Open eitor with empty edit area instead (as new file would do) |
9799a996b2c1
* file-editor.cc (request_open_file): new edit tab when file name is empty
Torsten <ttl@justmail.de>
parents:
17935
diff
changeset
|
346 request_new_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
|
347 } |
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
|
348 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
|
349 { |
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
|
350 // 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
|
351 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
|
352 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
|
353 |
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
|
354 // 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
|
355 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
|
356 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
357 if (tab) |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
358 { |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
359 _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
|
360 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
361 if (line > 0) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
362 { |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
363 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
|
364 |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
365 if (debug_pointer) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
366 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
|
367 |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
368 if (breakpoint_marker) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
369 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
|
370 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
371 |
18613
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
372 if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
373 { |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
374 emit fetab_set_focus (tab); |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
375 set_focus (); |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
376 } |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
377 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
378 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
|
379 { |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
380 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
|
381 if (fileEditorTab) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
382 { |
16558 | 383 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
|
384 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
|
385 { |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
386 // 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
|
387 // 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
|
388 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
|
389 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
|
390 // 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
|
391 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
|
392 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
|
393 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
394 if (line > 0) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
395 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
396 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
|
397 |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
398 if (debug_pointer) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
399 emit fetab_insert_debugger_pointer (fileEditorTab, |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
400 line); |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
401 if (breakpoint_marker) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
402 emit fetab_do_breakpoint_marker (insert, fileEditorTab, |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
403 line); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
404 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
405 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
406 else |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
407 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
408 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
|
409 |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
410 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
|
411 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
412 // File not readable: |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
413 // create a NonModal message about error. |
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
|
414 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
|
415 = new QMessageBox (QMessageBox::Critical, |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
416 tr ("Octave Editor"), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
417 tr ("Could not open file\n%1\nfor read: %2."). |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
418 arg (openFileName).arg (result), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
419 QMessageBox::Ok, this); |
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
|
420 |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
421 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
|
422 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
|
423 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
|
424 } |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
425 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
|
426 { |
17740
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
427 // File does not exist, should it be crated? |
19518
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
428 bool create_file = true; |
17740
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
429 QMessageBox *msgBox; |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
430 QSettings *settings = resource_manager::get_settings (); |
19518
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
431 |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
432 if (!settings->value ("editor/create_new_file", false).toBool ()) |
17740
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
433 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
434 msgBox = new QMessageBox (QMessageBox::Question, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
435 tr ("Octave Editor"), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
436 tr ("File\n%1\ndoes not exist. " |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
437 "Do you want to create it?").arg (openFileName), |
19518
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
438 QMessageBox::NoButton,0); |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
439 QPushButton *create_button = |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
440 msgBox->addButton (tr ("Create"), QMessageBox::YesRole); |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
441 msgBox->addButton (tr ("Cancel"), QMessageBox::RejectRole); |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
442 msgBox->setDefaultButton (create_button); |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
443 msgBox->exec (); |
16558 | 444 |
19518
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
445 QAbstractButton *clicked_button = msgBox->clickedButton (); |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
446 if (clicked_button != create_button) |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
447 create_file = false; |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
448 |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
449 delete msgBox; |
17740
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
450 } |
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
|
451 |
19518
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19439
diff
changeset
|
452 if (create_file) |
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
|
453 { |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
454 // 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
|
455 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
|
456 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
|
457 { |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
458 // 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
|
459 msgBox = new QMessageBox (QMessageBox::Critical, |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
460 tr ("Octave Editor"), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
461 tr ("Could not open file\n%1\nfor write: %2."). |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
462 arg (openFileName).arg (file.errorString ()), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
463 QMessageBox::Ok, this); |
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
|
464 |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
465 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
|
466 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
|
467 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
|
468 } |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
469 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
|
470 { |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
471 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
|
472 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
|
473 } |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
474 } |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
475 } |
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
|
476 } |
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
|
477 } |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
478 |
18613
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
479 if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
480 { |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
481 // really show editor and the current editor tab |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
482 set_focus (); |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
483 emit file_loaded_signal (); |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18540
diff
changeset
|
484 } |
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
|
485 } |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
486 } |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
487 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
488 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
489 // 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
|
490 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
|
491 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
|
492 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
493 if (action) |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
494 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
495 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
|
496 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
497 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
498 |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
499 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
500 void |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
501 file_editor::check_conflict_save (const QString& saveFileName, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
502 bool remove_on_success) |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
503 { |
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 // 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
|
505 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
|
506 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
|
507 |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
508 // 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
|
509 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
|
510 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
511 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
|
512 { |
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
|
513 // 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
|
514 // 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
|
515 // 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
|
516 // 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
|
517 // 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
|
518 // 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
|
519 |
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
|
520 // Create a NonModal message about error. |
16558 | 521 QMessageBox *msgBox |
522 = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"), | |
523 tr ("File not saved! A file with the selected name\n%1\n" | |
524 "is already open in the editor"). | |
525 arg (saveFileName), | |
526 QMessageBox::Ok, 0); | |
527 | |
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
|
528 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
|
529 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
|
530 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
|
531 |
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
|
532 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
|
533 } |
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
|
534 |
16558 | 535 QObject *saveFileObject = sender (); |
536 QWidget *saveFileWidget = 0; | |
537 | |
538 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
|
539 { |
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
|
540 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
|
541 { |
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
|
542 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
|
543 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
|
544 } |
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 } |
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
|
546 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
|
547 { |
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
|
548 // Create a NonModal message about error. |
16558 | 549 QMessageBox *msgBox |
550 = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"), | |
18282
cae24b7cfaf4
minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents:
17988
diff
changeset
|
551 tr ("The associated file editor tab has disappeared."), |
16558 | 552 QMessageBox::Ok, 0); |
553 | |
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
|
554 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
|
555 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
|
556 msgBox->show (); |
16558 | 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 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
|
559 } |
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
|
560 |
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
|
561 // 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
|
562 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
|
563 } |
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
|
564 |
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
|
565 void |
16558 | 566 file_editor::handle_insert_debugger_pointer_request (const QString& file, |
567 int line) | |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
568 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
569 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
|
570 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
571 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
572 void |
16558 | 573 file_editor::handle_delete_debugger_pointer_request (const QString& file, |
574 int line) | |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
575 { |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
576 if (! file.isEmpty ()) |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
577 { |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
578 // 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
|
579 editor_tab_map.clear (); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
580 emit fetab_file_name_query (0); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
581 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
582 // 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
|
583 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
|
584 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
585 if (tab) |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
586 { |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
587 _tab_widget->setCurrentWidget (tab); |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
588 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
589 if (line > 0) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
590 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
|
591 |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
592 emit fetab_set_focus (tab); |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
593 } |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
594 } |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
595 } |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
596 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
597 void |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
598 file_editor::handle_update_breakpoint_marker_request (bool insert, |
16558 | 599 const QString& file, |
600 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
|
601 { |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
602 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
|
603 } |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
604 |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
605 void |
16399
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
606 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
|
607 { |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
608 request_open_file (file); |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
609 } |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
610 |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
611 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
612 file_editor::request_undo (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
613 { |
18841
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18840
diff
changeset
|
614 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18840
diff
changeset
|
615 QsciScintillaBase::SCI_UNDO); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
616 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
617 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
618 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
619 file_editor::request_redo (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
620 { |
18841
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18840
diff
changeset
|
621 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18840
diff
changeset
|
622 QsciScintillaBase::SCI_REDO); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
623 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
624 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
625 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
626 file_editor::request_copy (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
627 { |
18841
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18840
diff
changeset
|
628 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18840
diff
changeset
|
629 QsciScintillaBase::SCI_COPY); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
630 } |
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 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
633 file_editor::request_cut (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
634 { |
18841
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18840
diff
changeset
|
635 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18840
diff
changeset
|
636 QsciScintillaBase::SCI_CUT); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
637 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
638 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
639 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
640 file_editor::request_paste (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
641 { |
18841
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18840
diff
changeset
|
642 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18840
diff
changeset
|
643 QsciScintillaBase::SCI_PASTE); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
644 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
645 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
646 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
647 file_editor::request_selectall (bool) |
18640
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18619
diff
changeset
|
648 { |
18841
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18840
diff
changeset
|
649 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18840
diff
changeset
|
650 QsciScintillaBase::SCI_SELECTALL); |
18640
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18619
diff
changeset
|
651 } |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18619
diff
changeset
|
652 |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18619
diff
changeset
|
653 void |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
654 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
|
655 { |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
656 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
|
657 } |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
658 void |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
659 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
|
660 { |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
661 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
|
662 } |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
663 |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
664 void |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
665 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
|
666 { |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
667 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
|
668 } |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
669 |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
670 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
671 file_editor::request_save_file (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
672 { |
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
|
673 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
|
674 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
675 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
676 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
677 file_editor::request_save_file_as (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
678 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
679 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
|
680 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
681 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
682 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
683 file_editor::request_print_file (bool) |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
684 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
685 emit fetab_print_file (_tab_widget->currentWidget ()); |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
686 } |
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
687 |
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
688 |
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
689 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
690 file_editor::request_run_file (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
691 { |
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
|
692 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
|
693 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
694 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
695 void |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
696 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
|
697 { |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
698 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
|
699 } |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
700 |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
701 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
702 file_editor::request_toggle_bookmark (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
703 { |
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
|
704 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
|
705 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
706 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
707 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
708 file_editor::request_next_bookmark (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
709 { |
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
|
710 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
|
711 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
712 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
713 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
714 file_editor::request_previous_bookmark (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
715 { |
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
|
716 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
|
717 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
718 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
719 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
720 file_editor::request_remove_bookmark (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
721 { |
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
|
722 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
|
723 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
724 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
725 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
726 file_editor::request_toggle_breakpoint (bool) |
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
|
727 { |
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
|
728 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
|
729 } |
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
|
730 |
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
|
731 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
732 file_editor::request_next_breakpoint (bool) |
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
|
733 { |
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
|
734 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
|
735 } |
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
|
736 |
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
|
737 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
738 file_editor::request_previous_breakpoint (bool) |
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
|
739 { |
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 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
|
741 } |
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
|
742 |
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
|
743 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
744 file_editor::request_remove_breakpoint (bool) |
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
|
745 { |
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
|
746 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
|
747 } |
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
|
748 |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
749 // slots for Edit->Commands actions |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
750 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
751 file_editor::request_delete_start_word (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
752 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
753 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18830
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18820
diff
changeset
|
754 QsciScintillaBase::SCI_DELWORDLEFT); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
755 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
756 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
757 file_editor::request_delete_end_word (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
758 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
759 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18830
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18820
diff
changeset
|
760 QsciScintillaBase::SCI_DELWORDRIGHT); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
761 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
762 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
763 file_editor::request_delete_start_line (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
764 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
765 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18830
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18820
diff
changeset
|
766 QsciScintillaBase::SCI_DELLINELEFT); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
767 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
768 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
769 file_editor::request_delete_end_line (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
770 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
771 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18830
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18820
diff
changeset
|
772 QsciScintillaBase::SCI_DELLINERIGHT); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
773 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
774 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
775 file_editor::request_delete_line (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
776 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
777 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18830
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18820
diff
changeset
|
778 QsciScintillaBase::SCI_LINEDELETE); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
779 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
780 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
781 file_editor::request_copy_line (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
782 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
783 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18830
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18820
diff
changeset
|
784 QsciScintillaBase::SCI_LINECOPY); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
785 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
786 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
787 file_editor::request_cut_line (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
788 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
789 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18830
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18820
diff
changeset
|
790 QsciScintillaBase::SCI_LINECUT); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
791 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
792 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
793 file_editor::request_duplicate_selection (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
794 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
795 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18830
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18820
diff
changeset
|
796 QsciScintillaBase::SCI_SELECTIONDUPLICATE); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
797 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
798 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
799 file_editor::request_transpose_line (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
800 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
801 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18830
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18820
diff
changeset
|
802 QsciScintillaBase::SCI_LINETRANSPOSE); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
803 } |
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
|
804 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
805 file_editor::request_comment_selected_text (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
806 { |
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
|
807 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
|
808 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
809 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
810 file_editor::request_uncomment_selected_text (bool) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
811 { |
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
|
812 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
|
813 } |
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
814 |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
815 // slots for Edit->Format actions |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
816 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
817 file_editor::request_upper_case (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
818 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
819 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18830
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18820
diff
changeset
|
820 QsciScintillaBase::SCI_UPPERCASE); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
821 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
822 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
823 file_editor::request_lower_case (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
824 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
825 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18830
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18820
diff
changeset
|
826 QsciScintillaBase::SCI_LOWERCASE); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
827 } |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
828 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
829 file_editor::request_indent_selected_text (bool) |
18345
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
830 { |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
831 emit fetab_indent_selected_text (_tab_widget->currentWidget ()); |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
832 } |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
833 |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
834 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
835 file_editor::request_unindent_selected_text (bool) |
18345
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
836 { |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
837 emit fetab_unindent_selected_text (_tab_widget->currentWidget ()); |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
838 } |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
839 |
19439
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
840 void |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
841 file_editor::request_conv_eol_windows (bool) |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
842 { |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
843 emit fetab_convert_eol (_tab_widget->currentWidget (), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
844 QsciScintilla::EolWindows); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
845 } |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
846 void |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
847 file_editor::request_conv_eol_unix (bool) |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
848 { |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
849 emit fetab_convert_eol (_tab_widget->currentWidget (), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
850 QsciScintilla::EolUnix); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
851 } |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
852 void |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
853 file_editor::request_conv_eol_mac (bool) |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
854 { |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
855 emit fetab_convert_eol (_tab_widget->currentWidget (), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
856 QsciScintilla::EolMac); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
857 } |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
858 |
18345
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
859 |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
860 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
861 file_editor::request_find (bool) |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
862 { |
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
|
863 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
|
864 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
865 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
866 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
867 file_editor::request_goto_line (bool) |
16375
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
868 { |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
869 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
|
870 } |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
871 |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
872 |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
873 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
874 file_editor::request_completion (bool) |
18550
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18528
diff
changeset
|
875 { |
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18528
diff
changeset
|
876 emit fetab_completion (_tab_widget->currentWidget ()); |
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18528
diff
changeset
|
877 } |
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18528
diff
changeset
|
878 |
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18528
diff
changeset
|
879 void |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
880 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
|
881 { |
19201
dddffa2ff413
fix crash when mru list of editor is empty (regression from cset 12462638ab20)
Torsten <ttl@justmail.de>
parents:
19175
diff
changeset
|
882 if (_mru_files.count () && _mru_files.at (0) == file_name) |
19161
12462638ab20
do not change editors mru list if first entry is actual file (bug #42867)
Torsten <ttl@justmail.de>
parents:
19134
diff
changeset
|
883 return; // the first entry is already the actual file name |
12462638ab20
do not change editors mru list if first entry is actual file (bug #42867)
Torsten <ttl@justmail.de>
parents:
19134
diff
changeset
|
884 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
885 _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
|
886 _mru_files.prepend (file_name); |
19161
12462638ab20
do not change editors mru list if first entry is actual file (bug #42867)
Torsten <ttl@justmail.de>
parents:
19134
diff
changeset
|
887 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
888 mru_menu_update (); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
889 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
890 |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
891 void |
16558 | 892 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
|
893 { |
16558 | 894 int num_files = qMin (_mru_files.size (), int (MaxMRUFiles)); |
895 | |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
896 // 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
|
897 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
|
898 { |
16558 | 899 QString text = tr ("&%1 %2"). |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
900 arg ((i+1) % int (MaxMRUFiles)).arg (_mru_files.at (i)); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
901 _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
|
902 _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
|
903 _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
|
904 } |
16558 | 905 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
906 // hide unused mru-menu entries |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
907 for (int j = num_files; j < MaxMRUFiles; ++j) |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
908 _mru_file_actions[j]->setVisible (false); |
16558 | 909 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
910 // delete entries in string-list beyond MaxMRUFiles |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
911 while (_mru_files.size () > MaxMRUFiles) |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
912 _mru_files.removeLast (); |
16558 | 913 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
914 // save actual mru-list in settings |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
915 QSettings *settings = resource_manager::get_settings (); |
16558 | 916 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
917 // FIXME: what should happen if settings is 0? |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
918 settings->setValue ("editor/mru_file_list", _mru_files); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
919 settings->sync (); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
920 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
921 |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
922 void |
16307
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
923 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
|
924 const QString& tip) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
925 { |
16558 | 926 QObject *fileEditorTab = sender (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
927 if (fileEditorTab) |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
928 { |
16558 | 929 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
|
930 { |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
931 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
|
932 { |
16307
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
933 _tab_widget->setTabText (i, fname); |
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
934 _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
|
935 } |
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
|
936 } |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
937 } |
13501 | 938 } |
939 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
940 void |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
941 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
|
942 { |
19608
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
943 file_editor_tab *editor_tab = |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
944 static_cast <file_editor_tab *> (_tab_widget->currentWidget ()); |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
945 editor_tab->conditional_close (0); // 0: app is not closing, only tab |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
946 } |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
947 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
948 void |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
949 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
|
950 { |
19608
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
951 file_editor_tab *editor_tab; |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
952 |
16637
b3f4bdd7e5f4
fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents:
16635
diff
changeset
|
953 // 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
|
954 for (int index = _tab_widget->count ()-1; index >= 0; index--) |
19608
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
955 { |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
956 editor_tab = static_cast <file_editor_tab *> (_tab_widget->widget (index)); |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
957 editor_tab->conditional_close (0); // 0: app is not closing, only tab |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
958 } |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
959 } |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
960 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
961 void |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
962 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
|
963 { |
19608
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
964 file_editor_tab *editor_tab; |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
965 QWidget *tabID = _tab_widget->currentWidget (); |
19608
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
966 |
16637
b3f4bdd7e5f4
fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents:
16635
diff
changeset
|
967 // 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
|
968 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
|
969 { |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
970 if (tabID != _tab_widget->widget (index)) |
19608
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
971 { |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
972 editor_tab = |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
973 static_cast <file_editor_tab *> (_tab_widget->widget (index)); |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
974 editor_tab->conditional_close (0); // 0: app is not closing, only tab |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
975 } |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
976 } |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
977 } |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
978 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
979 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
980 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
|
981 file_editor::handle_tab_close_request (int index) |
13529 | 982 { |
19608
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
983 file_editor_tab *editor_tab = |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
984 static_cast <file_editor_tab *> (_tab_widget->widget (index)); |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19518
diff
changeset
|
985 editor_tab->conditional_close (0); // 0: app is not closing, only 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
|
986 } |
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
|
987 |
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
|
988 void |
16558 | 989 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
|
990 { |
16558 | 991 QObject *fileEditorTab = sender (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
992 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
|
993 { |
16558 | 994 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
|
995 { |
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
|
996 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
|
997 { |
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
|
998 _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
|
999 delete fileEditorTab; |
17914
46da2c323ad6
Remove unnecessary loop in file_editor::handle_tab_remove_request.
PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
parents:
17903
diff
changeset
|
1000 break; |
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
|
1001 } |
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
|
1002 } |
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
|
1003 } |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1004 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
|
1005 } |
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
|
1006 |
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
|
1007 void |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
1008 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
|
1009 { |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
1010 // 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
|
1011 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
1012 editor_tab_map[fileName] = ID; |
13501 | 1013 } |
1014 | |
18842
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1015 // context menu of edit area |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
1016 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
|
1017 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
|
1018 { |
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
|
1019 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
|
1020 } |
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
|
1021 |
18842
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1022 void file_editor::create_context_menu (QMenu *menu) |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1023 { |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1024 // remove all standard actions from scintilla |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1025 QList<QAction *> all_actions = menu->actions (); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1026 QAction* a; |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1027 |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1028 foreach (a, all_actions) |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1029 menu->removeAction (a); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1030 |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1031 // add editor's actions with icons and customized shortcuts |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1032 menu->addAction (_undo_action); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1033 menu->addAction (_redo_action); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1034 menu->addSeparator (); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1035 menu->addAction (_cut_action); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1036 menu->addAction (_copy_action); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1037 menu->addAction (_paste_action); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1038 menu->addSeparator (); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1039 menu->addAction (_selectall_action); |
18949
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18920
diff
changeset
|
1040 menu->addSeparator (); |
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18920
diff
changeset
|
1041 menu->addAction (_run_selection_action); |
18842
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1042 } |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1043 |
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
|
1044 void |
19438
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1045 file_editor::toggle_preference (const QString& preference, bool def) |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1046 { |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1047 QSettings *settings = resource_manager::get_settings (); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1048 bool old = settings->value (preference,def).toBool (); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1049 settings->setValue (preference,!old); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1050 notice_settings (settings); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1051 } |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1052 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1053 void |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1054 file_editor::show_line_numbers (bool) |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1055 { |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1056 toggle_preference ("editor/showLineNumbers",true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1057 } |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1058 void |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1059 file_editor::show_white_space (bool) |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1060 { |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1061 toggle_preference ("editor/show_white_space",false); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1062 } |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1063 void |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1064 file_editor::show_eol_chars (bool) |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1065 { |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1066 toggle_preference ("editor/show_eol_chars",false); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1067 } |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1068 void |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1069 file_editor::show_indent_guides (bool) |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1070 { |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1071 toggle_preference ("editor/show_indent_guides",false); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1072 } |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1073 void |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1074 file_editor::show_long_line (bool) |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1075 { |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1076 toggle_preference ("editor/long_line_marker",true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1077 } |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1078 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1079 void |
18655
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1080 file_editor::zoom_in (bool) |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1081 { |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1082 emit fetab_zoom_in (_tab_widget->currentWidget ()); |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1083 } |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1084 |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1085 void |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1086 file_editor::zoom_out (bool) |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1087 { |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1088 emit fetab_zoom_out (_tab_widget->currentWidget ()); |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1089 } |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1090 |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1091 void |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1092 file_editor::zoom_normal (bool) |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1093 { |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1094 emit fetab_zoom_normal (_tab_widget->currentWidget ()); |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1095 } |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1096 |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1097 void |
18844
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1098 file_editor::edit_status_update (bool undo, bool redo) |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1099 { |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1100 _undo_action->setEnabled (undo); |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1101 _redo_action->setEnabled (redo); |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1102 } |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1103 |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1104 void |
16558 | 1105 file_editor::handle_editor_state_changed (bool copy_available, |
18949
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18920
diff
changeset
|
1106 const QString& file_name, |
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18920
diff
changeset
|
1107 bool is_octave_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
|
1108 { |
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
|
1109 // 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
|
1110 // all the file editor tabs, just process info from the current active tab. |
16558 | 1111 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
|
1112 { |
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
|
1113 _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
|
1114 _cut_action->setEnabled (copy_available); |
19277
63c5f95afeb3
Allow run selection for all editor file types (bug #43195)
Torsten <ttl@justmail.de>
parents:
19201
diff
changeset
|
1115 _run_selection_action->setEnabled (copy_available); |
18949
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18920
diff
changeset
|
1116 _run_action->setEnabled (is_octave_file); |
16558 | 1117 |
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
|
1118 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
|
1119 { |
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
|
1120 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
|
1121 int lastslash = ced.lastIndexOf ('/'); |
16558 | 1122 |
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
|
1123 // 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
|
1124 // 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
|
1125 if (lastslash > 0 && lastslash != ced.count ()) |
16558 | 1126 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
|
1127 } |
16558 | 1128 |
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
|
1129 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
|
1130 } |
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
|
1131 } |
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
|
1132 |
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
|
1133 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
|
1134 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
|
1135 { |
17988
d62570cfbab9
reduce default icon size to 16 pixel for larger working areas in the widgets
Torsten <ttl@justmail.de>
parents:
17941
diff
changeset
|
1136 int icon_size = settings->value ("toolbar_icon_size", 16).toInt (); |
16558 | 1137 _tool_bar->setIconSize (QSize (icon_size, icon_size)); |
18306
4dadae02bd4c
max. width of editor tabs limited and configurable
Torsten <ttl@justmail.de>
parents:
18294
diff
changeset
|
1138 |
18411
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1139 int tab_width_min = settings->value ("editor/notebook_tab_width_min", 160) |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1140 .toInt (); |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1141 int tab_width_max = settings->value ("editor/notebook_tab_width_max", 300) |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1142 .toInt (); |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1143 |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1144 if (settings->value ("editor/longWindowTitle", false).toBool ()) |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1145 { |
18845
834f6e604dc3
use defaults size for tab heights in editor and doc widget (bug #42144)
Torsten <ttl@justmail.de>
parents:
18844
diff
changeset
|
1146 QString style_sheet = QString ("QTabBar::tab " |
834f6e604dc3
use defaults size for tab heights in editor and doc widget (bug #42144)
Torsten <ttl@justmail.de>
parents:
18844
diff
changeset
|
1147 "{min-width: %1px; max-width: %2px;}") |
18411
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1148 .arg (tab_width_min).arg (tab_width_max); |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1149 _tab_widget->setElideMode (Qt::ElideLeft); |
18845
834f6e604dc3
use defaults size for tab heights in editor and doc widget (bug #42144)
Torsten <ttl@justmail.de>
parents:
18844
diff
changeset
|
1150 _tab_widget->setStyleSheet (style_sheet); |
18411
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1151 } |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1152 else |
18845
834f6e604dc3
use defaults size for tab heights in editor and doc widget (bug #42144)
Torsten <ttl@justmail.de>
parents:
18844
diff
changeset
|
1153 _tab_widget->setElideMode (Qt::ElideNone); |
18411
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1154 |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
1155 _tab_widget->setUsesScrollButtons (true); |
18306
4dadae02bd4c
max. width of editor tabs limited and configurable
Torsten <ttl@justmail.de>
parents:
18294
diff
changeset
|
1156 |
19438
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1157 bool show_it; |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1158 show_it = settings->value ("editor/showLineNumbers",true).toBool (); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1159 _show_linenum_action->setChecked (show_it); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1160 show_it = settings->value ("editor/show_white_space",false).toBool (); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1161 _show_whitespace_action->setChecked (show_it); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1162 show_it = settings->value ("editor/show_eol_chars",false).toBool (); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1163 _show_eol_action->setChecked (show_it); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1164 show_it = settings->value ("editor/show_indent_guides",false).toBool (); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1165 _show_indguide_action->setChecked (show_it); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1166 show_it = settings->value ("editor/long_line_marker",true).toBool (); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1167 _show_longline_action->setChecked (show_it); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1168 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1169 set_shortcuts (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1170 |
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
|
1171 // 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
|
1172 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
|
1173 } |
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
|
1174 |
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
|
1175 void |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1176 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
|
1177 { |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1178 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
|
1179 } |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1180 |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1181 void |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1182 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
|
1183 { |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1184 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
|
1185 } |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1186 |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1187 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1188 file_editor::insert_new_open_actions (QAction *new_action, |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1189 QAction *new_fcn_action, |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1190 QAction *open_action) |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1191 { |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1192 _fileMenu->insertAction (_mru_file_menu->menuAction (), open_action); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1193 _fileMenu->insertAction (open_action, new_fcn_action); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1194 _fileMenu->insertAction (new_fcn_action, new_action); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1195 _tool_bar->insertAction (_save_action, open_action); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1196 _tool_bar->insertAction (open_action, new_action); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1197 } |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1198 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1199 QAction* |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1200 file_editor::add_action (QMenu *menu, const QIcon &icon, const QString &text, |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1201 const char *member) |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1202 { |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1203 QAction *a = menu->addAction (icon, text, this, member); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1204 addAction (a); // important for shortcut context |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1205 a->setShortcutContext (Qt::WidgetWithChildrenShortcut); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1206 return a; |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1207 } |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1208 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1209 void |
19134
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1210 file_editor::enable_menu_shortcuts (bool enable) |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1211 { |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1212 QHash<QMenu*, QStringList>::const_iterator i = _hash_menu_text.constBegin(); |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1213 |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1214 while (i != _hash_menu_text.constEnd()) |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1215 { |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1216 i.key ()->setTitle (i.value ().at (! enable)); |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1217 ++i; |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1218 } |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1219 } |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1220 |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1221 QMenu* |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1222 file_editor::m_add_menu (QMenuBar *p, QString name) |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1223 { |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1224 QMenu *menu = p->addMenu (name); |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1225 |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1226 QString base_name = name; // get a copy |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1227 // replace intended '&' ("&&") by a temp. string |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1228 base_name.replace ("&&","___octave_amp_replacement___"); |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1229 // remove single '&' (shortcut) |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1230 base_name.remove ("&"); |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1231 // restore intended '&' |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1232 base_name.replace ("___octave_amp_replacement___","&&"); |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1233 |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1234 // remember names with and without shortcut |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1235 _hash_menu_text[menu] = QStringList () << name << base_name; |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1236 |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1237 return menu; |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1238 } |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1239 |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1240 void |
16558 | 1241 file_editor::construct (void) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
1242 { |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1243 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
|
1244 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1245 // FIXME: what was the intended purpose of this unused variable? |
15894
9cd14e53e906
eliminate some compiler warnings for GUI code
John W. Eaton <jwe@octave.org>
parents:
15873
diff
changeset
|
1246 // QStyle *editor_style = QApplication::style (); |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1247 _menu_bar = new QMenuBar (editor_widget); |
18639
bfb735b70978
Force non-native menu bar for the editor on mac (bug #41823)
pantxo <pantxo.diribarne@gmail.com>
parents:
18613
diff
changeset
|
1248 #if defined (Q_OS_MAC) |
bfb735b70978
Force non-native menu bar for the editor on mac (bug #41823)
pantxo <pantxo.diribarne@gmail.com>
parents:
18613
diff
changeset
|
1249 _menu_bar->setNativeMenuBar (false); |
bfb735b70978
Force non-native menu bar for the editor on mac (bug #41823)
pantxo <pantxo.diribarne@gmail.com>
parents:
18613
diff
changeset
|
1250 #endif |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1251 _tool_bar = new QToolBar (editor_widget); |
17988
d62570cfbab9
reduce default icon size to 16 pixel for larger working areas in the widgets
Torsten <ttl@justmail.de>
parents:
17941
diff
changeset
|
1252 _tool_bar->setMovable (true); |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1253 _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
|
1254 _tab_widget->setTabsClosable (true); |
18215
e54cfaae830b
Make editor tabs draggable if feature is available
Richard Crozier richard dot crozier(at)yahoo.co.uk
parents:
17988
diff
changeset
|
1255 #ifdef HAVE_QTABWIDGET_SETMOVABLE |
e54cfaae830b
Make editor tabs draggable if feature is available
Richard Crozier richard dot crozier(at)yahoo.co.uk
parents:
17988
diff
changeset
|
1256 _tab_widget->setMovable (true); |
e54cfaae830b
Make editor tabs draggable if feature is available
Richard Crozier richard dot crozier(at)yahoo.co.uk
parents:
17988
diff
changeset
|
1257 #endif |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
1258 |
18550
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18528
diff
changeset
|
1259 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1260 // 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
|
1261 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
|
1262 _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
|
1263 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
|
1264 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1265 _mru_file_actions[i] = new QAction (this); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1266 _mru_file_actions[i]->setVisible (false); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1267 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1268 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1269 // menu bar |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1270 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1271 // file menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1272 |
19134
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1273 _fileMenu = m_add_menu (_menu_bar, tr ("&File")); |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1274 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1275 // new and open menus are inserted later by the main window |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1276 _mru_file_menu = new QMenu (tr ("&Recent Editor Files"), _fileMenu); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1277 for (int i = 0; i < MaxMRUFiles; ++i) |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1278 _mru_file_menu->addAction (_mru_file_actions[i]); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1279 _fileMenu->addMenu (_mru_file_menu); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1280 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1281 _fileMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1282 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1283 _edit_function_action = add_action (_fileMenu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1284 tr ("&Edit Function"), SLOT (request_context_edit (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1285 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1286 _fileMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1287 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1288 _save_action = add_action (_fileMenu, QIcon (":/actions/icons/filesave.png"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1289 tr ("&Save File"), SLOT (request_save_file (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1290 _save_as_action = add_action (_fileMenu, QIcon (":/actions/icons/filesaveas.png"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1291 tr ("Save File &As..."), SLOT (request_save_file_as (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1292 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1293 _fileMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1294 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1295 _close_action = add_action (_fileMenu, |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1296 QIcon::fromTheme("window-close",QIcon (":/actions/icons/fileclose.png")), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1297 tr ("&Close"), SLOT (request_close_file (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1298 _close_all_action = add_action (_fileMenu, |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1299 QIcon::fromTheme("window-close", QIcon (":/actions/icons/fileclose.png")), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1300 tr ("Close All"), SLOT (request_close_all_files (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1301 _close_others_action = add_action (_fileMenu, |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1302 QIcon::fromTheme("window-close", QIcon (":/actions/icons/fileclose.png")), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1303 tr ("Close Other Files"), SLOT (request_close_other_files (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1304 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1305 _fileMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1306 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1307 _print_action = add_action (_fileMenu, QIcon (":/actions/icons/fileprint.png"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1308 tr ("Print..."), SLOT (request_print_file (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1309 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1310 // edit menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1311 |
19134
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1312 QMenu *editMenu = m_add_menu (_menu_bar, tr ("&Edit")); |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1313 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1314 _undo_action = add_action (editMenu, QIcon (":/actions/icons/undo.png"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1315 tr ("&Undo"), SLOT (request_undo (bool))); |
18844
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1316 _undo_action->setEnabled (false); |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1317 _redo_action = add_action (editMenu, QIcon (":/actions/icons/redo.png"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1318 tr ("&Redo"), SLOT (request_redo (bool))); |
18844
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1319 _redo_action->setEnabled (false); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1320 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1321 editMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1322 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1323 _copy_action = add_action (editMenu, QIcon (":/actions/icons/editcopy.png"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1324 tr ("&Copy"), SLOT (request_copy (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1325 _copy_action->setEnabled (false); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1326 _cut_action = add_action (editMenu, QIcon (":/actions/icons/editcut.png"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1327 tr ("Cu&t"), SLOT (request_cut (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1328 _cut_action->setEnabled (false); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1329 _paste_action = add_action (editMenu, QIcon (":/actions/icons/editpaste.png"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1330 tr ("Paste"), SLOT (request_paste (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1331 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1332 editMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1333 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1334 _selectall_action = add_action (editMenu, QIcon (), tr ("Select All"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1335 SLOT (request_selectall (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1336 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1337 editMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1338 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1339 _find_action = add_action (editMenu, QIcon (":/actions/icons/find.png"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1340 tr ("&Find and Replace..."), SLOT (request_find (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1341 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1342 editMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1343 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1344 _edit_cmd_menu = editMenu->addMenu (tr ("&Commands")); |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
1345 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1346 _delete_line_action = add_action (_edit_cmd_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1347 tr ("Delete Line"), SLOT (request_delete_line (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1348 _copy_line_action = add_action (_edit_cmd_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1349 tr ("Copy Line"), SLOT (request_copy_line (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1350 _cut_line_action = add_action (_edit_cmd_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1351 tr ("Cut Line"), SLOT (request_cut_line (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1352 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1353 _edit_cmd_menu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1354 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1355 _delete_start_word_action = add_action (_edit_cmd_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1356 tr ("Delete to Start of Word"), SLOT (request_delete_start_word (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1357 _delete_end_word_action = add_action (_edit_cmd_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1358 tr ("Delete to End of Word"), SLOT (request_delete_end_word (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1359 _delete_start_line_action = add_action (_edit_cmd_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1360 tr ("Delete to Start of Line"), SLOT (request_delete_start_line (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1361 _delete_end_line_action = add_action (_edit_cmd_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1362 tr ("Delete to End of Line"), SLOT (request_delete_end_line (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1363 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1364 _edit_cmd_menu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1365 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1366 _duplicate_selection_action = add_action (_edit_cmd_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1367 tr ("Duplicate Selection/Line"), SLOT (request_duplicate_selection (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1368 _transpose_line_action = add_action (_edit_cmd_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1369 tr ("Transpose Line"), SLOT (request_transpose_line (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1370 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1371 _edit_cmd_menu->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1372 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1373 _completion_action = add_action (_edit_cmd_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1374 tr ("&Show Completion List"), SLOT (request_completion (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1375 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1376 _edit_fmt_menu = editMenu->addMenu (tr ("&Format")); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1377 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1378 _upper_case_action = add_action (_edit_fmt_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1379 tr ("&Uppercase Selection"), SLOT (request_upper_case (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1380 _lower_case_action = add_action (_edit_fmt_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1381 tr ("&Lowercase Selection"), SLOT (request_lower_case (bool))); |
19439
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1382 |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1383 _edit_fmt_menu->addSeparator (); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1384 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1385 _comment_selection_action = add_action (_edit_fmt_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1386 tr ("&Comment"), SLOT (request_comment_selected_text (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1387 _uncomment_selection_action = add_action (_edit_fmt_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1388 tr ("&Uncomment"), SLOT (request_uncomment_selected_text (bool))); |
19439
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1389 |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1390 _edit_fmt_menu->addSeparator (); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1391 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1392 _indent_selection_action = add_action (_edit_fmt_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1393 tr ("&Indent"), SLOT (request_indent_selected_text (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1394 _unindent_selection_action = add_action (_edit_fmt_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1395 tr ("&Unindent"), SLOT (request_unindent_selected_text (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1396 |
19439
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1397 _edit_fmt_menu->addSeparator (); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1398 |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1399 _conv_eol_windows_action = add_action (_edit_fmt_menu, QIcon (), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1400 tr ("Convert Line Endings to &Windows (CRLF)"), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1401 SLOT (request_conv_eol_windows (bool))); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1402 _conv_eol_unix_action = add_action (_edit_fmt_menu, QIcon (), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1403 tr ("Convert Line Endings to &Unix (LF)"), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1404 SLOT (request_conv_eol_unix (bool))); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1405 _conv_eol_mac_action = add_action (_edit_fmt_menu, QIcon (), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1406 tr ("Convert Line Endings to &Mac (CR)"), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1407 SLOT (request_conv_eol_mac (bool))); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1408 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1409 _edit_nav_menu = editMenu->addMenu (tr ("Navi&gation")); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1410 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1411 _goto_line_action = add_action (_edit_nav_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1412 tr ("Go &to Line..."), SLOT (request_goto_line (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1413 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1414 _edit_nav_menu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1415 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1416 _next_bookmark_action = add_action (_edit_nav_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1417 tr ("&Next Bookmark"), SLOT (request_next_bookmark (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1418 _previous_bookmark_action = add_action (_edit_nav_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1419 tr ("Pre&vious Bookmark"), SLOT (request_previous_bookmark (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1420 _toggle_bookmark_action = add_action (_edit_nav_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1421 tr ("Toggle &Bookmark"), SLOT (request_toggle_bookmark (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1422 _remove_bookmark_action = add_action (_edit_nav_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1423 tr ("&Remove All Bookmarks"), SLOT (request_remove_bookmark (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1424 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1425 editMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1426 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1427 _preferences_action = add_action (editMenu, |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1428 QIcon (":/actions/icons/configure.png"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1429 tr ("&Preferences..."), SLOT (request_preferences (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1430 _styles_preferences_action = add_action (editMenu, |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1431 QIcon (":/actions/icons/configure.png"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1432 tr ("&Styles Preferences..."), SLOT (request_styles_preferences (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1433 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1434 // view menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1435 |
19134
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1436 QMenu *view_menu = m_add_menu (_menu_bar, tr ("&View")); |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1437 |
19438
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1438 _view_editor_menu = view_menu->addMenu (tr ("&Editor")); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1439 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1440 _show_linenum_action = add_action (_view_editor_menu, QIcon (), |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1441 tr ("Show &Line Numbers"), SLOT (show_line_numbers (bool))); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1442 _show_linenum_action->setCheckable (true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1443 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1444 _show_whitespace_action = add_action (_view_editor_menu, QIcon (), |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1445 tr ("Show &White Spaces"), SLOT (show_white_space (bool))); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1446 _show_whitespace_action->setCheckable (true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1447 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1448 _show_eol_action = add_action (_view_editor_menu, QIcon (), |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1449 tr ("Show Line &Endings"), SLOT (show_eol_chars (bool))); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1450 _show_eol_action->setCheckable (true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1451 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1452 _show_indguide_action = add_action (_view_editor_menu, QIcon (), |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1453 tr ("Show &Indentation Guides"), SLOT (show_indent_guides (bool))); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1454 _show_indguide_action->setCheckable (true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1455 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1456 _show_longline_action = add_action (_view_editor_menu, QIcon (), |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1457 tr ("Show Long Line &Marker"), SLOT (show_long_line (bool))); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1458 _show_longline_action->setCheckable (true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1459 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1460 view_menu->addSeparator (); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1461 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1462 _zoom_in_action = add_action (view_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1463 tr ("Zoom &In"), SLOT (zoom_in (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1464 _zoom_out_action = add_action (view_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1465 tr ("Zoom &Out"), SLOT (zoom_out (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1466 _zoom_normal_action = add_action (view_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1467 tr ("&Normal Size"), SLOT (zoom_normal (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1468 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1469 _menu_bar->addMenu (view_menu); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1470 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1471 // debug menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1472 |
19134
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1473 _debug_menu = m_add_menu (_menu_bar, tr ("&Debug")); |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1474 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1475 _toggle_breakpoint_action = add_action (_debug_menu, |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1476 QIcon (":/actions/icons/bp_toggle.png"), tr ("Toggle &Breakpoint"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1477 SLOT (request_toggle_breakpoint (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1478 _next_breakpoint_action = add_action (_debug_menu, |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1479 QIcon (":/actions/icons/bp_next.png"), tr ("&Next Breakpoint"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1480 SLOT (request_next_breakpoint (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1481 _previous_breakpoint_action = add_action (_debug_menu, |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1482 QIcon (":/actions/icons/bp_prev.png"), tr ("Pre&vious Breakpoint"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1483 SLOT (request_previous_breakpoint (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1484 _remove_all_breakpoints_action = add_action (_debug_menu, |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1485 QIcon (":/actions/icons/bp_rm_all.png"), tr ("&Remove All Breakpoints"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1486 SLOT (request_remove_breakpoint (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1487 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1488 _debug_menu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1489 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1490 // The other debug actions will be added by the main window. |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1491 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1492 // run menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1493 |
19134
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1494 QMenu *_run_menu = m_add_menu (_menu_bar, tr ("&Run")); |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1495 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1496 _run_action = add_action (_run_menu, QIcon (":/actions/icons/artsbuilderexecute.png"), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1497 tr ("Save File and Run"), SLOT (request_run_file (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1498 _run_selection_action = add_action (_run_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1499 tr ("Run &Selection"), SLOT (request_context_run (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1500 _run_selection_action->setEnabled (false); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1501 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1502 // help menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1503 |
19134
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18949
diff
changeset
|
1504 QMenu *_help_menu = m_add_menu (_menu_bar, tr ("&Help")); |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1505 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1506 _context_help_action = add_action (_help_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1507 tr ("&Help on Keyword"), SLOT (request_context_help (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1508 _context_doc_action = add_action (_help_menu, QIcon (), |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1509 tr ("&Documentation on Keyword"), SLOT (request_context_doc (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1510 |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
1511 // toolbar |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1512 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1513 // new and open actions are inserted later from main window |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1514 _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
|
1515 _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
|
1516 _tool_bar->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1517 _tool_bar->addAction (_print_action); |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
1518 _tool_bar->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1519 _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
|
1520 _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
|
1521 _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
|
1522 _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
|
1523 _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
|
1524 _tool_bar->addSeparator (); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1525 _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
|
1526 _tool_bar->addAction (_run_action); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
1527 _tool_bar->addSeparator (); |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1528 _tool_bar->addAction (_toggle_breakpoint_action); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1529 _tool_bar->addAction (_next_breakpoint_action); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1530 _tool_bar->addAction (_previous_breakpoint_action); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1531 _tool_bar->addAction (_remove_all_breakpoints_action); |
16981
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
1532 |
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
1533 // layout |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1534 QVBoxLayout *vbox_layout = new QVBoxLayout (); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1535 vbox_layout->addWidget (_menu_bar); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1536 vbox_layout->addWidget (_tool_bar); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1537 vbox_layout->addWidget (_tab_widget); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1538 vbox_layout->setMargin (0); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1539 editor_widget->setLayout (vbox_layout); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1540 setWidget (editor_widget); |
13501 | 1541 |
16981
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
1542 // signals |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1543 connect (this, SIGNAL (request_settings_dialog (const QString&)), |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1544 main_win (), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1545 SLOT (process_settings_dialog_request (const QString&))); |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1546 |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
16740
diff
changeset
|
1547 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
|
1548 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
|
1549 |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
16740
diff
changeset
|
1550 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
|
1551 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
|
1552 |
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
|
1553 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
|
1554 this, SLOT (request_mru_open_file (QAction *))); |
16558 | 1555 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1556 mru_menu_update (); |
16558 | 1557 |
1558 connect (_tab_widget, SIGNAL (tabCloseRequested (int)), | |
1559 this, SLOT (handle_tab_close_request (int))); | |
1560 | |
1561 connect (_tab_widget, SIGNAL (currentChanged (int)), | |
1562 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
|
1563 |
17901
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
1564 connect (this, SIGNAL (execute_command_in_terminal_signal (const QString&)), |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
1565 main_win (), SLOT (execute_command_in_terminal (const QString&))); |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
1566 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1567 resize (500, 400); |
16558 | 1568 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
|
1569 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
|
1570 |
842ab161c10a
GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents:
15321
diff
changeset
|
1571 //restore previous session |
16558 | 1572 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
|
1573 { |
16558 | 1574 QStringList sessionFileNames |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1575 = settings->value ("editor/savedSessionTabs", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1576 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
|
1577 |
16558 | 1578 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
|
1579 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
|
1580 } |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1581 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1582 check_actions (); |
13501 | 1583 } |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1584 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1585 void |
16558 | 1586 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
|
1587 { |
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
|
1588 _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
|
1589 |
18844
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1590 // signals from the qscintilla edit area |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1591 connect (f->qsci_edit_area (), SIGNAL (status_update (bool, bool)), |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1592 this, SLOT (edit_status_update (bool, bool))); |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18843
diff
changeset
|
1593 |
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
|
1594 // 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
|
1595 connect (f, SIGNAL (file_name_changed (const QString&, const QString&)), |
16558 | 1596 this, SLOT (handle_file_name_changed (const QString&, |
1597 const QString&))); | |
1598 | |
18949
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18920
diff
changeset
|
1599 connect (f, SIGNAL (editor_state_changed (bool, const QString&, bool)), |
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18920
diff
changeset
|
1600 this, SLOT (handle_editor_state_changed (bool, const QString&, bool))); |
16558 | 1601 |
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
|
1602 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
|
1603 this, SLOT (handle_tab_remove_request ())); |
16558 | 1604 |
1605 connect (f, SIGNAL (add_filename_to_list (const QString&, QWidget*)), | |
1606 this, SLOT (handle_add_filename_to_list (const QString&, QWidget*))); | |
1607 | |
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
|
1608 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
|
1609 this, SLOT (check_conflict_save (const QString&, bool))); |
16558 | 1610 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1611 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
|
1612 this, SLOT (handle_mru_add_file (const QString&))); |
16558 | 1613 |
18842
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1614 connect (f, SIGNAL (create_context_menu_tab_signal (QMenu *)), |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1615 this, SLOT (create_context_menu (QMenu *))); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18841
diff
changeset
|
1616 |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16615
diff
changeset
|
1617 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
|
1618 main_win (), SLOT (run_file_in_terminal (const QFileInfo&))); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1619 |
16731
01d523d5f796
add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
16686
diff
changeset
|
1620 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
|
1621 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
|
1622 |
18839
86eca5d178a6
disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents:
18830
diff
changeset
|
1623 connect (f, SIGNAL (set_global_edit_shortcuts_signal (bool)), |
86eca5d178a6
disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents:
18830
diff
changeset
|
1624 main_win (), SLOT (set_global_edit_shortcuts (bool))); |
86eca5d178a6
disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents:
18830
diff
changeset
|
1625 |
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
|
1626 // 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
|
1627 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
|
1628 f, SLOT (notice_settings (const QSettings *))); |
16558 | 1629 |
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
|
1630 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
|
1631 f, SLOT (change_editor_state (const QWidget*))); |
16558 | 1632 |
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
|
1633 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
|
1634 f, SLOT (file_name_query (const QWidget*))); |
16558 | 1635 |
1636 connect (this, SIGNAL (fetab_save_file (const QWidget*, const QString&, | |
1637 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
|
1638 f, SLOT (save_file (const QWidget*, const QString&, bool))); |
16558 | 1639 |
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
|
1640 // Signals from the file_editor trivial operations |
18655
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1641 connect (this, SIGNAL (fetab_zoom_in (const QWidget*)), |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1642 f, SLOT (zoom_in (const QWidget*))); |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1643 connect (this, SIGNAL (fetab_zoom_out (const QWidget*)), |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1644 f, SLOT (zoom_out (const QWidget*))); |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1645 connect (this, SIGNAL (fetab_zoom_normal (const QWidget*)), |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1646 f, SLOT (zoom_normal (const QWidget*))); |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1647 |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
1648 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
|
1649 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
|
1650 |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
1651 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
|
1652 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
|
1653 |
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
|
1654 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
|
1655 f, SLOT (save_file (const QWidget*))); |
16558 | 1656 |
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
|
1657 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
|
1658 f, SLOT (save_file_as (const QWidget*))); |
16558 | 1659 |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
1660 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
|
1661 f, SLOT (print_file (const QWidget*))); |
16558 | 1662 |
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
|
1663 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
|
1664 f, SLOT (run_file (const QWidget*))); |
16558 | 1665 |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
1666 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
|
1667 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
|
1668 |
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
|
1669 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
|
1670 f, SLOT (toggle_bookmark (const QWidget*))); |
16558 | 1671 |
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
|
1672 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
|
1673 f, SLOT (next_bookmark (const QWidget*))); |
16558 | 1674 |
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
|
1675 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
|
1676 f, SLOT (previous_bookmark (const QWidget*))); |
16558 | 1677 |
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
|
1678 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
|
1679 f, SLOT (remove_bookmark (const QWidget*))); |
16558 | 1680 |
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
|
1681 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
|
1682 f, SLOT (toggle_breakpoint (const QWidget*))); |
16558 | 1683 |
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
|
1684 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
|
1685 f, SLOT (next_breakpoint (const QWidget*))); |
16558 | 1686 |
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
|
1687 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
|
1688 f, SLOT (previous_breakpoint (const QWidget*))); |
16558 | 1689 |
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
|
1690 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
|
1691 f, SLOT (remove_all_breakpoints (const QWidget*))); |
16558 | 1692 |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
1693 connect (this, SIGNAL (fetab_scintilla_command (const QWidget *, unsigned int)), |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
1694 f, SLOT (scintilla_command (const QWidget *, unsigned int))); |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
1695 |
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
|
1696 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
|
1697 f, SLOT (comment_selected_text (const QWidget*))); |
16558 | 1698 |
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
|
1699 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
|
1700 f, SLOT (uncomment_selected_text (const QWidget*))); |
16558 | 1701 |
18345
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
1702 connect (this, SIGNAL (fetab_indent_selected_text (const QWidget*)), |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
1703 f, SLOT (indent_selected_text (const QWidget*))); |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
1704 |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
1705 connect (this, SIGNAL (fetab_unindent_selected_text (const QWidget*)), |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
1706 f, SLOT (unindent_selected_text (const QWidget*))); |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
1707 |
19439
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1708 connect (this, SIGNAL (fetab_convert_eol (const QWidget*, QsciScintilla::EolMode)), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1709 f, SLOT (convert_eol (const QWidget*, QsciScintilla::EolMode))); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1710 |
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
|
1711 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
|
1712 f, SLOT (find (const QWidget*))); |
16558 | 1713 |
1714 connect (this, SIGNAL (fetab_goto_line (const QWidget*, int)), | |
1715 f, SLOT (goto_line (const QWidget*, int))); | |
1716 | |
18550
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18528
diff
changeset
|
1717 connect (this, SIGNAL (fetab_completion (const QWidget*)), |
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18528
diff
changeset
|
1718 f, SLOT (show_auto_completion (const QWidget*))); |
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18528
diff
changeset
|
1719 |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
1720 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
|
1721 f, SLOT (set_focus (const QWidget*))); |
16558 | 1722 |
1723 connect (this, SIGNAL (fetab_insert_debugger_pointer (const QWidget*, int)), | |
1724 f, SLOT (insert_debugger_pointer (const QWidget*, int))); | |
1725 | |
1726 connect (this, SIGNAL (fetab_delete_debugger_pointer (const QWidget*, int)), | |
1727 f, SLOT (delete_debugger_pointer (const QWidget*, int))); | |
1728 | |
1729 connect (this, SIGNAL (fetab_do_breakpoint_marker (bool, const QWidget*, | |
1730 int)), | |
1731 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
|
1732 |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
1733 _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
|
1734 |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1735 check_actions (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1736 } |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15861
diff
changeset
|
1737 |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
1738 void |
18920
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1739 file_editor::copyClipboard () |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1740 { |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1741 QWidget * foc_w = focusWidget (); |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1742 |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1743 if (foc_w && foc_w->inherits ("octave_qscintilla")) |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1744 { |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1745 request_copy (true); |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1746 } |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1747 } |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1748 void |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1749 file_editor::pasteClipboard () |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1750 { |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1751 QWidget * foc_w = focusWidget (); |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1752 |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1753 if (foc_w && foc_w->inherits ("octave_qscintilla")) |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1754 { |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1755 request_paste (true); |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1756 } |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1757 } |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1758 void |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1759 file_editor::selectAll () |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1760 { |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1761 QWidget * foc_w = focusWidget (); |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1762 |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1763 if (foc_w && foc_w->inherits ("octave_qscintilla")) |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1764 { |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1765 request_selectall (true); |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1766 } |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1767 } |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1768 |
64bd9afac22c
Add back main menu copy,paste,select all in editor
John Donoghue <john.donoghue@ieee.org>
parents:
18845
diff
changeset
|
1769 void |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1770 file_editor::set_shortcuts () |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1771 { |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1772 // File menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1773 shortcut_manager::set_shortcut (_edit_function_action, "editor_file:edit_function"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1774 shortcut_manager::set_shortcut (_save_action, "editor_file:save"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1775 shortcut_manager::set_shortcut (_save_as_action, "editor_file:save_as"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1776 shortcut_manager::set_shortcut (_close_action, "editor_file:close"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1777 shortcut_manager::set_shortcut (_close_all_action, "editor_file:close_all"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1778 shortcut_manager::set_shortcut (_close_others_action, "editor_file:close_other"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1779 shortcut_manager::set_shortcut (_print_action, "editor_file:print"); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
1780 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1781 // Edit menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1782 shortcut_manager::set_shortcut (_undo_action, "editor_edit:undo"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1783 shortcut_manager::set_shortcut (_redo_action, "editor_edit:redo"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1784 shortcut_manager::set_shortcut (_copy_action, "editor_edit:copy"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1785 shortcut_manager::set_shortcut (_cut_action, "editor_edit:cut"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1786 shortcut_manager::set_shortcut (_paste_action, "editor_edit:paste"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1787 shortcut_manager::set_shortcut (_selectall_action, "editor_edit:select_all"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1788 shortcut_manager::set_shortcut (_find_action, "editor_edit:find_replace"); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
1789 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1790 shortcut_manager::set_shortcut (_delete_start_word_action, "editor_edit:delete_start_word"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1791 shortcut_manager::set_shortcut (_delete_end_word_action, "editor_edit:delete_end_word"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1792 shortcut_manager::set_shortcut (_delete_start_line_action, "editor_edit:delete_start_line"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1793 shortcut_manager::set_shortcut (_delete_end_line_action, "editor_edit:delete_end_line"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1794 shortcut_manager::set_shortcut (_delete_line_action, "editor_edit:delete_line"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1795 shortcut_manager::set_shortcut (_copy_line_action, "editor_edit:copy_line"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1796 shortcut_manager::set_shortcut (_cut_line_action, "editor_edit:cut_line"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1797 shortcut_manager::set_shortcut (_duplicate_selection_action, "editor_edit:duplicate_selection"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1798 shortcut_manager::set_shortcut (_transpose_line_action, "editor_edit:transpose_line"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1799 shortcut_manager::set_shortcut (_comment_selection_action, "editor_edit:comment_selection"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1800 shortcut_manager::set_shortcut (_uncomment_selection_action, "editor_edit:uncomment_selection"); |
18759
086093fbdc1a
first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
18710
diff
changeset
|
1801 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1802 shortcut_manager::set_shortcut (_upper_case_action, "editor_edit:upper_case"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1803 shortcut_manager::set_shortcut (_lower_case_action, "editor_edit:lower_case"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1804 shortcut_manager::set_shortcut (_indent_selection_action, "editor_edit:indent_selection"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1805 shortcut_manager::set_shortcut (_unindent_selection_action, "editor_edit:unindent_selection"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1806 shortcut_manager::set_shortcut (_completion_action, "editor_edit:completion_list"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1807 shortcut_manager::set_shortcut (_goto_line_action, "editor_edit:goto_line"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1808 shortcut_manager::set_shortcut (_toggle_bookmark_action, "editor_edit:toggle_bookmark"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1809 shortcut_manager::set_shortcut (_next_bookmark_action, "editor_edit:next_bookmark"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1810 shortcut_manager::set_shortcut (_previous_bookmark_action, "editor_edit:previous_bookmark"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1811 shortcut_manager::set_shortcut (_remove_bookmark_action, "editor_edit:remove_bookmark"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1812 shortcut_manager::set_shortcut (_preferences_action, "editor_edit:preferences"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1813 shortcut_manager::set_shortcut (_styles_preferences_action, "editor_edit:styles_preferences"); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
1814 |
19439
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1815 shortcut_manager::set_shortcut (_conv_eol_windows_action, "editor_edit:conv_eol_winows"); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1816 shortcut_manager::set_shortcut (_conv_eol_unix_action, "editor_edit:conv_eol_unix"); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1817 shortcut_manager::set_shortcut (_conv_eol_mac_action, "editor_edit:conv_eol_mac"); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19438
diff
changeset
|
1818 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1819 // View menu |
19438
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1820 shortcut_manager::set_shortcut (_show_linenum_action, "editor_view:show_line_numbers"); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1821 shortcut_manager::set_shortcut (_show_whitespace_action, "editor_view:show_white_spaces"); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1822 shortcut_manager::set_shortcut (_show_eol_action, "editor_view:show_eol_chars"); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1823 shortcut_manager::set_shortcut (_show_indguide_action, "editor_view:show_ind_guides"); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1824 shortcut_manager::set_shortcut (_show_longline_action, "editor_view:show_long_line"); |
18840
03edfcd943db
fix setting shortcuts for the view menu in the editor
Torsten <ttl@justmail.de>
parents:
18839
diff
changeset
|
1825 shortcut_manager::set_shortcut (_zoom_in_action, "editor_view:zoom_in"); |
03edfcd943db
fix setting shortcuts for the view menu in the editor
Torsten <ttl@justmail.de>
parents:
18839
diff
changeset
|
1826 shortcut_manager::set_shortcut (_zoom_out_action, "editor_view:zoom_out"); |
03edfcd943db
fix setting shortcuts for the view menu in the editor
Torsten <ttl@justmail.de>
parents:
18839
diff
changeset
|
1827 shortcut_manager::set_shortcut (_zoom_normal_action, "editor_view:zoom_normal"); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
1828 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1829 // Debug menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1830 shortcut_manager::set_shortcut (_toggle_breakpoint_action, "editor_debug:toggle_breakpoint"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1831 shortcut_manager::set_shortcut (_next_breakpoint_action, "editor_debug:next_breakpoint"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1832 shortcut_manager::set_shortcut (_previous_bookmark_action, "editor_debug:previous_breakpoint"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1833 shortcut_manager::set_shortcut (_remove_all_breakpoints_action, "editor_debug:remove_breakpoints"); |
18772
a827fc5fe59d
handle actions from the editors file and edit menu via the shortcut manager
Torsten <ttl@justmail.de>
parents:
18759
diff
changeset
|
1834 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1835 // Run menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1836 shortcut_manager::set_shortcut (_run_action, "editor_run:run_file"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1837 shortcut_manager::set_shortcut (_run_selection_action, "editor_run:run_selection"); |
18655
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1838 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1839 // Help menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1840 shortcut_manager::set_shortcut (_context_help_action, "editor_help:help_keyword"); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1841 shortcut_manager::set_shortcut (_context_doc_action, "editor_help:doc_keyword"); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1842 |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1843 } |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1844 |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1845 void |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1846 file_editor::check_actions () |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1847 { |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1848 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
|
1849 |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
1850 _edit_cmd_menu->setEnabled (have_tabs); |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
1851 _edit_fmt_menu->setEnabled (have_tabs); |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1852 _edit_nav_menu->setEnabled (have_tabs); |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
1853 |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1854 _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
|
1855 _uncomment_selection_action->setEnabled (have_tabs); |
18345
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
1856 _indent_selection_action->setEnabled (have_tabs); |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
1857 _unindent_selection_action->setEnabled (have_tabs); |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18319
diff
changeset
|
1858 |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1859 _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
|
1860 _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
|
1861 _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
|
1862 |
19438
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19277
diff
changeset
|
1863 _view_editor_menu->setEnabled (have_tabs); |
18655
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1864 _zoom_in_action->setEnabled (have_tabs); |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1865 _zoom_out_action->setEnabled (have_tabs); |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1866 _zoom_normal_action->setEnabled (have_tabs); |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18640
diff
changeset
|
1867 |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1868 _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
|
1869 _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
|
1870 _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
|
1871 |
18820
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18811
diff
changeset
|
1872 _edit_function_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
|
1873 _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
|
1874 _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
|
1875 _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
|
1876 _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
|
1877 _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
|
1878 |
18811
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18806
diff
changeset
|
1879 _selectall_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
|
1880 } |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1881 |
18467
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1882 // empty_script determines whether we have to create an empty script |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1883 // 1. At startup, when the editor has to be (really) visible |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1884 // (Here we can not use the visibility changed signal) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1885 // 2. When the editor becomes visible when octave is running |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1886 void |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1887 file_editor::empty_script (bool startup, bool visible) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1888 { |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1889 bool real_visible; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1890 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1891 if (startup) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1892 real_visible = isVisible (); |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1893 else |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1894 real_visible = visible; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1895 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1896 if (! real_visible || _tab_widget->count () > 0) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1897 return; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1898 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1899 if (startup && ! isFloating ()) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1900 { |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1901 // check is editor is really visible or hidden between tabbed widgets |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1902 QList<QTabBar *> tab_list = main_win ()->findChildren<QTabBar *>(); |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1903 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1904 bool in_tab = false; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1905 int i = 0; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1906 while ((i < tab_list.count ()) && (! in_tab)) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1907 { |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1908 QTabBar *tab = tab_list.at (i); |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1909 i++; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1910 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1911 int j = 0; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1912 while ((j < tab->count ()) && (! in_tab)) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1913 { |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1914 // check all tabs for the editor |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1915 if (tab->tabText (j) == windowTitle ()) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1916 { |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1917 // editor is in this tab widget |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1918 in_tab = true; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1919 int top = tab->currentIndex (); |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1920 if (top > -1 && tab->tabText (top) == windowTitle ()) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1921 real_visible = true; // and is the current tab |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1922 else |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1923 return; // not current tab -> not visible |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1924 } |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1925 j++; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1926 } |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1927 } |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1928 } |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1929 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1930 request_new_file (""); |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1931 } |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1932 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1933 // This slot is a reimplementation of the virtual slot in octave_dock_widget. |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1934 // We need this for creating an empty script when the editor has no open files |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1935 // and is made visible |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1936 void |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1937 file_editor::handle_visibility (bool visible) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1938 { |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1939 empty_script (false, visible); |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1940 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1941 if (visible && ! isFloating ()) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1942 focus (); |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18413
diff
changeset
|
1943 } |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1944 |
18806
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1945 void |
18843
02b75b57ed80
clean up some compiler warnings
Torsten <ttl@justmail.de>
parents:
18842
diff
changeset
|
1946 file_editor::dragEnterEvent (QDragEnterEvent *e) |
18806
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1947 { |
18843
02b75b57ed80
clean up some compiler warnings
Torsten <ttl@justmail.de>
parents:
18842
diff
changeset
|
1948 if (e->mimeData ()->hasUrls ()) |
18806
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1949 { |
18843
02b75b57ed80
clean up some compiler warnings
Torsten <ttl@justmail.de>
parents:
18842
diff
changeset
|
1950 e->acceptProposedAction(); |
18806
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1951 } |
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1952 } |
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1953 |
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1954 void |
18843
02b75b57ed80
clean up some compiler warnings
Torsten <ttl@justmail.de>
parents:
18842
diff
changeset
|
1955 file_editor::dropEvent (QDropEvent *e) |
18806
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1956 { |
18843
02b75b57ed80
clean up some compiler warnings
Torsten <ttl@justmail.de>
parents:
18842
diff
changeset
|
1957 if (e->mimeData ()->hasUrls ()) |
18806
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1958 { |
18843
02b75b57ed80
clean up some compiler warnings
Torsten <ttl@justmail.de>
parents:
18842
diff
changeset
|
1959 foreach (QUrl url, e->mimeData ()->urls ()) |
18806
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1960 { |
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1961 request_open_file (url.toLocalFile ()); |
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1962 } |
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1963 } |
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1964 } |
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18772
diff
changeset
|
1965 |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15861
diff
changeset
|
1966 #endif |