Mercurial > octave
annotate libgui/src/m-editor/file-editor.cc @ 23321:ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
* file-editor.cc (file_editor::construct): call new method create_context_menu
of the tab bar for initializing the context menu with the close actions;
(file_editor_tab_bar::file_editor_tab_bar): create empty context menu;
(file_editor_tab_bar::~file_editor_tab_bar): delete context menu;
(file_editor_tab_bar::create_context_menu): new method for adding actions of
the file editor into the new context menu;
(file_editor_tab_bar::mousePressEvent): check, whether click was into a tab,
then get the mouse button and click type, finally do the desired action
including showing the new context menu
* file-editor.h: new method create_context_menu and new menu _context_menu
in file_editor_tab_bar
author | Torsten <mttl@mailbox.org> |
---|---|
date | Tue, 21 Mar 2017 20:25:26 +0100 |
parents | fb495c47e82d |
children | 7332287221a9 |
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 |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23178
diff
changeset
|
3 Copyright (C) 2011-2017 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 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22737
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22737
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22737
diff
changeset
|
10 (at your option) any later version. |
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22737
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22737
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22737
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22737
diff
changeset
|
15 GNU General Public License for more details. |
15204
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 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21650
diff
changeset
|
23 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
24 # include "config.h" |
15286
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 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21650
diff
changeset
|
27 #if defined (HAVE_QSCINTILLA) |
15873
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" |
18611
086093fbdc1a
first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
18575
diff
changeset
|
31 #include "shortcut-manager.h" |
086093fbdc1a
first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
18575
diff
changeset
|
32 |
13501 | 33 #include <QApplication> |
34 #include <QFile> | |
22250
2fd4f1a3f4a8
allow building with Qt5 (bug #40252)
John W. Eaton <jwe@octave.org>
parents:
22179
diff
changeset
|
35 #include <QFileDialog> |
13584 | 36 #include <QFont> |
22250
2fd4f1a3f4a8
allow building with Qt5 (bug #40252)
John W. Eaton <jwe@octave.org>
parents:
22179
diff
changeset
|
37 #include <QInputDialog> |
13501 | 38 #include <QMessageBox> |
22250
2fd4f1a3f4a8
allow building with Qt5 (bug #40252)
John W. Eaton <jwe@octave.org>
parents:
22179
diff
changeset
|
39 #include <QMimeData> |
2fd4f1a3f4a8
allow building with Qt5 (bug #40252)
John W. Eaton <jwe@octave.org>
parents:
22179
diff
changeset
|
40 #include <QProcess> |
13501 | 41 #include <QStyle> |
22250
2fd4f1a3f4a8
allow building with Qt5 (bug #40252)
John W. Eaton <jwe@octave.org>
parents:
22179
diff
changeset
|
42 #include <QTabBar> |
13501 | 43 #include <QTextStream> |
22250
2fd4f1a3f4a8
allow building with Qt5 (bug #40252)
John W. Eaton <jwe@octave.org>
parents:
22179
diff
changeset
|
44 #include <QVBoxLayout> |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
45 #include <Qsci/qscicommandset.h> |
13501 | 46 |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
47 #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
|
48 #include "utils.h" |
18545
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
49 #include "main-window.h" |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
50 #include <oct-map.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
|
51 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
52 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
|
53 : file_editor_interface (p) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
54 { |
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
|
55 // 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
|
56 // 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
|
57 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
|
58 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
59 // set action that are later added by the main window to null, |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
60 // preventing access to them when they are still undefined |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
61 _undo_action = 0; |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
62 _copy_action = 0; |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
63 _paste_action = 0; |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
64 _selectall_action = 0; |
23204
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
65 _closed = false; |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
66 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
67 construct (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
68 |
22169
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
69 // actions that should also be available in the find dialog |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
70 _fetab_actions << _find_next_action; |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
71 _fetab_actions << _find_previous_action; |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
72 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
73 setVisible (false); |
23070
bef714f45999
maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
74 setAcceptDrops (true); |
18651
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18624
diff
changeset
|
75 |
20793
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
76 _file_encoding = QString (); // for selecting an encoding in open dialog |
13501 | 77 } |
78 | |
16558 | 79 file_editor::~file_editor (void) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
80 { |
19411
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19314
diff
changeset
|
81 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:
19314
diff
changeset
|
82 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:
19314
diff
changeset
|
83 } |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19314
diff
changeset
|
84 |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19314
diff
changeset
|
85 bool |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
86 file_editor::check_closing (void) |
19411
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19314
diff
changeset
|
87 { |
23204
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
88 // When the application or the editor is closing and the user wants to close |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
89 // all files in the latter case all editor tabs are checked whether |
21054
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
90 // they need to be saved. During these ckecked the tabs are not closed |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
91 // since the user might cancel closing octave during one of these saving |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
92 // dialogs. Therefore, saving the session for restoring at next start |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
93 // is not done before the application is definitely closing |
16558 | 94 |
20713
2469d78a1d8b
Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents:
20705
diff
changeset
|
95 // Have all file editor tabs signal what their filenames are. |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
96 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
|
97 emit fetab_file_name_query (0); |
16558 | 98 |
21054
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
99 // Save all tabs with confirmation. |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
100 file_editor_tab::reset_cancel (); |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
101 emit fetab_check_modified_file (); |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
102 |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
103 // If there was a cancellation, make the already saved/discarded tabs |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
104 // recovering from the exit by removing the read-only state and by |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
105 // recovering the debugger breakpoints. Finally return false in order to |
23204
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
106 // cancel closing the application or the editor |
21054
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
107 if (file_editor_tab::was_cancelled ()) |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
108 { |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
109 emit fetab_recover_from_exit (); |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
110 return false; |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
111 } |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
112 |
23204
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
113 // Here, the application or the editor will be closed -> store the session |
21054
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
114 |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
115 // Save open files for restoring in next session; this only is possible |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
116 QSettings *settings = resource_manager::get_settings (); |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
117 |
20713
2469d78a1d8b
Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents:
20705
diff
changeset
|
118 // save filenames (even if last session will not be restored next time) |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
119 // together with encoding and the tab index |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
120 QStringList fetFileNames; |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
121 QStringList fet_encodings; |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
122 QStringList fet_index; |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
123 |
21054
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
124 // save all open tabs before they are definitely closed |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
125 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
|
126 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
|
127 { |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
128 QString file_name = p->first; // get file name of tab |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20814
diff
changeset
|
129 if (! file_name.isEmpty ()) // do not append unnamed files |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
130 { |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
131 fetFileNames.append (file_name); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
132 fet_encodings.append (editor_tab_map[file_name].encoding); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
133 QString index; |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
134 fet_index.append (index.setNum |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
135 (_tab_widget->indexOf (editor_tab_map[file_name].fet_ID))); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
136 } |
16740
cfefcc2a4dae
do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents:
16739
diff
changeset
|
137 } |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
138 |
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
|
139 settings->setValue ("editor/savedSessionTabs", fetFileNames); |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
140 settings->setValue ("editor/saved_session_encodings", fet_encodings); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
141 settings->setValue ("editor/saved_session_tab_index", fet_index); |
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
|
142 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
|
143 |
21054
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
144 // Finally close all the tabs and return indication that we can exit |
23204
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
145 // the application or close the editor |
23199
cbefc3f49439
fix removing editor tabs on application exit
Torsten <mttl@mailbox.org>
parents:
23180
diff
changeset
|
146 for (int i = _tab_widget->count () - 1; i >= 0; i--) |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
147 { |
23199
cbefc3f49439
fix removing editor tabs on application exit
Torsten <mttl@mailbox.org>
parents:
23180
diff
changeset
|
148 // backwards loop since _tab_widget->count () changes during the loop |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
149 delete _tab_widget->widget (i); |
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
150 _tab_widget->removeTab (i); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
151 } |
16638
3c2e457eeb72
ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents:
16637
diff
changeset
|
152 |
19411
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19314
diff
changeset
|
153 return true; |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
154 } |
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
155 |
16457
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
156 void |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
157 file_editor::focus (void) |
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
158 { |
19427
3c038da18218
cleanup of focus function in gui editor
Torsten <ttl@justmail.de>
parents:
19411
diff
changeset
|
159 octave_dock_widget::focus (); |
16457
10edb6f1ae98
improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
160 |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
161 // set focus to current tab |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
162 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
|
163 if (fileEditorTab) |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
164 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
|
165 } |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
166 |
19803
415864f5b85f
communicating actual working directory to the editor (#44298)
Torsten <ttl@justmail.de>
parents:
19739
diff
changeset
|
167 void |
23177
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
168 file_editor::set_focus (QWidget *fet) |
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
169 { |
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
170 octave_dock_widget::focus (); |
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
171 |
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
172 // set focus to desired tab |
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
173 if (fet) |
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
174 _tab_widget->setCurrentWidget (fet); |
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
175 } |
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
176 |
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
177 void |
19803
415864f5b85f
communicating actual working directory to the editor (#44298)
Torsten <ttl@justmail.de>
parents:
19739
diff
changeset
|
178 file_editor::update_octave_directory (const QString& dir) |
415864f5b85f
communicating actual working directory to the editor (#44298)
Torsten <ttl@justmail.de>
parents:
19739
diff
changeset
|
179 { |
415864f5b85f
communicating actual working directory to the editor (#44298)
Torsten <ttl@justmail.de>
parents:
19739
diff
changeset
|
180 ced = dir; |
415864f5b85f
communicating actual working directory to the editor (#44298)
Torsten <ttl@justmail.de>
parents:
19739
diff
changeset
|
181 emit fetab_set_directory (ced); // for save dialog |
415864f5b85f
communicating actual working directory to the editor (#44298)
Torsten <ttl@justmail.de>
parents:
19739
diff
changeset
|
182 } |
415864f5b85f
communicating actual working directory to the editor (#44298)
Torsten <ttl@justmail.de>
parents:
19739
diff
changeset
|
183 |
14795
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
184 QMenu * |
16558 | 185 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
|
186 { |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
187 return _debug_menu; |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
188 } |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
189 |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
190 QToolBar * |
16558 | 191 file_editor::toolbar (void) |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
192 { |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
193 return _tool_bar; |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
194 } |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
195 |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
196 void |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
197 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
|
198 { |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
199 _run_action->setEnabled (false); |
19822
448ca112a5af
prevent conflicts between run-file and debug-continue action in gui
Torsten <ttl@justmail.de>
parents:
19804
diff
changeset
|
200 _run_action->setShortcut (QKeySequence ()); |
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
|
201 } |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
202 |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
203 void |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
204 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
|
205 { |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
206 _run_action->setEnabled (true); |
19822
448ca112a5af
prevent conflicts between run-file and debug-continue action in gui
Torsten <ttl@justmail.de>
parents:
19804
diff
changeset
|
207 shortcut_manager::set_shortcut (_run_action, "editor_run:run_file"); |
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
|
208 } |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
209 |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
210 void |
16452
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16443
diff
changeset
|
211 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
|
212 { |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
213 // 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
|
214 // 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
|
215 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
|
216 return; |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
217 |
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
|
218 // 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
|
219 // 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
|
220 // 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
|
221 |
21310
fc6a9bd59094
backout changeset e8c3590da9ff
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21301
diff
changeset
|
222 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
|
223 if (fileEditorTab) |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
224 { |
15982
131d40cd805b
gui: cleanup some string constants for translations
Torsten <ttl@justmail.de>
parents:
15980
diff
changeset
|
225 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
|
226 fileEditorTab->new_file (commands); // title is updated here |
19427
3c038da18218
cleanup of focus function in gui editor
Torsten <ttl@justmail.de>
parents:
19411
diff
changeset
|
227 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
|
228 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
229 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
230 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
231 void |
16566 | 232 file_editor::request_new_script (const QString& commands) |
233 { | |
234 request_new_file (commands); | |
235 } | |
236 | |
237 void | |
17901
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
238 file_editor::request_new_function (bool) |
16566 | 239 { |
17901
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
240 bool ok; |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
241 // get the name of the new function |
21568
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
21565
diff
changeset
|
242 QString new_name = QInputDialog::getText (this, tr ("New Function"), |
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
21565
diff
changeset
|
243 tr ("New function name:\n"), QLineEdit::Normal, "", &ok); |
17901
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
244 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
|
245 { |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
246 // 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
|
247 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
|
248 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
|
249 // 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
|
250 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
|
251 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
|
252 { |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
253 // 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
|
254 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
|
255 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
|
256 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
|
257 } |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
258 // 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
|
259 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
|
260 } |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
261 } |
16566 | 262 |
17901
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
263 void |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
264 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
|
265 { |
2c241092b47b
use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents:
17790
diff
changeset
|
266 // 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
|
267 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
|
268 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
|
269 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
|
270 this, SLOT (restore_create_file_setting ())); |
16566 | 271 } |
272 | |
273 void | |
16558 | 274 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
|
275 { |
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
|
276 // 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
|
277 // 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
|
278 // 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
|
279 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
280 // Create a NonModal message. |
16558 | 281 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
|
282 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
|
283 |
6bd74153c3ae
no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents:
16881
diff
changeset
|
284 // 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
|
285 // 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
|
286 // it had/has no effect on Windows, though) |
23070
bef714f45999
maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
287 fileDialog->setOption (QFileDialog::DontUseNativeDialog, true); |
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
|
288 |
20793
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
289 // define a new grid layout with the extra elements |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
290 QGridLayout *extra = new QGridLayout (fileDialog); |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
291 QFrame *separator = new QFrame (fileDialog); |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
292 separator->setFrameShape (QFrame::HLine); // horizontal line as separator |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
293 separator->setFrameStyle (QFrame::Sunken); |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
294 |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
295 // combo box for encoding |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
296 QLabel *label_enc = new QLabel (tr ("File Encoding:")); |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
297 QComboBox *combo_enc = new QComboBox (); |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
298 resource_manager::combo_encoding (combo_enc); |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
299 _file_encoding = QString (); // default, no special encoding |
20793
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
300 |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
301 // track changes in the combo boxes |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
302 connect (combo_enc, SIGNAL (currentIndexChanged (QString)), |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
303 this, SLOT (handle_combo_enc_current_index (QString))); |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
304 |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
305 // build the extra grid layout |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
306 extra->addWidget (separator,0,0,1,3); |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
307 extra->addWidget (label_enc,1,0); |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
308 extra->addWidget (combo_enc,1,1); |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
309 extra->addItem (new QSpacerItem (1,20,QSizePolicy::Expanding, |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
310 QSizePolicy::Fixed), 1,2); |
20793
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
311 |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
312 // and add the extra grid layout to the dialog's layout |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
313 QGridLayout *dialog_layout = dynamic_cast<QGridLayout*> (fileDialog->layout ()); |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
314 dialog_layout->addLayout (extra,dialog_layout->rowCount (),0, |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
315 1,dialog_layout->columnCount ()); |
20793
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
316 |
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
|
317 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
|
318 fileDialog->setViewMode (QFileDialog::Detail); |
18521
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18486
diff
changeset
|
319 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
|
320 fileDialog->setDirectory (ced); |
16558 | 321 |
18521
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18486
diff
changeset
|
322 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:
18486
diff
changeset
|
323 this, SLOT (request_open_files (const QStringList&))); |
16558 | 324 |
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
|
325 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
|
326 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
|
327 fileDialog->show (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
328 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
329 |
20793
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
330 void |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
331 file_editor::handle_combo_enc_current_index (QString new_encoding) |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
332 { |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
333 _file_encoding = new_encoding; |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
334 } |
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
335 |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
336 // 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
|
337 QWidget * |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
338 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
|
339 { |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
340 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
|
341 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
342 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
|
343 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
|
344 { |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
345 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
|
346 |
21565
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
347 if (same_file (file.toStdString (), tab_file.toStdString ()) |
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
348 || file == tab_file) // needed as same_file ("","") is false. |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
349 { |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
350 retval = p->second.fet_ID; |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
351 break; |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
352 } |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
353 } |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
354 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
355 return retval; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
356 } |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
357 |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
358 bool |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
359 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
|
360 { |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
361 // 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
|
362 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
|
363 |
19916
6049bdfa8d56
make notepad++ the custom default editor in windows
Torsten <ttl@justmail.de>
parents:
19899
diff
changeset
|
364 if (settings->value ("useCustomFileEditor",false).toBool ()) |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
365 { |
20086
23fb65b45d8c
do not call custom editor at startup and when debugging (bug #44701)
Torsten <ttl@justmail.de>
parents:
20002
diff
changeset
|
366 if (line > -1) // check for a specific line (debugging) |
23fb65b45d8c
do not call custom editor at startup and when debugging (bug #44701)
Torsten <ttl@justmail.de>
parents:
20002
diff
changeset
|
367 return true; // yes: do ont open a file in external editor |
23fb65b45d8c
do not call custom editor at startup and when debugging (bug #44701)
Torsten <ttl@justmail.de>
parents:
20002
diff
changeset
|
368 |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
369 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
|
370 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
|
371 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
|
372 |
18983
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
18969
diff
changeset
|
373 bool started_ok = QProcess::startDetached (editor); |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
18969
diff
changeset
|
374 |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
18969
diff
changeset
|
375 if (started_ok != true) |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
18969
diff
changeset
|
376 { |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
18969
diff
changeset
|
377 QMessageBox *msgBox |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
18969
diff
changeset
|
378 = new QMessageBox (QMessageBox::Critical, |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
18969
diff
changeset
|
379 tr ("Octave Editor"), |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
18969
diff
changeset
|
380 tr ("Could not start custom file editor\n%1"). |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
18969
diff
changeset
|
381 arg (editor), |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
18969
diff
changeset
|
382 QMessageBox::Ok, this); |
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
18969
diff
changeset
|
383 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
384 msgBox->setWindowModality (Qt::NonModal); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
385 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
386 msgBox->show (); |
18983
724fc0a9eeb1
gui: notify user if custom editor failed to start
John Donoghue
parents:
18969
diff
changeset
|
387 } |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
388 |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
389 if (line < 0 && ! file_name.isEmpty ()) |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
390 handle_mru_add_file (QFileInfo (file_name).canonicalFilePath (), |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
391 QString ()); |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
392 |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
393 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
|
394 } |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
395 |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
396 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
|
397 } |
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
398 |
18545
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
399 bool |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
400 file_editor::is_editor_console_tabbed () |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
401 { |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
402 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:
18472
diff
changeset
|
403 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:
18472
diff
changeset
|
404 QDockWidget *console = |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
405 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:
18472
diff
changeset
|
406 |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
407 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:
18472
diff
changeset
|
408 { |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
409 if (w_list.at (i) == console) |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
410 return true; |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
411 } |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
412 |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
413 return false; |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
414 } |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
415 |
20793
f7b0572fff6e
allow to select an encoding when opening a file
Torsten <ttl@justmail.de>
parents:
20754
diff
changeset
|
416 // The following slot is called after files have been selected in the |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
417 // open file dialog, possibly with a new selected encoding stored in |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
418 // _file_encoding |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
419 void |
18521
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18486
diff
changeset
|
420 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:
18486
diff
changeset
|
421 { |
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18486
diff
changeset
|
422 for (int i = 0; i < open_file_names.count (); i++) |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
423 request_open_file (open_file_names.at (i), _file_encoding); |
18521
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18486
diff
changeset
|
424 } |
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18486
diff
changeset
|
425 |
21158
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
426 // Open a file, if not already open, and mark the current execution location |
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
427 // and/or a breakpoint with condition cond. |
18521
713193ffc8c4
allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents:
18486
diff
changeset
|
428 void |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
429 file_editor::request_open_file (const QString& openFileName, |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
430 const QString& encoding, |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
431 int line, bool debug_pointer, |
21158
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
432 bool breakpoint_marker, bool insert, |
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
433 const QString& cond) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
434 { |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
435 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
|
436 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
|
437 |
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
|
438 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
|
439 { |
17941
9799a996b2c1
* file-editor.cc (request_open_file): new edit tab when file name is empty
Torsten <ttl@justmail.de>
parents:
17935
diff
changeset
|
440 // 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
|
441 // 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
|
442 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
|
443 } |
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
|
444 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
|
445 { |
20713
2469d78a1d8b
Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents:
20705
diff
changeset
|
446 // Have all file editor tabs signal what their filenames are. |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
447 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
|
448 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
|
449 |
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
|
450 // 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
|
451 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
|
452 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
453 if (tab) |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
454 { |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
455 _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
|
456 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
457 if (line > 0) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
458 { |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
459 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
|
460 |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
461 if (debug_pointer) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
462 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
|
463 |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
464 if (breakpoint_marker) |
21158
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
465 emit fetab_do_breakpoint_marker (insert, tab, line, cond); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
466 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
467 |
18545
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
468 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:
18472
diff
changeset
|
469 { |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
470 emit fetab_set_focus (tab); |
19427
3c038da18218
cleanup of focus function in gui editor
Torsten <ttl@justmail.de>
parents:
19411
diff
changeset
|
471 focus (); |
18545
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
472 } |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
473 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
474 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
|
475 { |
21565
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
476 file_editor_tab *fileEditorTab = 0; |
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
477 // Reuse <unnamed> tab if it hasn't yet been modified. |
21650
7c0595c722ca
Remove duplicate menu actions after replacing <unnamed> edit tab (bug #47692).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21578
diff
changeset
|
478 bool reusing = false; |
21565
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
479 tab = find_tab_widget (""); |
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
480 if (tab) |
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
481 { |
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
482 fileEditorTab = static_cast<file_editor_tab *>(tab); |
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
483 if (fileEditorTab->qsci_edit_area ()->isModified ()) |
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
484 fileEditorTab = 0; |
21650
7c0595c722ca
Remove duplicate menu actions after replacing <unnamed> edit tab (bug #47692).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21578
diff
changeset
|
485 else |
7c0595c722ca
Remove duplicate menu actions after replacing <unnamed> edit tab (bug #47692).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21578
diff
changeset
|
486 reusing = true; |
21565
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
487 } |
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
488 |
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
489 // If <unnamed> was absent or modified, create a new tab. |
22737
7abc25e6206a
maint: Clean up code base to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
22411
diff
changeset
|
490 if (! fileEditorTab) |
21565
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
491 fileEditorTab = new file_editor_tab (); |
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
492 |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
493 if (fileEditorTab) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
494 { |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
495 fileEditorTab->set_encoding (encoding); |
16558 | 496 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
|
497 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
|
498 { |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
499 // 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
|
500 // with full or short name. |
22737
7abc25e6206a
maint: Clean up code base to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
22411
diff
changeset
|
501 if (! reusing) |
21650
7c0595c722ca
Remove duplicate menu actions after replacing <unnamed> edit tab (bug #47692).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21578
diff
changeset
|
502 add_file_editor_tab (fileEditorTab, ""); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
503 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
|
504 // 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
|
505 QFileInfo file_info = QFileInfo (openFileName); |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
506 handle_mru_add_file (file_info.canonicalFilePath (), |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
507 encoding); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
508 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
509 if (line > 0) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
510 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
511 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
|
512 |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
513 if (debug_pointer) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
514 emit fetab_insert_debugger_pointer (fileEditorTab, |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
515 line); |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
516 if (breakpoint_marker) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
517 emit fetab_do_breakpoint_marker (insert, fileEditorTab, |
21158
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
518 line, cond); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
519 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
520 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
521 else |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
522 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
523 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
|
524 |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
525 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
|
526 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
527 // File not readable: |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
528 // 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
|
529 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
|
530 = new QMessageBox (QMessageBox::Critical, |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
531 tr ("Octave Editor"), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
532 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
|
533 arg (openFileName).arg (result), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
534 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
|
535 |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
536 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
|
537 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
|
538 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
|
539 } |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
540 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
|
541 { |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
542 // File does not exist, should it be created? |
19314
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
543 bool create_file = true; |
17740
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
544 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
|
545 QSettings *settings = resource_manager::get_settings (); |
19314
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
546 |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20814
diff
changeset
|
547 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
|
548 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
549 msgBox = new QMessageBox (QMessageBox::Question, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
550 tr ("Octave Editor"), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
551 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
|
552 "Do you want to create it?").arg (openFileName), |
19314
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
553 QMessageBox::NoButton,0); |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
554 QPushButton *create_button = |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
555 msgBox->addButton (tr ("Create"), QMessageBox::YesRole); |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
556 msgBox->addButton (tr ("Cancel"), QMessageBox::RejectRole); |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
557 msgBox->setDefaultButton (create_button); |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
558 msgBox->exec (); |
16558 | 559 |
19314
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
560 QAbstractButton *clicked_button = msgBox->clickedButton (); |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
561 if (clicked_button != create_button) |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
562 create_file = false; |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
563 |
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
564 delete msgBox; |
17740
e6ed77b75aec
new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents:
17736
diff
changeset
|
565 } |
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
|
566 |
19314
2b708273548d
button order in dialog for creating a non-existing file (bug #43537)
Torsten <ttl@justmail.de>
parents:
19247
diff
changeset
|
567 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
|
568 { |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
569 // 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
|
570 QFile file (openFileName); |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20814
diff
changeset
|
571 if (! file.open (QIODevice::WriteOnly)) |
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
|
572 { |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
573 // 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
|
574 msgBox = new QMessageBox (QMessageBox::Critical, |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
575 tr ("Octave Editor"), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
576 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
|
577 arg (openFileName).arg (file.errorString ()), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
578 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
|
579 |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
580 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
|
581 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
|
582 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
|
583 } |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
584 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
|
585 { |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
586 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
|
587 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
|
588 } |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
589 } |
6a2e483125dd
editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents:
17706
diff
changeset
|
590 } |
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
|
591 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
592 } |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
593 |
18545
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
594 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:
18472
diff
changeset
|
595 { |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
596 // really show editor and the current editor tab |
19427
3c038da18218
cleanup of focus function in gui editor
Torsten <ttl@justmail.de>
parents:
19411
diff
changeset
|
597 focus (); |
18545
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
598 emit file_loaded_signal (); |
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
599 } |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
600 } |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
601 } |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
602 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
603 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
604 // 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
|
605 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
|
606 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
|
607 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
608 if (action) |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
609 { |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
610 request_open_file (action->data ().toStringList ().at (0), |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
611 action->data ().toStringList ().at (1)); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
612 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
613 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
614 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
615 void |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
616 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
|
617 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
|
618 { |
20713
2469d78a1d8b
Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents:
20705
diff
changeset
|
619 // Have all file editor tabs signal what their filenames are. |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
620 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
|
621 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
|
622 |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
623 // 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
|
624 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
|
625 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
626 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
|
627 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
628 // 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
|
629 // 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
|
630 // 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
|
631 // 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
|
632 // 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
|
633 // 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
|
634 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
635 // Create a NonModal message about error. |
16558 | 636 QMessageBox *msgBox |
637 = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"), | |
638 tr ("File not saved! A file with the selected name\n%1\n" | |
639 "is already open in the editor"). | |
640 arg (saveFileName), | |
641 QMessageBox::Ok, 0); | |
642 | |
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
|
643 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
|
644 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
|
645 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
|
646 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
647 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
|
648 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
649 |
16558 | 650 QObject *saveFileObject = sender (); |
651 QWidget *saveFileWidget = 0; | |
652 | |
653 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
|
654 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
655 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
|
656 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
657 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
|
658 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
|
659 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
660 } |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20814
diff
changeset
|
661 if (! saveFileWidget) |
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
|
662 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
663 // Create a NonModal message about error. |
16558 | 664 QMessageBox *msgBox |
665 = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"), | |
18257
cae24b7cfaf4
minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents:
17988
diff
changeset
|
666 tr ("The associated file editor tab has disappeared."), |
16558 | 667 QMessageBox::Ok, 0); |
668 | |
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
|
669 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
|
670 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
|
671 msgBox->show (); |
16558 | 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 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
|
674 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
675 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
676 // 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
|
677 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
|
678 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
679 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
680 void |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
681 file_editor::handle_edit_mfile_request (const QString& fname, |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
682 const QString& ffile, |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
683 const QString& curr_dir, int line) |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
684 { |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
685 // Is it a regular function within the search path? (Call __which__) |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
686 octave_value_list fct = F__which__ (ovl (fname.toStdString ()),0); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
687 octave_map map = fct(0).map_value (); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
688 |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
689 QString type = QString::fromStdString ( |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
690 map.contents ("type").data ()[0].string_value ()); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
691 QString name = QString::fromStdString ( |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
692 map.contents ("name").data ()[0].string_value ()); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
693 |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
694 QString message = QString (); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
695 QString filename = QString (); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
696 |
23070
bef714f45999
maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
697 if (type == QString ("built-in function")) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
698 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
699 // built in function: can't edit |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
700 message = tr ("%1 is a built-in function"); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
701 } |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
702 else if (type.isEmpty ()) |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
703 { |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
704 // function not known to octave -> try directory of edited file |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
705 // get directory |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
706 QDir dir; |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
707 if (ffile.isEmpty ()) |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
708 { |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
709 if (curr_dir.isEmpty ()) |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
710 dir = QDir (ced); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
711 else |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
712 dir = QDir (curr_dir); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
713 } |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
714 else |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
715 dir = QDir (QFileInfo (ffile).canonicalPath ()); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
716 |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
717 // function not known to octave -> try directory of edited file |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
718 QFileInfo file = QFileInfo (dir, fname + ".m"); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
719 |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
720 if (file.exists ()) |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
721 { |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
722 filename = file.canonicalFilePath (); // local file exists |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
723 } |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
724 else |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
725 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
726 // local file does not exist -> try private directory |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
727 file = QFileInfo (ffile); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
728 file = QFileInfo (QDir (file.canonicalPath () + "/private"), |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
729 fname + ".m"); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
730 |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
731 if (file.exists ()) |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
732 { |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
733 filename = file.canonicalFilePath (); // private function exists |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
734 } |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
735 else |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
736 { |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
737 message = tr ("Can not find function %1"); // no file found |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
738 } |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
739 } |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
740 } |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
741 |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
742 if (! message.isEmpty ()) |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
743 { |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
744 QMessageBox *msgBox |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
745 = new QMessageBox (QMessageBox::Critical, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
746 tr ("Octave Editor"), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
747 message.arg (name), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
748 QMessageBox::Ok, this); |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
749 |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
750 msgBox->setWindowModality (Qt::NonModal); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
751 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
752 msgBox->show (); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
753 return; |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
754 } |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
755 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
756 if (filename.isEmpty ()) |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
757 filename = QString::fromStdString ( |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
758 map.contents ("file").data ()[0].string_value ()); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
759 |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
760 if (! filename.endsWith (".m")) |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
761 filename.append (".m"); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
762 |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
763 request_open_file (filename, QString (), line); // default encoding |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
764 } |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
765 |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
766 void |
16558 | 767 file_editor::handle_insert_debugger_pointer_request (const QString& file, |
768 int line) | |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
769 { |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
770 request_open_file (file, QString (), line, true); // default encoding |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
771 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
772 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
773 void |
16558 | 774 file_editor::handle_delete_debugger_pointer_request (const QString& file, |
775 int line) | |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
776 { |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
777 if (! file.isEmpty ()) |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
778 { |
20713
2469d78a1d8b
Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents:
20705
diff
changeset
|
779 // Have all file editor tabs signal what their filenames are. |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
780 editor_tab_map.clear (); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
781 emit fetab_file_name_query (0); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
782 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
783 // 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
|
784 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
|
785 |
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
786 if (tab) |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
787 { |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
788 _tab_widget->setCurrentWidget (tab); |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
789 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
790 if (line > 0) |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16546
diff
changeset
|
791 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
|
792 |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
793 emit fetab_set_focus (tab); |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
794 } |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
795 } |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
796 } |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
797 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
798 void |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
799 file_editor::handle_update_breakpoint_marker_request (bool insert, |
16558 | 800 const QString& file, |
21158
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
801 int line, |
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
802 const QString& cond) |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
803 { |
21158
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
804 request_open_file (file, QString (), line, false, true, insert, cond); |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
805 } |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
806 |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
807 void |
16399
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
808 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
|
809 { |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
810 request_open_file (file); |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
811 } |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
812 |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
813 void |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
814 file_editor::do_undo () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
815 { |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
816 if (editor_tab_has_focus ()) |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
817 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
818 QsciScintillaBase::SCI_UNDO); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
819 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
820 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
821 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
822 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
|
823 { |
18686
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18685
diff
changeset
|
824 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18685
diff
changeset
|
825 QsciScintillaBase::SCI_REDO); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
826 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
827 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
828 void |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
829 file_editor::copyClipboard () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
830 { |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
831 if (editor_tab_has_focus ()) |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
832 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
833 QsciScintillaBase::SCI_COPY); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
834 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
835 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
836 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
837 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
|
838 { |
18686
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18685
diff
changeset
|
839 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
74ef7fed8b9a
simplify some code by using scintilla internal commands
Torsten <ttl@justmail.de>
parents:
18685
diff
changeset
|
840 QsciScintillaBase::SCI_CUT); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
841 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
842 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
843 void |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
844 file_editor::pasteClipboard () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
845 { |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
846 if (editor_tab_has_focus ()) |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
847 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
848 QsciScintillaBase::SCI_PASTE); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
849 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
850 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
851 void |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
852 file_editor::selectAll () |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18551
diff
changeset
|
853 { |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
854 if (editor_tab_has_focus ()) |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
855 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
856 QsciScintillaBase::SCI_SELECTALL); |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18551
diff
changeset
|
857 } |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18551
diff
changeset
|
858 |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
18551
diff
changeset
|
859 void |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
860 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
|
861 { |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
862 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
|
863 } |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
864 void |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
865 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
|
866 { |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
867 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
|
868 } |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
869 |
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
870 void |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
871 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
|
872 { |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
873 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
|
874 } |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
875 |
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
876 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
877 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
|
878 { |
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
|
879 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
|
880 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
881 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
882 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
883 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
|
884 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
885 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
|
886 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
887 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
888 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
889 file_editor::request_print_file (bool) |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
890 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
891 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
|
892 } |
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
893 |
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
894 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
895 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
|
896 { |
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
|
897 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
|
898 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
899 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
900 void |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
901 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
|
902 { |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
903 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
|
904 } |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
905 |
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
906 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
907 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
|
908 { |
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
|
909 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
|
910 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
911 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
912 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
913 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
|
914 { |
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
|
915 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
|
916 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
917 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
918 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
919 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
|
920 { |
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
|
921 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
|
922 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
923 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
924 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
925 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
|
926 { |
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
|
927 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
|
928 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
929 |
21578
683a1beee538
maint: Use "FIXME:" for all code blocks needing further attention.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
930 // FIXME: What should this do with conditional breakpoints? |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
931 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
932 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
|
933 { |
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
|
934 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
|
935 } |
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
|
936 |
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
|
937 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
938 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
|
939 { |
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
|
940 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
|
941 } |
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
|
942 |
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
|
943 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
944 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
|
945 { |
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
|
946 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
|
947 } |
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
|
948 |
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
|
949 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
950 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
|
951 { |
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
|
952 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
|
953 } |
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
|
954 |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
955 // slots for Edit->Commands actions |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
956 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
957 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:
18651
diff
changeset
|
958 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
959 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18675
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18665
diff
changeset
|
960 QsciScintillaBase::SCI_DELWORDLEFT); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
961 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
962 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
963 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:
18651
diff
changeset
|
964 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
965 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18675
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18665
diff
changeset
|
966 QsciScintillaBase::SCI_DELWORDRIGHT); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
967 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
968 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
969 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:
18651
diff
changeset
|
970 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
971 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18675
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18665
diff
changeset
|
972 QsciScintillaBase::SCI_DELLINELEFT); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
973 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
974 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
975 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:
18651
diff
changeset
|
976 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
977 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18675
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18665
diff
changeset
|
978 QsciScintillaBase::SCI_DELLINERIGHT); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
979 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
980 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
981 file_editor::request_delete_line (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
982 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
983 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18675
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18665
diff
changeset
|
984 QsciScintillaBase::SCI_LINEDELETE); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
985 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
986 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
987 file_editor::request_copy_line (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
988 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
989 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18675
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18665
diff
changeset
|
990 QsciScintillaBase::SCI_LINECOPY); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
991 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
992 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
993 file_editor::request_cut_line (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
994 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
995 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18675
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18665
diff
changeset
|
996 QsciScintillaBase::SCI_LINECUT); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
997 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
998 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
999 file_editor::request_duplicate_selection (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1000 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1001 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18675
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18665
diff
changeset
|
1002 QsciScintillaBase::SCI_SELECTIONDUPLICATE); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1003 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1004 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1005 file_editor::request_transpose_line (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1006 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1007 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18675
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18665
diff
changeset
|
1008 QsciScintillaBase::SCI_LINETRANSPOSE); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1009 } |
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
|
1010 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1011 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
|
1012 { |
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
|
1013 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
|
1014 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1015 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1016 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
|
1017 { |
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
|
1018 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
|
1019 } |
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
1020 |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1021 // slots for Edit->Format actions |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1022 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1023 file_editor::request_upper_case (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1024 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1025 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18675
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18665
diff
changeset
|
1026 QsciScintillaBase::SCI_UPPERCASE); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1027 } |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1028 void |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1029 file_editor::request_lower_case (bool) |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1030 { |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1031 emit fetab_scintilla_command (_tab_widget->currentWidget (), |
18675
c199304dfb2a
handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents:
18665
diff
changeset
|
1032 QsciScintillaBase::SCI_LOWERCASE); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
1033 } |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
1034 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1035 file_editor::request_indent_selected_text (bool) |
18303
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
1036 { |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
1037 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:
18294
diff
changeset
|
1038 } |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
1039 |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
1040 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1041 file_editor::request_unindent_selected_text (bool) |
18303
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
1042 { |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
1043 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:
18294
diff
changeset
|
1044 } |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
1045 |
19247
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1046 void |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1047 file_editor::request_conv_eol_windows (bool) |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1048 { |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1049 emit fetab_convert_eol (_tab_widget->currentWidget (), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1050 QsciScintilla::EolWindows); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1051 } |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1052 void |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1053 file_editor::request_conv_eol_unix (bool) |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1054 { |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1055 emit fetab_convert_eol (_tab_widget->currentWidget (), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1056 QsciScintilla::EolUnix); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1057 } |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1058 void |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1059 file_editor::request_conv_eol_mac (bool) |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1060 { |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1061 emit fetab_convert_eol (_tab_widget->currentWidget (), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1062 QsciScintilla::EolMac); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1063 } |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1064 |
18303
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
1065 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1066 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
|
1067 { |
22169
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1068 emit fetab_find (_tab_widget->currentWidget (), _fetab_actions); |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1069 } |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1070 |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1071 void |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1072 file_editor::request_find_next (bool) |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1073 { |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1074 emit fetab_find_next (_tab_widget->currentWidget ()); |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1075 } |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1076 |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1077 void |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1078 file_editor::request_find_previous (bool) |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1079 { |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1080 emit fetab_find_previous (_tab_widget->currentWidget ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1081 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1082 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1083 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1084 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
|
1085 { |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
1086 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
|
1087 } |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
1088 |
19629
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1089 void |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1090 file_editor::request_move_match_brace (bool) |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1091 { |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1092 emit fetab_move_match_brace (_tab_widget->currentWidget (), false); |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1093 } |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1094 |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1095 void |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1096 file_editor::request_sel_match_brace (bool) |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1097 { |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1098 emit fetab_move_match_brace (_tab_widget->currentWidget (), true); |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1099 } |
16375
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
1100 |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
1101 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1102 file_editor::request_completion (bool) |
18482
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18460
diff
changeset
|
1103 { |
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18460
diff
changeset
|
1104 emit fetab_completion (_tab_widget->currentWidget ()); |
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18460
diff
changeset
|
1105 } |
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18460
diff
changeset
|
1106 |
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18460
diff
changeset
|
1107 void |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1108 file_editor::handle_mru_add_file (const QString& file_name, |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1109 const QString& encoding) |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1110 { |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1111 int index; |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1112 while ((index = _mru_files.indexOf (file_name)) >= 0) |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1113 { |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1114 _mru_files.removeAt (index); |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1115 _mru_files_encodings.removeAt (index); |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1116 } |
18969
12462638ab20
do not change editors mru list if first entry is actual file (bug #42867)
Torsten <ttl@justmail.de>
parents:
18944
diff
changeset
|
1117 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1118 _mru_files.prepend (file_name); |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1119 _mru_files_encodings.prepend (encoding); |
18969
12462638ab20
do not change editors mru list if first entry is actual file (bug #42867)
Torsten <ttl@justmail.de>
parents:
18944
diff
changeset
|
1120 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1121 mru_menu_update (); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1122 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1123 |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1124 void |
16558 | 1125 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
|
1126 { |
16558 | 1127 int num_files = qMin (_mru_files.size (), int (MaxMRUFiles)); |
1128 | |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1129 // 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
|
1130 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
|
1131 { |
16558 | 1132 QString text = tr ("&%1 %2"). |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1133 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
|
1134 _mru_file_actions[i]->setText (text); |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1135 |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1136 QStringList action_data; |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1137 action_data << _mru_files.at (i) << _mru_files_encodings.at (i); |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1138 _mru_file_actions[i]->setData (action_data); |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1139 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1140 _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
|
1141 } |
16558 | 1142 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1143 // hide unused mru-menu entries |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1144 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
|
1145 _mru_file_actions[j]->setVisible (false); |
16558 | 1146 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1147 // 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
|
1148 while (_mru_files.size () > MaxMRUFiles) |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1149 { |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1150 _mru_files.removeLast (); |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1151 _mru_files_encodings.removeLast (); |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1152 } |
16558 | 1153 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1154 // save actual mru-list in settings |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1155 QSettings *settings = resource_manager::get_settings (); |
16558 | 1156 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1157 settings->setValue ("editor/mru_file_list", _mru_files); |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1158 settings->setValue ("editor/mru_file_encodings", _mru_files_encodings); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1159 settings->sync (); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1160 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1161 |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1162 void |
16307
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
1163 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
|
1164 const QString& tip) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1165 { |
16558 | 1166 QObject *fileEditorTab = sender (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1167 if (fileEditorTab) |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
1168 { |
16558 | 1169 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
|
1170 { |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
1171 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
|
1172 { |
16307
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
1173 _tab_widget->setTabText (i, fname); |
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
1174 _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
|
1175 } |
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
|
1176 } |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
1177 } |
13501 | 1178 } |
1179 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
1180 void |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1181 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
|
1182 { |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
1183 file_editor_tab *editor_tab |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
1184 = static_cast<file_editor_tab *> (_tab_widget->currentWidget ()); |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
1185 editor_tab->conditional_close (); |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1186 } |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1187 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1188 void |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1189 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
|
1190 { |
19411
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19314
diff
changeset
|
1191 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:
19314
diff
changeset
|
1192 |
16637
b3f4bdd7e5f4
fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents:
16635
diff
changeset
|
1193 // 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
|
1194 for (int index = _tab_widget->count ()-1; index >= 0; index--) |
19411
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19314
diff
changeset
|
1195 { |
19739
3fa35defe495
Adjust spacing of static_cast<> calls to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19714
diff
changeset
|
1196 editor_tab = static_cast<file_editor_tab *> (_tab_widget->widget (index)); |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
1197 editor_tab->conditional_close (); |
19411
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19314
diff
changeset
|
1198 } |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1199 } |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1200 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1201 void |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1202 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
|
1203 { |
19411
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19314
diff
changeset
|
1204 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
|
1205 QWidget *tabID = _tab_widget->currentWidget (); |
19411
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19314
diff
changeset
|
1206 |
16637
b3f4bdd7e5f4
fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents:
16635
diff
changeset
|
1207 // 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
|
1208 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
|
1209 { |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1210 if (tabID != _tab_widget->widget (index)) |
19411
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19314
diff
changeset
|
1211 { |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
1212 editor_tab |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
1213 = static_cast<file_editor_tab *> (_tab_widget->widget (index)); |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
1214 editor_tab->conditional_close (); |
19411
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19314
diff
changeset
|
1215 } |
16615
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1216 } |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1217 } |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1218 |
cb09eecbd84e
add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents:
16614
diff
changeset
|
1219 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
|
1220 file_editor::handle_tab_close_request (int index) |
13529 | 1221 { |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
1222 file_editor_tab *editor_tab |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
1223 = static_cast<file_editor_tab *> (_tab_widget->widget (index)); |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
1224 editor_tab->conditional_close (); |
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
|
1225 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1226 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1227 void |
16558 | 1228 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
|
1229 { |
16558 | 1230 QObject *fileEditorTab = sender (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1231 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
|
1232 { |
16558 | 1233 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
|
1234 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1235 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
|
1236 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1237 _tab_widget->removeTab (i); |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
1238 // Deleting sender is dodgy, but works because the signal |
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
1239 // is the last item in the sender's routines. |
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
|
1240 delete fileEditorTab; |
17914
46da2c323ad6
Remove unnecessary loop in file_editor::handle_tab_remove_request.
PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
parents:
17903
diff
changeset
|
1241 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
|
1242 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1243 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1244 } |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1245 check_actions (); |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1246 |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1247 focus (); // focus stays in editor when tab is closed |
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
|
1248 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1249 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1250 void |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1251 file_editor::handle_add_filename_to_list (const QString& fileName, |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1252 const QString& encoding, 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
|
1253 { |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
1254 // Should we allow multiple tabs for a single file? |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1255 editor_tab_map[fileName].fet_ID = ID; |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1256 editor_tab_map[fileName].encoding = encoding; |
13501 | 1257 } |
1258 | |
18687
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1259 // context menu of edit area |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
1260 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
|
1261 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
|
1262 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1263 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
|
1264 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1265 |
18687
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1266 void file_editor::create_context_menu (QMenu *menu) |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1267 { |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1268 // remove all standard actions from scintilla |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1269 QList<QAction *> all_actions = menu->actions (); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1270 QAction* a; |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1271 |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1272 foreach (a, all_actions) |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1273 menu->removeAction (a); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1274 |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1275 // 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:
18686
diff
changeset
|
1276 menu->addAction (_undo_action); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1277 menu->addAction (_redo_action); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1278 menu->addSeparator (); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1279 menu->addAction (_cut_action); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1280 menu->addAction (_copy_action); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1281 menu->addAction (_paste_action); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1282 menu->addSeparator (); |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1283 menu->addAction (_selectall_action); |
18767
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18748
diff
changeset
|
1284 menu->addSeparator (); |
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18748
diff
changeset
|
1285 menu->addAction (_run_selection_action); |
18687
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1286 } |
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18686
diff
changeset
|
1287 |
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
|
1288 void |
19246
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1289 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:
19085
diff
changeset
|
1290 { |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1291 QSettings *settings = resource_manager::get_settings (); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1292 bool old = settings->value (preference,def).toBool (); |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20814
diff
changeset
|
1293 settings->setValue (preference,! old); |
19246
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1294 notice_settings (settings); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1295 } |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1296 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1297 void |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1298 file_editor::show_line_numbers (bool) |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1299 { |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1300 toggle_preference ("editor/showLineNumbers",true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1301 } |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1302 void |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1303 file_editor::show_white_space (bool) |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1304 { |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1305 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:
19085
diff
changeset
|
1306 } |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1307 void |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1308 file_editor::show_eol_chars (bool) |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1309 { |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1310 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:
19085
diff
changeset
|
1311 } |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1312 void |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1313 file_editor::show_indent_guides (bool) |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1314 { |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1315 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:
19085
diff
changeset
|
1316 } |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1317 void |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1318 file_editor::show_long_line (bool) |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1319 { |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1320 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:
19085
diff
changeset
|
1321 } |
20992
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1322 void |
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1323 file_editor::show_toolbar (bool) |
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1324 { |
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1325 toggle_preference ("editor/show_toolbar",true); |
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1326 } |
21001
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1327 void |
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1328 file_editor::show_statusbar (bool) |
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1329 { |
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1330 toggle_preference ("editor/show_edit_status_bar",true); |
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1331 } |
21002
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
1332 void |
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
1333 file_editor::show_hscrollbar (bool) |
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
1334 { |
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
1335 toggle_preference ("editor/show_hscroll_bar",true); |
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
1336 } |
19246
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1337 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1338 void |
18560
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1339 file_editor::zoom_in (bool) |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1340 { |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1341 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:
18555
diff
changeset
|
1342 } |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1343 |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1344 void |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1345 file_editor::zoom_out (bool) |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1346 { |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1347 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:
18555
diff
changeset
|
1348 } |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1349 |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1350 void |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1351 file_editor::zoom_normal (bool) |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1352 { |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1353 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:
18555
diff
changeset
|
1354 } |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1355 |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
1356 void |
18689
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18688
diff
changeset
|
1357 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:
18688
diff
changeset
|
1358 { |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1359 if (_undo_action) |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1360 _undo_action->setEnabled (undo); |
18689
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18688
diff
changeset
|
1361 _redo_action->setEnabled (redo); |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18688
diff
changeset
|
1362 } |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18688
diff
changeset
|
1363 |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18688
diff
changeset
|
1364 void |
16558 | 1365 file_editor::handle_editor_state_changed (bool copy_available, |
18767
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18748
diff
changeset
|
1366 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
|
1367 { |
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
|
1368 // 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
|
1369 // all the file editor tabs, just process info from the current active tab. |
16558 | 1370 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
|
1371 { |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1372 if (_copy_action) |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1373 _copy_action->setEnabled (copy_available); |
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
|
1374 _cut_action->setEnabled (copy_available); |
19085
63c5f95afeb3
Allow run selection for all editor file types (bug #43195)
Torsten <ttl@justmail.de>
parents:
19009
diff
changeset
|
1375 _run_selection_action->setEnabled (copy_available); |
18767
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18748
diff
changeset
|
1376 _run_action->setEnabled (is_octave_file); |
16558 | 1377 |
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
|
1378 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
|
1379 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1380 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1381 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
1382 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
|
1383 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
|
1384 { |
19847
597fc0fd8e54
make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents:
19822
diff
changeset
|
1385 int icon_size_settings = settings->value ("toolbar_icon_size",0).toInt (); |
597fc0fd8e54
make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents:
19822
diff
changeset
|
1386 QStyle *st = style (); |
597fc0fd8e54
make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents:
19822
diff
changeset
|
1387 int icon_size = st->pixelMetric (QStyle::PM_ToolBarIconSize); |
597fc0fd8e54
make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents:
19822
diff
changeset
|
1388 |
597fc0fd8e54
make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents:
19822
diff
changeset
|
1389 if (icon_size_settings == 1) |
597fc0fd8e54
make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents:
19822
diff
changeset
|
1390 icon_size = st->pixelMetric (QStyle::PM_LargeIconSize); |
597fc0fd8e54
make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents:
19822
diff
changeset
|
1391 else if (icon_size_settings == -1) |
597fc0fd8e54
make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents:
19822
diff
changeset
|
1392 icon_size = st->pixelMetric (QStyle::PM_SmallIconSize); |
597fc0fd8e54
make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents:
19822
diff
changeset
|
1393 |
597fc0fd8e54
make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents:
19822
diff
changeset
|
1394 _tool_bar->setIconSize (QSize (icon_size,icon_size)); |
18281
4dadae02bd4c
max. width of editor tabs limited and configurable
Torsten <ttl@justmail.de>
parents:
18269
diff
changeset
|
1395 |
18343
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18303
diff
changeset
|
1396 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:
18303
diff
changeset
|
1397 .toInt (); |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18303
diff
changeset
|
1398 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:
18303
diff
changeset
|
1399 .toInt (); |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18303
diff
changeset
|
1400 |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18303
diff
changeset
|
1401 if (settings->value ("editor/longWindowTitle", false).toBool ()) |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18303
diff
changeset
|
1402 { |
18690
834f6e604dc3
use defaults size for tab heights in editor and doc widget (bug #42144)
Torsten <ttl@justmail.de>
parents:
18689
diff
changeset
|
1403 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:
18689
diff
changeset
|
1404 "{min-width: %1px; max-width: %2px;}") |
18343
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18303
diff
changeset
|
1405 .arg (tab_width_min).arg (tab_width_max); |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18303
diff
changeset
|
1406 _tab_widget->setElideMode (Qt::ElideLeft); |
18690
834f6e604dc3
use defaults size for tab heights in editor and doc widget (bug #42144)
Torsten <ttl@justmail.de>
parents:
18689
diff
changeset
|
1407 _tab_widget->setStyleSheet (style_sheet); |
18343
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18303
diff
changeset
|
1408 } |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18303
diff
changeset
|
1409 else |
18690
834f6e604dc3
use defaults size for tab heights in editor and doc widget (bug #42144)
Torsten <ttl@justmail.de>
parents:
18689
diff
changeset
|
1410 _tab_widget->setElideMode (Qt::ElideNone); |
18343
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18303
diff
changeset
|
1411 |
3df71e1d3b24
improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents:
18303
diff
changeset
|
1412 _tab_widget->setUsesScrollButtons (true); |
18281
4dadae02bd4c
max. width of editor tabs limited and configurable
Torsten <ttl@justmail.de>
parents:
18269
diff
changeset
|
1413 |
19246
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1414 bool show_it; |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1415 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:
19085
diff
changeset
|
1416 _show_linenum_action->setChecked (show_it); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1417 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:
19085
diff
changeset
|
1418 _show_whitespace_action->setChecked (show_it); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1419 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:
19085
diff
changeset
|
1420 _show_eol_action->setChecked (show_it); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1421 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:
19085
diff
changeset
|
1422 _show_indguide_action->setChecked (show_it); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1423 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:
19085
diff
changeset
|
1424 _show_longline_action->setChecked (show_it); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1425 |
20992
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1426 show_it = settings->value ("editor/show_toolbar",true).toBool (); |
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1427 _show_toolbar_action->setChecked (show_it); |
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1428 _tool_bar->setVisible (show_it); |
21001
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1429 show_it = settings->value ("editor/show_edit_status_bar",true).toBool (); |
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1430 _show_statusbar_action->setChecked (show_it); |
21002
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
1431 show_it = settings->value ("editor/show_hscroll_bar",true).toBool (); |
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
1432 _show_hscrollbar_action->setChecked (show_it); |
20992
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1433 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1434 set_shortcuts (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1435 |
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
|
1436 // 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
|
1437 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
|
1438 } |
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
|
1439 |
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
|
1440 void |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1441 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
|
1442 { |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1443 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
|
1444 } |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1445 |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1446 void |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1447 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
|
1448 { |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1449 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
|
1450 } |
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1451 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1452 // insert global actions, that should also be displayed in the editor window, |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1453 // into the editor's menu and/or toolbar |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1454 void |
20989
98e75f952a36
add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents:
20986
diff
changeset
|
1455 file_editor::insert_global_actions (QList<QAction*> shared_actions) |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1456 { |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1457 // actions/menus that have to be added to the toolbar or the menu |
20989
98e75f952a36
add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents:
20986
diff
changeset
|
1458 QAction *open_action = shared_actions.at (OPEN_ACTION); |
98e75f952a36
add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents:
20986
diff
changeset
|
1459 QAction *new_action = shared_actions.at (NEW_SCRIPT_ACTION); |
98e75f952a36
add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents:
20986
diff
changeset
|
1460 QAction *new_fcn_action = shared_actions.at (NEW_FUNCTION_ACTION); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1461 _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:
18656
diff
changeset
|
1462 _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:
18656
diff
changeset
|
1463 _fileMenu->insertAction (new_fcn_action, new_action); |
20754
e6ccc8ae9e41
add list of mru files to the toolbar of the editor
Torsten <ttl@justmail.de>
parents:
20720
diff
changeset
|
1464 _tool_bar->insertAction (_popdown_mru_action, open_action); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1465 _tool_bar->insertAction (open_action, new_action); |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1466 |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1467 // actions that are additionally enabled/disabled later by the editor |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1468 // undo |
20989
98e75f952a36
add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents:
20986
diff
changeset
|
1469 _undo_action = shared_actions.at (UNDO_ACTION); |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1470 _tool_bar->insertAction (_redo_action,_undo_action); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1471 _edit_menu->insertAction (_redo_action,_undo_action); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1472 _undo_action->setEnabled (false); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1473 // copy |
20989
98e75f952a36
add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents:
20986
diff
changeset
|
1474 _copy_action = shared_actions.at (COPY_ACTION); |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1475 _tool_bar->insertAction (_cut_action,_copy_action); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1476 _edit_menu->insertAction (_cut_action,_copy_action); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1477 _copy_action->setEnabled (false); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1478 // select all |
20989
98e75f952a36
add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents:
20986
diff
changeset
|
1479 _selectall_action = shared_actions.at (SELECTALL_ACTION); |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1480 _edit_menu->insertAction (_find_action,_selectall_action); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1481 _edit_menu->insertSeparator (_find_action); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1482 // paste |
20989
98e75f952a36
add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents:
20986
diff
changeset
|
1483 _paste_action = shared_actions.at (PASTE_ACTION); |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1484 _tool_bar->insertAction (_find_action,_paste_action); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1485 _edit_menu->insertAction (_selectall_action,_paste_action); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1486 _edit_menu->insertSeparator (_selectall_action); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1487 _paste_action->setEnabled (false); |
20989
98e75f952a36
add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents:
20986
diff
changeset
|
1488 // find files |
98e75f952a36
add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents:
20986
diff
changeset
|
1489 _find_files_action = shared_actions.at (FIND_FILES_ACTION); |
98e75f952a36
add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents:
20986
diff
changeset
|
1490 _edit_menu->insertAction (_find_action, _find_files_action); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1491 } |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1492 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1493 QAction* |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1494 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:
18656
diff
changeset
|
1495 const char *member) |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1496 { |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1497 QAction *a; |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1498 |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1499 if (menu) |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1500 a = menu->addAction (icon, text, this, member); |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1501 else |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1502 { |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1503 a = new QAction (this); |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1504 connect (a, SIGNAL (triggered ()), this, member); |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1505 } |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1506 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1507 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:
18656
diff
changeset
|
1508 a->setShortcutContext (Qt::WidgetWithChildrenShortcut); |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1509 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1510 return a; |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1511 } |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1512 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1513 // function enabling/disabling the menu accelerators depending on the |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1514 // focus of the editor |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1515 void |
18944
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1516 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:
18767
diff
changeset
|
1517 { |
23070
bef714f45999
maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
1518 QHash<QMenu*, QStringList>::const_iterator i = _hash_menu_text.constBegin (); |
18944
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1519 |
23070
bef714f45999
maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
1520 while (i != _hash_menu_text.constEnd ()) |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1521 { |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1522 i.key ()->setTitle (i.value ().at (! enable)); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1523 ++i; |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1524 } |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1525 |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1526 // when editor loses focus, enable the actions, which are always active |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1527 // in the main window due to missing info on selected text and undo actions |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1528 if (! enable && _copy_action && _undo_action) |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1529 { |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1530 _copy_action->setEnabled (true); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1531 _undo_action->setEnabled (true); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1532 } |
18944
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1533 } |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1534 |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1535 QMenu* |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1536 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:
18767
diff
changeset
|
1537 { |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1538 QMenu *menu = p->addMenu (name); |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1539 |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1540 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:
18767
diff
changeset
|
1541 // 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:
18767
diff
changeset
|
1542 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:
18767
diff
changeset
|
1543 // remove single '&' (shortcut) |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1544 base_name.remove ("&"); |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1545 // restore intended '&' |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1546 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:
18767
diff
changeset
|
1547 |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1548 // 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:
18767
diff
changeset
|
1549 _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:
18767
diff
changeset
|
1550 |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1551 return menu; |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1552 } |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1553 |
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1554 void |
16558 | 1555 file_editor::construct (void) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
1556 { |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1557 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
|
1558 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1559 // 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
|
1560 // 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
|
1561 _menu_bar = new QMenuBar (editor_widget); |
18554
bfb735b70978
Force non-native menu bar for the editor on mac (bug #41823)
pantxo <pantxo.diribarne@gmail.com>
parents:
18545
diff
changeset
|
1562 #if defined (Q_OS_MAC) |
bfb735b70978
Force non-native menu bar for the editor on mac (bug #41823)
pantxo <pantxo.diribarne@gmail.com>
parents:
18545
diff
changeset
|
1563 _menu_bar->setNativeMenuBar (false); |
bfb735b70978
Force non-native menu bar for the editor on mac (bug #41823)
pantxo <pantxo.diribarne@gmail.com>
parents:
18545
diff
changeset
|
1564 #endif |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1565 _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
|
1566 _tool_bar->setMovable (true); |
23276
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
1567 |
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
1568 _tab_widget = new file_editor_tab_widget (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
|
1569 _tab_widget->setTabsClosable (true); |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21650
diff
changeset
|
1570 #if defined (HAVE_QTABWIDGET_SETMOVABLE) |
18216
e54cfaae830b
Make editor tabs draggable if feature is available
Richard Crozier richard dot crozier(at)yahoo.co.uk
parents:
17988
diff
changeset
|
1571 _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
|
1572 #endif |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
1573 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1574 // 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
|
1575 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
|
1576 _mru_files = settings->value ("editor/mru_file_list").toStringList (); |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1577 _mru_files_encodings = settings->value ("editor/mru_file_encodings") |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1578 .toStringList (); |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1579 |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1580 if (_mru_files_encodings.count () != _mru_files.count ()) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
1581 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
1582 // encodings don't have the same count -> do not use them! |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1583 _mru_files_encodings = QStringList (); |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1584 for (int i = 0; i < _mru_files.count (); i++) |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1585 _mru_files_encodings << QString (); |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1586 } |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1587 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1588 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
|
1589 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1590 _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
|
1591 _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
|
1592 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1593 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1594 // menu bar |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1595 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1596 // file menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1597 |
18944
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1598 _fileMenu = m_add_menu (_menu_bar, tr ("&File")); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1599 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1600 // 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:
18656
diff
changeset
|
1601 _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:
18656
diff
changeset
|
1602 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:
18656
diff
changeset
|
1603 _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:
18656
diff
changeset
|
1604 _fileMenu->addMenu (_mru_file_menu); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1605 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1606 _fileMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1607 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1608 _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:
18656
diff
changeset
|
1609 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:
18656
diff
changeset
|
1610 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1611 _fileMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1612 |
19899 | 1613 _save_action = add_action (_fileMenu, resource_manager::icon ("document-save"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1614 tr ("&Save File"), SLOT (request_save_file (bool))); |
19899 | 1615 _save_as_action = add_action (_fileMenu, resource_manager::icon ("document-save-as"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1616 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:
18656
diff
changeset
|
1617 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1618 _fileMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1619 |
19899 | 1620 _close_action = add_action (_fileMenu, resource_manager::icon ("window-close",false), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1621 tr ("&Close"), SLOT (request_close_file (bool))); |
19899 | 1622 _close_all_action = add_action (_fileMenu, resource_manager::icon ("window-close",false), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1623 tr ("Close All"), SLOT (request_close_all_files (bool))); |
19899 | 1624 _close_others_action = add_action (_fileMenu, resource_manager::icon ("window-close",false), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1625 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:
18656
diff
changeset
|
1626 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1627 _fileMenu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1628 |
19899 | 1629 _print_action = add_action (_fileMenu, resource_manager::icon ("document-print"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1630 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:
18656
diff
changeset
|
1631 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1632 // edit menu (undo, copy, paste and select all later via main window) |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1633 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1634 _edit_menu = m_add_menu (_menu_bar, tr ("&Edit")); |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1635 |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1636 _redo_action = add_action (_edit_menu, resource_manager::icon ("edit-redo"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1637 tr ("&Redo"), SLOT (request_redo (bool))); |
18689
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18688
diff
changeset
|
1638 _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
|
1639 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1640 _edit_menu->addSeparator (); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1641 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1642 _cut_action = add_action (_edit_menu, resource_manager::icon ("edit-cut"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1643 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:
18656
diff
changeset
|
1644 _cut_action->setEnabled (false); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1645 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1646 _find_action = add_action (_edit_menu, resource_manager::icon ("edit-find-replace"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1647 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:
18656
diff
changeset
|
1648 |
22169
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1649 _find_next_action = add_action (_edit_menu, QIcon (), |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1650 tr ("Find &Next..."), SLOT (request_find_next (bool))); |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1651 |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1652 _find_previous_action = add_action (_edit_menu, QIcon (), |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1653 tr ("Find &Previous..."), SLOT (request_find_previous (bool))); |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1654 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1655 _edit_menu->addSeparator (); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1656 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1657 _edit_cmd_menu = _edit_menu->addMenu (tr ("&Commands")); |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
1658 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1659 _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:
18656
diff
changeset
|
1660 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:
18656
diff
changeset
|
1661 _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:
18656
diff
changeset
|
1662 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:
18656
diff
changeset
|
1663 _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:
18656
diff
changeset
|
1664 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:
18656
diff
changeset
|
1665 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1666 _edit_cmd_menu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1667 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1668 _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:
18656
diff
changeset
|
1669 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:
18656
diff
changeset
|
1670 _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:
18656
diff
changeset
|
1671 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:
18656
diff
changeset
|
1672 _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:
18656
diff
changeset
|
1673 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:
18656
diff
changeset
|
1674 _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:
18656
diff
changeset
|
1675 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:
18656
diff
changeset
|
1676 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1677 _edit_cmd_menu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1678 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1679 _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:
18656
diff
changeset
|
1680 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:
18656
diff
changeset
|
1681 _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:
18656
diff
changeset
|
1682 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:
18656
diff
changeset
|
1683 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1684 _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
|
1685 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1686 _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:
18656
diff
changeset
|
1687 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:
18656
diff
changeset
|
1688 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1689 _edit_fmt_menu = _edit_menu->addMenu (tr ("&Format")); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1690 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1691 _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:
18656
diff
changeset
|
1692 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:
18656
diff
changeset
|
1693 _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:
18656
diff
changeset
|
1694 tr ("&Lowercase Selection"), SLOT (request_lower_case (bool))); |
19247
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1695 |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1696 _edit_fmt_menu->addSeparator (); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1697 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1698 _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:
18656
diff
changeset
|
1699 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:
18656
diff
changeset
|
1700 _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:
18656
diff
changeset
|
1701 tr ("&Uncomment"), SLOT (request_uncomment_selected_text (bool))); |
19247
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1702 |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1703 _edit_fmt_menu->addSeparator (); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1704 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1705 _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:
18656
diff
changeset
|
1706 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:
18656
diff
changeset
|
1707 _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:
18656
diff
changeset
|
1708 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:
18656
diff
changeset
|
1709 |
19247
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1710 _edit_fmt_menu->addSeparator (); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1711 |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1712 _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:
19246
diff
changeset
|
1713 tr ("Convert Line Endings to &Windows (CRLF)"), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1714 SLOT (request_conv_eol_windows (bool))); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1715 _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:
19246
diff
changeset
|
1716 tr ("Convert Line Endings to &Unix (LF)"), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1717 SLOT (request_conv_eol_unix (bool))); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1718 _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:
19246
diff
changeset
|
1719 tr ("Convert Line Endings to &Mac (CR)"), |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1720 SLOT (request_conv_eol_mac (bool))); |
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
1721 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1722 _edit_nav_menu = _edit_menu->addMenu (tr ("Navi&gation")); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1723 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1724 _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:
18656
diff
changeset
|
1725 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:
18656
diff
changeset
|
1726 |
19629
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1727 _edit_cmd_menu->addSeparator (); |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1728 |
21568
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
21565
diff
changeset
|
1729 _move_to_matching_brace = add_action (_edit_nav_menu, QIcon (), |
19629
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1730 tr ("Move to Matching Brace"), SLOT (request_move_match_brace (bool))); |
21568
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
21565
diff
changeset
|
1731 _sel_to_matching_brace = add_action (_edit_nav_menu, QIcon (), |
19629
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1732 tr ("Select to Matching Brace"), SLOT (request_sel_match_brace (bool))); |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
1733 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1734 _edit_nav_menu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1735 |
22179
603f0d752de2
Wrap search for "next bookmark" and "prev bookmark" (bug #48044)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22169
diff
changeset
|
1736 _next_bookmark_action = add_action (_edit_nav_menu, QIcon (), |
603f0d752de2
Wrap search for "next bookmark" and "prev bookmark" (bug #48044)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22169
diff
changeset
|
1737 tr ("&Next Bookmark"), SLOT (request_next_bookmark (bool))); |
21568
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
21565
diff
changeset
|
1738 _previous_bookmark_action = add_action (_edit_nav_menu, QIcon (), |
19899 | 1739 tr ("Pre&vious Bookmark"), SLOT (request_previous_bookmark (bool))); |
21568
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
21565
diff
changeset
|
1740 _toggle_bookmark_action = add_action (_edit_nav_menu, QIcon (), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1741 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:
18656
diff
changeset
|
1742 _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:
18656
diff
changeset
|
1743 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:
18656
diff
changeset
|
1744 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1745 _edit_menu->addSeparator (); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1746 |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1747 _preferences_action = add_action (_edit_menu, resource_manager::icon ("preferences-system"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1748 tr ("&Preferences..."), SLOT (request_preferences (bool))); |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1749 _styles_preferences_action = add_action (_edit_menu, resource_manager::icon ("preferences-system"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1750 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:
18656
diff
changeset
|
1751 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1752 // view menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1753 |
18944
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1754 QMenu *view_menu = m_add_menu (_menu_bar, tr ("&View")); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1755 |
19246
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1756 _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:
19085
diff
changeset
|
1757 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1758 _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:
19085
diff
changeset
|
1759 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:
19085
diff
changeset
|
1760 _show_linenum_action->setCheckable (true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1761 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1762 _show_whitespace_action = add_action (_view_editor_menu, QIcon (), |
20002
17d79913f065
Fix several typos in GUI strings (bug #44681).
Rik <rik@octave.org>
parents:
20001
diff
changeset
|
1763 tr ("Show &Whitespace Characters"), SLOT (show_white_space (bool))); |
19246
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1764 _show_whitespace_action->setCheckable (true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1765 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1766 _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:
19085
diff
changeset
|
1767 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:
19085
diff
changeset
|
1768 _show_eol_action->setCheckable (true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1769 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1770 _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:
19085
diff
changeset
|
1771 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:
19085
diff
changeset
|
1772 _show_indguide_action->setCheckable (true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1773 |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1774 _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:
19085
diff
changeset
|
1775 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:
19085
diff
changeset
|
1776 _show_longline_action->setCheckable (true); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1777 |
21001
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1778 _view_editor_menu->addSeparator (); |
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1779 |
20992
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1780 _show_toolbar_action = add_action (_view_editor_menu, QIcon (), |
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1781 tr ("Show &Toolbar"), SLOT (show_toolbar (bool))); |
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1782 _show_toolbar_action->setCheckable (true); |
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
1783 |
21001
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1784 _show_statusbar_action = add_action (_view_editor_menu, QIcon (), |
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1785 tr ("Show &Statusbar"), SLOT (show_statusbar (bool))); |
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1786 _show_statusbar_action->setCheckable (true); |
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
1787 |
21002
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
1788 _show_hscrollbar_action = add_action (_view_editor_menu, QIcon (), |
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
1789 tr ("Show &Horizontal Scrollbar"), SLOT (show_hscrollbar (bool))); |
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
1790 _show_hscrollbar_action->setCheckable (true); |
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
1791 |
19246
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1792 view_menu->addSeparator (); |
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
1793 |
19899 | 1794 _zoom_in_action = add_action (view_menu, resource_manager::icon ("zoom-in"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1795 tr ("Zoom &In"), SLOT (zoom_in (bool))); |
19899 | 1796 _zoom_out_action = add_action (view_menu, resource_manager::icon ("zoom-out"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1797 tr ("Zoom &Out"), SLOT (zoom_out (bool))); |
19899 | 1798 _zoom_normal_action = add_action (view_menu, QIcon (), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1799 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:
18656
diff
changeset
|
1800 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1801 _menu_bar->addMenu (view_menu); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1802 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1803 // debug menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1804 |
18944
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1805 _debug_menu = m_add_menu (_menu_bar, tr ("&Debug")); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1806 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1807 _toggle_breakpoint_action = add_action (_debug_menu, |
19899 | 1808 resource_manager::icon ("bp-toggle"), tr ("Toggle &Breakpoint"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1809 SLOT (request_toggle_breakpoint (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1810 _next_breakpoint_action = add_action (_debug_menu, |
19899 | 1811 resource_manager::icon ("bp-next"), tr ("&Next Breakpoint"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1812 SLOT (request_next_breakpoint (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1813 _previous_breakpoint_action = add_action (_debug_menu, |
19899 | 1814 resource_manager::icon ("bp-prev"), tr ("Pre&vious Breakpoint"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1815 SLOT (request_previous_breakpoint (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1816 _remove_all_breakpoints_action = add_action (_debug_menu, |
19899 | 1817 resource_manager::icon ("bp-rm-all"), tr ("&Remove All Breakpoints"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1818 SLOT (request_remove_breakpoint (bool))); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1819 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1820 _debug_menu->addSeparator (); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1821 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1822 // 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:
18656
diff
changeset
|
1823 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1824 // run menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1825 |
18944
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1826 QMenu *_run_menu = m_add_menu (_menu_bar, tr ("&Run")); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1827 |
19899 | 1828 _run_action = add_action (_run_menu, resource_manager::icon ("system-run"), |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1829 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:
18656
diff
changeset
|
1830 _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:
18656
diff
changeset
|
1831 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:
18656
diff
changeset
|
1832 _run_selection_action->setEnabled (false); |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1833 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1834 // help menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1835 |
18944
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1836 QMenu *_help_menu = m_add_menu (_menu_bar, tr ("&Help")); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1837 |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1838 _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:
18656
diff
changeset
|
1839 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:
18656
diff
changeset
|
1840 _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:
18656
diff
changeset
|
1841 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:
18656
diff
changeset
|
1842 |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1843 // tab navigation (no menu, only actions) |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1844 |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1845 _switch_left_tab_action = add_action (0, QIcon (), "", |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1846 SLOT (switch_left_tab ())); |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1847 _switch_right_tab_action = add_action (0, QIcon (), "", |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1848 SLOT (switch_right_tab ())); |
20705
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
1849 _move_tab_left_action = add_action (0, QIcon (), "", |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
1850 SLOT (move_tab_left ())); |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
1851 _move_tab_right_action = add_action (0, QIcon (), "", |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
1852 SLOT (move_tab_right ())); |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
1853 |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
1854 // toolbar |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1855 |
20754
e6ccc8ae9e41
add list of mru files to the toolbar of the editor
Torsten <ttl@justmail.de>
parents:
20720
diff
changeset
|
1856 // popdown menu with mru files |
e6ccc8ae9e41
add list of mru files to the toolbar of the editor
Torsten <ttl@justmail.de>
parents:
20720
diff
changeset
|
1857 QToolButton *popdown_button = new QToolButton (); |
e6ccc8ae9e41
add list of mru files to the toolbar of the editor
Torsten <ttl@justmail.de>
parents:
20720
diff
changeset
|
1858 popdown_button->setToolTip (tr ("Recent Files")); |
e6ccc8ae9e41
add list of mru files to the toolbar of the editor
Torsten <ttl@justmail.de>
parents:
20720
diff
changeset
|
1859 popdown_button->setMenu (_mru_file_menu); |
e6ccc8ae9e41
add list of mru files to the toolbar of the editor
Torsten <ttl@justmail.de>
parents:
20720
diff
changeset
|
1860 popdown_button->setPopupMode (QToolButton::InstantPopup); |
e6ccc8ae9e41
add list of mru files to the toolbar of the editor
Torsten <ttl@justmail.de>
parents:
20720
diff
changeset
|
1861 popdown_button->setToolButtonStyle (Qt::ToolButtonTextOnly); |
e6ccc8ae9e41
add list of mru files to the toolbar of the editor
Torsten <ttl@justmail.de>
parents:
20720
diff
changeset
|
1862 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1863 // new and open actions are inserted later from main window |
20754
e6ccc8ae9e41
add list of mru files to the toolbar of the editor
Torsten <ttl@justmail.de>
parents:
20720
diff
changeset
|
1864 _popdown_mru_action = _tool_bar->addWidget (popdown_button); |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1865 _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
|
1866 _tool_bar->addAction (_save_as_action); |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1867 _tool_bar->addAction (_print_action); |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
1868 _tool_bar->addSeparator (); |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1869 // _undo_action: later via main window |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
1870 _tool_bar->addAction (_redo_action); |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1871 // _copy_action: later via the main window |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
1872 _tool_bar->addAction (_cut_action); |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1873 // _paste_action: later via the main window |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
1874 _tool_bar->addAction (_find_action); |
22169
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1875 //_tool_bar->addAction (_find_next_action); |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
1876 //_tool_bar->addAction (_find_previous_action); |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
1877 _tool_bar->addSeparator (); |
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
|
1878 _tool_bar->addAction (_run_action); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
1879 _tool_bar->addSeparator (); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1880 _tool_bar->addAction (_toggle_breakpoint_action); |
19899 | 1881 _tool_bar->addAction (_previous_breakpoint_action); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1882 _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:
18656
diff
changeset
|
1883 _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
|
1884 |
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
1885 // layout |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1886 QVBoxLayout *vbox_layout = new QVBoxLayout (); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1887 vbox_layout->addWidget (_menu_bar); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1888 vbox_layout->addWidget (_tool_bar); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1889 vbox_layout->addWidget (_tab_widget); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1890 vbox_layout->setMargin (0); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1891 editor_widget->setLayout (vbox_layout); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
1892 setWidget (editor_widget); |
13501 | 1893 |
23321
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
1894 // create the context menu of the tab bar |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
1895 file_editor_tab_bar *bar |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
1896 = static_cast<file_editor_tab_bar *>(_tab_widget->tabBar ()); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
1897 QList<QAction *> tab_bar_actions; |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
1898 tab_bar_actions.append (_close_action); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
1899 tab_bar_actions.append (_close_all_action); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
1900 tab_bar_actions.append (_close_others_action); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
1901 bar->create_context_menu (&tab_bar_actions); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
1902 |
16981
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
1903 // signals |
23150
d133d90b495a
connect execute command signal in editor constructor (bug #50171)
Torsten <mttl@mailbox.org>
parents:
23146
diff
changeset
|
1904 connect (this, SIGNAL (execute_command_in_terminal_signal (const QString&)), |
d133d90b495a
connect execute command signal in editor constructor (bug #50171)
Torsten <mttl@mailbox.org>
parents:
23146
diff
changeset
|
1905 main_win (), SLOT (execute_command_in_terminal (const QString&))); |
d133d90b495a
connect execute command signal in editor constructor (bug #50171)
Torsten <mttl@mailbox.org>
parents:
23146
diff
changeset
|
1906 |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1907 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
|
1908 main_win (), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1909 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
|
1910 |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
16740
diff
changeset
|
1911 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
|
1912 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
|
1913 |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
16740
diff
changeset
|
1914 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
|
1915 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
|
1916 |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
1917 connect (main_win (), SIGNAL (edit_mfile_request (const QString&, |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
1918 const QString&, const QString&, int)), |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
1919 this, SLOT (handle_edit_mfile_request (const QString&, |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
1920 const QString&, const QString&, int))); |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
1921 |
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
|
1922 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
|
1923 this, SLOT (request_mru_open_file (QAction *))); |
16558 | 1924 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1925 mru_menu_update (); |
16558 | 1926 |
1927 connect (_tab_widget, SIGNAL (tabCloseRequested (int)), | |
1928 this, SLOT (handle_tab_close_request (int))); | |
1929 | |
1930 connect (_tab_widget, SIGNAL (currentChanged (int)), | |
1931 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
|
1932 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1933 resize (500, 400); |
16558 | 1934 setWindowIcon (QIcon (":/actions/icons/logo.png")); |
20001
97b37077a2d3
Add missing translation call to GUI "Editor" tab.
Rik <rik@octave.org>
parents:
19945
diff
changeset
|
1935 set_title (tr ("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
|
1936 |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1937 restore_session (settings); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1938 |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1939 check_actions (); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1940 } |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1941 |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1942 void |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1943 file_editor::restore_session (QSettings *settings) |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1944 { |
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
|
1945 //restore previous session |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1946 if (! settings->value ("editor/restoreSession", true).toBool ()) |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1947 return; |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1948 |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1949 // get the data from the settings file |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1950 QStringList sessionFileNames = settings->value ("editor/savedSessionTabs", |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1951 QStringList ()).toStringList (); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1952 QStringList session_encodings = settings->value ("editor/saved_session_encodings", |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1953 QStringList ()).toStringList (); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1954 QStringList session_index = settings->value ("editor/saved_session_tab_index", |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1955 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
|
1956 |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1957 // fill a list of the struct and sort it (depending on index) |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1958 QList<session_data> s_data; |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1959 |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1960 bool do_encoding = (session_encodings.count () == sessionFileNames.count ()); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1961 bool do_index = (session_index.count () == sessionFileNames.count ()); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1962 |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1963 for (int n = 0; n < sessionFileNames.count (); ++n) |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1964 { |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1965 QFileInfo file = QFileInfo (sessionFileNames.at (n)); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1966 if (! file.exists ()) |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1967 continue; |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1968 |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1969 session_data item = { QString (), sessionFileNames.at (n), QString ()}; |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1970 if (do_index) |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1971 item.index = session_index.at (n); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1972 if (do_encoding) |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1973 item.encoding = session_encodings.at (n); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1974 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
1975 s_data << item; |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
1976 } |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
1977 |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1978 qSort (s_data); |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1979 |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1980 // finally open the file with the desired encoding in the desired order |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1981 for (int n = 0; n < s_data.count (); ++n) |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
1982 request_open_file (s_data.at (n).file_name, s_data.at (n).encoding); |
13501 | 1983 } |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1984 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1985 void |
16558 | 1986 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
|
1987 { |
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
|
1988 _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
|
1989 |
18689
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18688
diff
changeset
|
1990 // signals from the qscintilla edit area |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18688
diff
changeset
|
1991 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:
18688
diff
changeset
|
1992 this, SLOT (edit_status_update (bool, bool))); |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18688
diff
changeset
|
1993 |
19606
3156773fcc80
open a doc page from editor directly without command window
Torsten <ttl@justmail.de>
parents:
19605
diff
changeset
|
1994 connect (f->qsci_edit_area (), SIGNAL (show_doc_signal (const QString&)), |
3156773fcc80
open a doc page from editor directly without command window
Torsten <ttl@justmail.de>
parents:
19605
diff
changeset
|
1995 main_win (), SLOT (handle_show_doc (const QString&))); |
3156773fcc80
open a doc page from editor directly without command window
Torsten <ttl@justmail.de>
parents:
19605
diff
changeset
|
1996 |
19608
4b980842edba
clean up some signal-slot combinations in the editor
Torsten <ttl@justmail.de>
parents:
19606
diff
changeset
|
1997 connect (f->qsci_edit_area (), SIGNAL (create_context_menu_signal (QMenu *)), |
4b980842edba
clean up some signal-slot combinations in the editor
Torsten <ttl@justmail.de>
parents:
19606
diff
changeset
|
1998 this, SLOT (create_context_menu (QMenu *))); |
4b980842edba
clean up some signal-slot combinations in the editor
Torsten <ttl@justmail.de>
parents:
19606
diff
changeset
|
1999 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2000 connect (f->qsci_edit_area (), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2001 SIGNAL (execute_command_in_terminal_signal (const QString&)), |
19608
4b980842edba
clean up some signal-slot combinations in the editor
Torsten <ttl@justmail.de>
parents:
19606
diff
changeset
|
2002 main_win (), SLOT (execute_command_in_terminal (const QString&))); |
4b980842edba
clean up some signal-slot combinations in the editor
Torsten <ttl@justmail.de>
parents:
19606
diff
changeset
|
2003 |
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
|
2004 // 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
|
2005 connect (f, SIGNAL (file_name_changed (const QString&, const QString&)), |
16558 | 2006 this, SLOT (handle_file_name_changed (const QString&, |
2007 const QString&))); | |
2008 | |
19803
415864f5b85f
communicating actual working directory to the editor (#44298)
Torsten <ttl@justmail.de>
parents:
19739
diff
changeset
|
2009 connect (f, SIGNAL (editor_state_changed (bool, bool)), |
415864f5b85f
communicating actual working directory to the editor (#44298)
Torsten <ttl@justmail.de>
parents:
19739
diff
changeset
|
2010 this, SLOT (handle_editor_state_changed (bool, bool))); |
16558 | 2011 |
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
|
2012 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
|
2013 this, SLOT (handle_tab_remove_request ())); |
16558 | 2014 |
20796
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
2015 connect (f, SIGNAL (add_filename_to_list (const QString&, |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
2016 const QString&, QWidget*)), |
ed770c16a3e8
also store encoding and tab index with last editor session (bugs #46588, #45688)
Torsten <ttl@justmail.de>
parents:
20793
diff
changeset
|
2017 this, SLOT (handle_add_filename_to_list (const QString&, |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2018 const QString&, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2019 QWidget*))); |
16558 | 2020 |
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
|
2021 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
|
2022 this, SLOT (check_conflict_save (const QString&, bool))); |
16558 | 2023 |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
2024 connect (f, SIGNAL (mru_add_file (const QString&, const QString&)), |
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
2025 this, SLOT (handle_mru_add_file (const QString&, const QString&))); |
16558 | 2026 |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16615
diff
changeset
|
2027 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
|
2028 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
|
2029 |
19605
d258070914ef
open file directly without edit command when editing a function from editor
Torsten <ttl@justmail.de>
parents:
19599
diff
changeset
|
2030 connect (f, SIGNAL (request_open_file (const QString&)), |
d258070914ef
open file directly without edit command when editing a function from editor
Torsten <ttl@justmail.de>
parents:
19599
diff
changeset
|
2031 this, SLOT (request_open_file (const QString&))); |
d258070914ef
open file directly without edit command when editing a function from editor
Torsten <ttl@justmail.de>
parents:
19599
diff
changeset
|
2032 |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
2033 connect (f, SIGNAL (edit_mfile_request (const QString&, const QString&, |
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
2034 const QString&, int)), |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2035 this, SLOT (handle_edit_mfile_request (const QString&, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2036 const QString&, |
21352
043ec02115b8
fix edit function related to current word in editor (bug #47255)
Torsten <ttl@justmail.de>
parents:
21310
diff
changeset
|
2037 const QString&, int))); |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
2038 |
23177
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
2039 connect (f, SIGNAL (set_focus_editor_signal (QWidget*)), |
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
2040 this, SLOT (set_focus (QWidget*))); |
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
2041 |
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
|
2042 // 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
|
2043 connect (this, SIGNAL (fetab_settings_changed (const QSettings *)), |
23178
6da3526ccf33
fix settings update for existing editor tabs (regression from b3ced5e3cebb)
Torsten <mttl@mailbox.org>
parents:
23150
diff
changeset
|
2044 f, SLOT (notice_settings (const QSettings *))); |
16558 | 2045 |
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
|
2046 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
|
2047 f, SLOT (change_editor_state (const QWidget*))); |
16558 | 2048 |
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
|
2049 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
|
2050 f, SLOT (file_name_query (const QWidget*))); |
16558 | 2051 |
2052 connect (this, SIGNAL (fetab_save_file (const QWidget*, const QString&, | |
2053 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
|
2054 f, SLOT (save_file (const QWidget*, const QString&, bool))); |
16558 | 2055 |
19714
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
2056 connect (this, SIGNAL (fetab_check_modified_file (void)), |
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
2057 f, SLOT (check_modified_file (void))); |
21015ca26566
Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
19697
diff
changeset
|
2058 |
21158
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
2059 connect (f, SIGNAL (execute_command_in_terminal_signal (const QString&)), |
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
2060 main_win (), SLOT (execute_command_in_terminal (const QString&))); |
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
2061 |
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
|
2062 // Signals from the file_editor trivial operations |
21054
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
2063 connect (this, SIGNAL (fetab_recover_from_exit (void)), |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
2064 f, SLOT (recover_from_exit (void))); |
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
2065 |
19803
415864f5b85f
communicating actual working directory to the editor (#44298)
Torsten <ttl@justmail.de>
parents:
19739
diff
changeset
|
2066 connect (this, SIGNAL (fetab_set_directory (const QString&)), |
415864f5b85f
communicating actual working directory to the editor (#44298)
Torsten <ttl@justmail.de>
parents:
19739
diff
changeset
|
2067 f, SLOT (set_current_directory (const QString&))); |
415864f5b85f
communicating actual working directory to the editor (#44298)
Torsten <ttl@justmail.de>
parents:
19739
diff
changeset
|
2068 |
18560
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
2069 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:
18555
diff
changeset
|
2070 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:
18555
diff
changeset
|
2071 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:
18555
diff
changeset
|
2072 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:
18555
diff
changeset
|
2073 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:
18555
diff
changeset
|
2074 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:
18555
diff
changeset
|
2075 |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
2076 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
|
2077 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
|
2078 |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
2079 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
|
2080 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
|
2081 |
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
|
2082 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
|
2083 f, SLOT (save_file (const QWidget*))); |
16558 | 2084 |
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
|
2085 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
|
2086 f, SLOT (save_file_as (const QWidget*))); |
16558 | 2087 |
16440
aaf024ac8015
Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16438
diff
changeset
|
2088 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
|
2089 f, SLOT (print_file (const QWidget*))); |
16558 | 2090 |
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
|
2091 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
|
2092 f, SLOT (run_file (const QWidget*))); |
16558 | 2093 |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
2094 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
|
2095 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
|
2096 |
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
|
2097 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
|
2098 f, SLOT (toggle_bookmark (const QWidget*))); |
16558 | 2099 |
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
|
2100 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
|
2101 f, SLOT (next_bookmark (const QWidget*))); |
16558 | 2102 |
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
|
2103 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
|
2104 f, SLOT (previous_bookmark (const QWidget*))); |
16558 | 2105 |
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
|
2106 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
|
2107 f, SLOT (remove_bookmark (const QWidget*))); |
16558 | 2108 |
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
|
2109 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
|
2110 f, SLOT (toggle_breakpoint (const QWidget*))); |
16558 | 2111 |
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
|
2112 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
|
2113 f, SLOT (next_breakpoint (const QWidget*))); |
16558 | 2114 |
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
|
2115 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
|
2116 f, SLOT (previous_breakpoint (const QWidget*))); |
16558 | 2117 |
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
|
2118 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
|
2119 f, SLOT (remove_all_breakpoints (const QWidget*))); |
16558 | 2120 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2121 connect (this, SIGNAL (fetab_scintilla_command (const QWidget *, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2122 unsigned int)), |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
2123 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:
18651
diff
changeset
|
2124 |
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
|
2125 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
|
2126 f, SLOT (comment_selected_text (const QWidget*))); |
16558 | 2127 |
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
|
2128 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
|
2129 f, SLOT (uncomment_selected_text (const QWidget*))); |
16558 | 2130 |
18303
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
2131 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:
18294
diff
changeset
|
2132 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:
18294
diff
changeset
|
2133 |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
2134 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:
18294
diff
changeset
|
2135 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:
18294
diff
changeset
|
2136 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2137 connect (this, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2138 SIGNAL (fetab_convert_eol (const QWidget*, QsciScintilla::EolMode)), |
19247
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
2139 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:
19246
diff
changeset
|
2140 |
22169
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2141 connect (this, SIGNAL (fetab_find (const QWidget*, QList<QAction *>)), |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2142 f, SLOT (find (const QWidget*, QList<QAction *>))); |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2143 |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2144 connect (this, SIGNAL (fetab_find_next (const QWidget*)), |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2145 f, SLOT (find_next (const QWidget*))); |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2146 |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2147 connect (this, SIGNAL (fetab_find_previous (const QWidget*)), |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2148 f, SLOT (find_previous (const QWidget*))); |
16558 | 2149 |
2150 connect (this, SIGNAL (fetab_goto_line (const QWidget*, int)), | |
2151 f, SLOT (goto_line (const QWidget*, int))); | |
2152 | |
19629
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
2153 connect (this, SIGNAL (fetab_move_match_brace (const QWidget*, bool)), |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
2154 f, SLOT (move_match_brace (const QWidget*, bool))); |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
2155 |
18482
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18460
diff
changeset
|
2156 connect (this, SIGNAL (fetab_completion (const QWidget*)), |
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18460
diff
changeset
|
2157 f, SLOT (show_auto_completion (const QWidget*))); |
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18460
diff
changeset
|
2158 |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
2159 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
|
2160 f, SLOT (set_focus (const QWidget*))); |
16558 | 2161 |
2162 connect (this, SIGNAL (fetab_insert_debugger_pointer (const QWidget*, int)), | |
2163 f, SLOT (insert_debugger_pointer (const QWidget*, int))); | |
2164 | |
2165 connect (this, SIGNAL (fetab_delete_debugger_pointer (const QWidget*, int)), | |
2166 f, SLOT (delete_debugger_pointer (const QWidget*, int))); | |
2167 | |
2168 connect (this, SIGNAL (fetab_do_breakpoint_marker (bool, const QWidget*, | |
21158
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
2169 int, const QString&)), |
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
2170 f, SLOT (do_breakpoint_marker (bool, const QWidget*, int, |
65827e9cccb8
Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21148
diff
changeset
|
2171 const QString&))); |
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
|
2172 |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
2173 _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
|
2174 |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
2175 check_actions (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
2176 } |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15861
diff
changeset
|
2177 |
19945
f7a805f02723
link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents:
19930
diff
changeset
|
2178 bool |
f7a805f02723
link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents:
19930
diff
changeset
|
2179 file_editor::editor_tab_has_focus () |
f7a805f02723
link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents:
19930
diff
changeset
|
2180 { |
f7a805f02723
link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents:
19930
diff
changeset
|
2181 QWidget * foc_w = focusWidget (); |
f7a805f02723
link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents:
19930
diff
changeset
|
2182 if (foc_w && foc_w->inherits ("octave_qscintilla")) |
f7a805f02723
link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents:
19930
diff
changeset
|
2183 return true; |
f7a805f02723
link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents:
19930
diff
changeset
|
2184 return false; |
f7a805f02723
link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents:
19930
diff
changeset
|
2185 } |
f7a805f02723
link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents:
19930
diff
changeset
|
2186 |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16809
diff
changeset
|
2187 void |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2188 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
|
2189 { |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
2190 // Shortcuts also available in the main window, as well as the realted |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
2191 // ahotcuts, are defined in main_window and added to the editor |
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
2192 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2193 // File menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2194 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:
18656
diff
changeset
|
2195 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:
18656
diff
changeset
|
2196 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:
18656
diff
changeset
|
2197 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:
18656
diff
changeset
|
2198 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:
18656
diff
changeset
|
2199 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:
18656
diff
changeset
|
2200 shortcut_manager::set_shortcut (_print_action, "editor_file:print"); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
2201 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2202 // Edit menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2203 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:
18656
diff
changeset
|
2204 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:
18656
diff
changeset
|
2205 shortcut_manager::set_shortcut (_find_action, "editor_edit:find_replace"); |
22169
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2206 shortcut_manager::set_shortcut (_find_next_action, "editor_edit:find_next"); |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2207 shortcut_manager::set_shortcut (_find_previous_action, "editor_edit:find_previous"); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
2208 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2209 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:
18656
diff
changeset
|
2210 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:
18656
diff
changeset
|
2211 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:
18656
diff
changeset
|
2212 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:
18656
diff
changeset
|
2213 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:
18656
diff
changeset
|
2214 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:
18656
diff
changeset
|
2215 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:
18656
diff
changeset
|
2216 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:
18656
diff
changeset
|
2217 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:
18656
diff
changeset
|
2218 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:
18656
diff
changeset
|
2219 shortcut_manager::set_shortcut (_uncomment_selection_action, "editor_edit:uncomment_selection"); |
18611
086093fbdc1a
first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents:
18575
diff
changeset
|
2220 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2221 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:
18656
diff
changeset
|
2222 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:
18656
diff
changeset
|
2223 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:
18656
diff
changeset
|
2224 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:
18656
diff
changeset
|
2225 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:
18656
diff
changeset
|
2226 shortcut_manager::set_shortcut (_goto_line_action, "editor_edit:goto_line"); |
19629
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
2227 shortcut_manager::set_shortcut (_move_to_matching_brace, "editor_edit:move_to_brace"); |
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
2228 shortcut_manager::set_shortcut (_sel_to_matching_brace, "editor_edit:select_to_brace"); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2229 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:
18656
diff
changeset
|
2230 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:
18656
diff
changeset
|
2231 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:
18656
diff
changeset
|
2232 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:
18656
diff
changeset
|
2233 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:
18656
diff
changeset
|
2234 shortcut_manager::set_shortcut (_styles_preferences_action, "editor_edit:styles_preferences"); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
2235 |
19247
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
2236 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:
19246
diff
changeset
|
2237 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:
19246
diff
changeset
|
2238 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:
19246
diff
changeset
|
2239 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2240 // View menu |
19246
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
2241 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:
19085
diff
changeset
|
2242 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:
19085
diff
changeset
|
2243 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:
19085
diff
changeset
|
2244 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:
19085
diff
changeset
|
2245 shortcut_manager::set_shortcut (_show_longline_action, "editor_view:show_long_line"); |
20992
73e92fca3c78
GUI: add editor toolbar display option (Bug #46705)
John Donoghue <john.donoghue@ieee.org>
parents:
20989
diff
changeset
|
2246 shortcut_manager::set_shortcut (_show_toolbar_action, "editor_view:show_toolbar"); |
21001
1c91ff4cf9ec
add a menu entry for showing/hiding the editor status bar
Torsten <ttl@justmail.de>
parents:
20995
diff
changeset
|
2247 shortcut_manager::set_shortcut (_show_statusbar_action, "editor_view:show_statusbar"); |
21002
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
2248 shortcut_manager::set_shortcut (_show_hscrollbar_action, "editor_view:show_hscrollbar"); |
18685
03edfcd943db
fix setting shortcuts for the view menu in the editor
Torsten <ttl@justmail.de>
parents:
18684
diff
changeset
|
2249 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:
18684
diff
changeset
|
2250 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:
18684
diff
changeset
|
2251 shortcut_manager::set_shortcut (_zoom_normal_action, "editor_view:zoom_normal"); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
2252 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2253 // Debug menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2254 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:
18656
diff
changeset
|
2255 shortcut_manager::set_shortcut (_next_breakpoint_action, "editor_debug:next_breakpoint"); |
19930
3c414ad460d5
fix shortcut for previous bookmark (bug #44505)
Torsten <ttl@justmail.de>
parents:
19916
diff
changeset
|
2256 shortcut_manager::set_shortcut (_previous_breakpoint_action, "editor_debug:previous_breakpoint"); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2257 shortcut_manager::set_shortcut (_remove_all_breakpoints_action, "editor_debug:remove_breakpoints"); |
18624
a827fc5fe59d
handle actions from the editors file and edit menu via the shortcut manager
Torsten <ttl@justmail.de>
parents:
18611
diff
changeset
|
2258 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2259 // Run menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2260 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:
18656
diff
changeset
|
2261 shortcut_manager::set_shortcut (_run_selection_action, "editor_run:run_selection"); |
18560
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
2262 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2263 // Help menu |
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2264 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:
18656
diff
changeset
|
2265 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
|
2266 |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2267 // Tab navigation without menu entries |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2268 shortcut_manager::set_shortcut (_switch_left_tab_action, "editor_tabs:switch_left_tab"); |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2269 shortcut_manager::set_shortcut (_switch_right_tab_action, "editor_tabs:switch_right_tab"); |
20705
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2270 shortcut_manager::set_shortcut (_move_tab_left_action, "editor_tabs:move_tab_left"); |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2271 shortcut_manager::set_shortcut (_move_tab_right_action, "editor_tabs:move_tab_right"); |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2272 |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
2273 } |
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
2274 |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
2275 void |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
2276 file_editor::check_actions () |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
2277 { |
21562
6c2fd62db1f7
maint: Eliminate accidental double spaces in code.
Rik <rik@octave.org>
parents:
21352
diff
changeset
|
2278 bool have_tabs = _tab_widget->count () > 0; |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
2279 |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
2280 _edit_cmd_menu->setEnabled (have_tabs); |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
2281 _edit_fmt_menu->setEnabled (have_tabs); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2282 _edit_nav_menu->setEnabled (have_tabs); |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
2283 |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
2284 _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
|
2285 _uncomment_selection_action->setEnabled (have_tabs); |
18303
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
2286 _indent_selection_action->setEnabled (have_tabs); |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
2287 _unindent_selection_action->setEnabled (have_tabs); |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18294
diff
changeset
|
2288 |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
17009
diff
changeset
|
2289 _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
|
2290 _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
|
2291 |
19246
62756ba9e4e5
add actions for showing text formatting chars and guides in the editor
Torsten <ttl@justmail.de>
parents:
19085
diff
changeset
|
2292 _view_editor_menu->setEnabled (have_tabs); |
18560
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
2293 _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:
18555
diff
changeset
|
2294 _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:
18555
diff
changeset
|
2295 _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:
18555
diff
changeset
|
2296 |
17009
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
2297 _find_action->setEnabled (have_tabs); |
22169
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2298 _find_next_action->setEnabled (have_tabs); |
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2299 _find_previous_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
|
2300 _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
|
2301 _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
|
2302 |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2303 _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
|
2304 _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
|
2305 _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
|
2306 _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
|
2307 _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
|
2308 _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
|
2309 } |
adf06e03fbdd
Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents:
16981
diff
changeset
|
2310 |
18399
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2311 // 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:
18345
diff
changeset
|
2312 // 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:
18345
diff
changeset
|
2313 // (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:
18345
diff
changeset
|
2314 // 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:
18345
diff
changeset
|
2315 void |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2316 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:
18345
diff
changeset
|
2317 { |
20086
23fb65b45d8c
do not call custom editor at startup and when debugging (bug #44701)
Torsten <ttl@justmail.de>
parents:
20002
diff
changeset
|
2318 QSettings *settings = resource_manager::get_settings (); |
23fb65b45d8c
do not call custom editor at startup and when debugging (bug #44701)
Torsten <ttl@justmail.de>
parents:
20002
diff
changeset
|
2319 if (settings->value ("useCustomFileEditor",false).toBool ()) |
23fb65b45d8c
do not call custom editor at startup and when debugging (bug #44701)
Torsten <ttl@justmail.de>
parents:
20002
diff
changeset
|
2320 return; // do not open an empty script in the external editor |
23fb65b45d8c
do not call custom editor at startup and when debugging (bug #44701)
Torsten <ttl@justmail.de>
parents:
20002
diff
changeset
|
2321 |
18399
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2322 bool real_visible; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2323 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2324 if (startup) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2325 real_visible = isVisible (); |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2326 else |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2327 real_visible = visible; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2328 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2329 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:
18345
diff
changeset
|
2330 return; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2331 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2332 if (startup && ! isFloating ()) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2333 { |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2334 // 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:
18345
diff
changeset
|
2335 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:
18345
diff
changeset
|
2336 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2337 bool in_tab = false; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2338 int i = 0; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2339 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:
18345
diff
changeset
|
2340 { |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2341 QTabBar *tab = tab_list.at (i); |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2342 i++; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2343 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2344 int j = 0; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2345 while ((j < tab->count ()) && (! in_tab)) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2346 { |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2347 // check all tabs for the editor |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2348 if (tab->tabText (j) == windowTitle ()) |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2349 { |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2350 // editor is in this tab widget |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2351 in_tab = true; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2352 int top = tab->currentIndex (); |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2353 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:
18345
diff
changeset
|
2354 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:
18345
diff
changeset
|
2355 else |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2356 return; // not current tab -> not visible |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2357 } |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2358 j++; |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2359 } |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2360 } |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2361 } |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2362 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2363 request_new_file (""); |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2364 } |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2365 |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2366 // 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:
18345
diff
changeset
|
2367 // 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:
18345
diff
changeset
|
2368 // and is made visible |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2369 void |
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2370 file_editor::handle_visibility (bool visible) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2371 { |
23204
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2372 if (_closed && visible) |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2373 { |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2374 _closed = false; |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2375 QSettings *settings = resource_manager::get_settings (); |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2376 restore_session (settings); |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2377 } |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2378 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2379 empty_script (false, visible); |
18399
2ea741d22554
create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents:
18345
diff
changeset
|
2380 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2381 if (visible && ! isFloating ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2382 focus (); |
23204
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2383 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2384 } |
16970
78116b88dbf5
enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents:
16912
diff
changeset
|
2385 |
19595
be7ac98fab43
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19427
diff
changeset
|
2386 void |
18688
02b75b57ed80
clean up some compiler warnings
Torsten <ttl@justmail.de>
parents:
18687
diff
changeset
|
2387 file_editor::dragEnterEvent (QDragEnterEvent *e) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2388 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2389 if (e->mimeData ()->hasUrls ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2390 { |
23070
bef714f45999
maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
2391 e->acceptProposedAction (); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2392 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2393 } |
18651
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18624
diff
changeset
|
2394 |
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18624
diff
changeset
|
2395 void |
18688
02b75b57ed80
clean up some compiler warnings
Torsten <ttl@justmail.de>
parents:
18687
diff
changeset
|
2396 file_editor::dropEvent (QDropEvent *e) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2397 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2398 if (e->mimeData ()->hasUrls ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2399 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2400 foreach (QUrl url, e->mimeData ()->urls ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2401 request_open_file (url.toLocalFile ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2402 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
2403 } |
18651
992b6354c8c6
GUI: implement file drag and drop to command and edit window (Bug #41443)
John Donoghue
parents:
18624
diff
changeset
|
2404 |
23204
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2405 // handler for the close event |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2406 void |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2407 file_editor::closeEvent (QCloseEvent *e) |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2408 { |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2409 QSettings *settings = resource_manager::get_settings (); |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2410 if (settings->value ("editor/hiding_closes_files",false).toBool ()) |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2411 { |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2412 if (check_closing ()) |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2413 { |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2414 // all tabs are closed without cancelling, |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2415 // store closing state for restoring session when shown again |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2416 _closed = true; |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2417 e->accept (); |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2418 } |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2419 else |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2420 e->ignore (); |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2421 } |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2422 else |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2423 e->accept (); |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2424 } |
75515a7b1b4b
add preference for closing files when editor is closed/hidden (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23199
diff
changeset
|
2425 |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2426 // slots for tab navigation |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2427 void |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2428 file_editor::switch_left_tab () |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2429 { |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2430 switch_tab (-1); |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2431 } |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2432 void |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2433 file_editor::switch_right_tab () |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2434 { |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2435 switch_tab (1); |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2436 } |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2437 void |
20705
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2438 file_editor::move_tab_left () |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2439 { |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21650
diff
changeset
|
2440 #if defined (HAVE_QTABWIDGET_SETMOVABLE) |
20705
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2441 switch_tab (-1, true); |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2442 #endif |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2443 } |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2444 void |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2445 file_editor::move_tab_right () |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2446 { |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21650
diff
changeset
|
2447 #if defined (HAVE_QTABWIDGET_SETMOVABLE) |
20705
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2448 switch_tab (1, true); |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2449 #endif |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2450 } |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2451 void |
20720
7c21b151b8b4
build: Fix warning messages from compiler.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
2452 file_editor::switch_tab (int direction, bool movetab) |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2453 { |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2454 int tabs = _tab_widget->count (); |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2455 |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2456 if (tabs < 2) |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2457 return; |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2458 |
20705
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2459 int old_pos = _tab_widget->currentIndex (); |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2460 int new_pos = _tab_widget->currentIndex () + direction; |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2461 |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2462 if (new_pos < 0 || new_pos >= tabs) |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2463 new_pos = new_pos - direction*tabs; |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2464 |
20720
7c21b151b8b4
build: Fix warning messages from compiler.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
2465 if (movetab) |
20705
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2466 { |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21650
diff
changeset
|
2467 #if defined (HAVE_QTABWIDGET_SETMOVABLE) |
20720
7c21b151b8b4
build: Fix warning messages from compiler.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
2468 _tab_widget->tabBar ()->moveTab (old_pos, new_pos); |
20705
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2469 _tab_widget->setCurrentIndex (old_pos); |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2470 _tab_widget->setCurrentIndex (new_pos); |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2471 focus (); |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2472 #endif |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2473 } |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2474 else |
632683d6396f
provide actions for moving the editor tabs by shortscuts
Torsten <ttl@justmail.de>
parents:
20697
diff
changeset
|
2475 _tab_widget->setCurrentIndex (new_pos); |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2476 } |
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2477 |
23304
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2478 |
23276
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2479 // |
23304
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2480 // Functions of the the reimplemented tab bar |
23276
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2481 // |
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2482 |
23304
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2483 file_editor_tab_bar::file_editor_tab_bar (QWidget *p) |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2484 : QTabBar (p) |
23321
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2485 { |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2486 _context_menu = new QMenu (this); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2487 } |
23304
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2488 |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2489 file_editor_tab_bar::~file_editor_tab_bar () |
23321
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2490 { |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2491 delete _context_menu; |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2492 } |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2493 |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2494 // Create the context menu and fill it with actions from the editor |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2495 void |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2496 file_editor_tab_bar::create_context_menu (QList<QAction*> *actions) |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2497 { |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2498 for (int i = 0; i < actions->count (); i++) |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2499 _context_menu->addAction (actions->at (i)); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2500 } |
23304
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2501 |
23276
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2502 // Reimplement mouse event for filtering out the desired mouse clicks |
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2503 void |
23304
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2504 file_editor_tab_bar::mousePressEvent (QMouseEvent *me) |
23276
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2505 { |
23321
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2506 QPoint click_pos; |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2507 int clicked_idx = -1; |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2508 |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2509 // detect the tab where the click occured |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2510 for (int i = 0; i < count (); i++) |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2511 { |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2512 click_pos = mapToGlobal (me->pos ()); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2513 if (tabRect (i).contains (mapFromGlobal (click_pos))) |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2514 { |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2515 clicked_idx = i; |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2516 break; |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2517 } |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2518 } |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2519 |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2520 // If a tab was clicked |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2521 if (clicked_idx >= 0) |
23276
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2522 { |
23321
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2523 int current_idx = currentIndex (); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2524 // detect the mouse click |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2525 if ((me->type () == QEvent::MouseButtonDblClick && |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2526 me->button() == Qt::LeftButton) || |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2527 (me->type () != QEvent::MouseButtonDblClick && |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2528 me->button() == Qt::MidButton)) |
23276
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2529 { |
23321
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2530 // Middle click or double click -> close the tab |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2531 // Make the clicked tab the current one and close it |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2532 setCurrentIndex (clicked_idx); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2533 emit close_current_tab_signal (true); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2534 // Was the closed tab before or after the previously current tab? |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2535 // According to the result, use previous index or reduce it by one |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2536 if (current_idx - clicked_idx > 0) |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2537 setCurrentIndex (current_idx - 1); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2538 else if (current_idx - clicked_idx < 0) |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2539 setCurrentIndex (current_idx); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2540 } |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2541 else if (me->type () != QEvent::MouseButtonDblClick && |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2542 me->button() == Qt::RightButton) |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2543 { |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2544 // Right click, show context menu |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2545 setCurrentIndex (clicked_idx); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2546 if (! _context_menu->exec (click_pos)) |
23276
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2547 { |
23321
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2548 // No action selected, back to previous tab |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2549 setCurrentIndex (current_idx); |
23276
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2550 } |
23321
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2551 else |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2552 { |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2553 // Was the possibly only closed tab before or after the |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2554 // previously current tab? According to the result, use previous |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2555 // index or reduce it by one. Also prevent using a too large |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2556 // if other or all files were closed. |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2557 int new_idx = count () - 1; |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2558 if (new_idx > 0) |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2559 { |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2560 if (current_idx - clicked_idx > 0) |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2561 new_idx = current_idx - 1; |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2562 else if (current_idx - clicked_idx < 0) |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2563 new_idx = current_idx; |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2564 } |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2565 if (new_idx >= 0) |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2566 setCurrentIndex (new_idx); |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2567 } |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2568 } |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2569 else |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2570 { |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2571 // regular handling of the mouse event |
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2572 QTabBar::mousePressEvent (me); |
23276
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2573 } |
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2574 } |
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2575 else |
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2576 { |
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2577 // regular handling of the mouse event |
23304
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2578 QTabBar::mousePressEvent (me); |
23276
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2579 } |
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2580 } |
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2581 |
23304
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2582 |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2583 |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2584 // |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2585 // Functions of the the reimplemented tab widget |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2586 // |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2587 |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2588 file_editor_tab_widget::file_editor_tab_widget (QWidget *p) |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2589 : QTabWidget (p) |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2590 { |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2591 file_editor_tab_bar* bar; |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2592 bar = new file_editor_tab_bar (this); |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2593 |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2594 connect (bar, SIGNAL (close_current_tab_signal (bool)), |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2595 p->parent (), SLOT (request_close_file (bool))); |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2596 |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2597 this->setTabBar(bar); |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2598 } |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2599 |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2600 file_editor_tab_widget::~file_editor_tab_widget () |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2601 { } |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2602 |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2603 QTabBar* |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2604 file_editor_tab_widget::tabBar () const |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2605 { |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2606 return (QTabWidget::tabBar ()); |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2607 } |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2608 |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2609 |
23300
5bddd4089386
* file-editor.cc: fix compiling wihtout qscintilla (bug #50572)
Torsten <mttl@mailbox.org>
parents:
23298
diff
changeset
|
2610 #endif |