Mercurial > octave
annotate libgui/src/m-editor/file-editor.cc @ 30964:04601f6c47f4
fix broken icon path after new icon structure in GUI
* community-news.cc: use window icon configured in the preferences
* documentation-dock-widget.cc (documentation_dock_widget)
* files-dock-widget.cc (files_dock_widget)
* history-dock-widget.cc (history_dock_widget)
* terminal-dock-widget.cc (terminal_dock_widget)
* variable-editor.cc (variable_editor)
* workspace-view.cc (workspace_view)
do not set window icon here as it is set in the main window
* gui-preferences-dw.h: organize dw_icon_set_names in a hash
* file-editor.cc (notice_settings): fix path to tab close icon on mac
* find-dialog.cc (find_dialog): do not set window icon here, it is
already set by the editor
* main-window.cc (notice_settings): set dok widget icons using the
new hash structure of available icon sets
(construct): use global const settings instead of literal string
for main window icon
* octave-qobject.cc (release_notes_widget): pass base qobject
to the release note constructor
* release-notes.cc (release_notes): get qbase object as argument,
get desired window icon from settings
* release-notes.h: constructor with base object as argument
* variable-editor.cc (toplevel_change): use icon path from const
preferences instead of literal strings
* welcome-wizard.cc (make_octave_logo): use icon path from const
preferences instead of literal strings
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Sat, 23 Apr 2022 18:10:45 +0200 |
parents | 36dc11ee220d |
children | ba701853b1bf |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30398
diff
changeset
|
3 // Copyright (C) 2011-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
13501 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21650
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
27 # include "config.h" |
15286
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
28 #endif |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
29 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21650
diff
changeset
|
30 #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
|
31 |
28836
d0a64e67749e
avoid deprecated qSort function
John W. Eaton <jwe@octave.org>
parents:
28382
diff
changeset
|
32 #include <algorithm> |
d0a64e67749e
avoid deprecated qSort function
John W. Eaton <jwe@octave.org>
parents:
28382
diff
changeset
|
33 |
13501 | 34 #include <QApplication> |
29469
b4906d3eeb63
provide a tab context menu entry for copying the full path of an editor file
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29468
diff
changeset
|
35 #include <QClipboard> |
13501 | 36 #include <QFile> |
22250
2fd4f1a3f4a8
allow building with Qt5 (bug #40252)
John W. Eaton <jwe@octave.org>
parents:
22179
diff
changeset
|
37 #include <QFileDialog> |
13584 | 38 #include <QFont> |
13501 | 39 #include <QMessageBox> |
22250
2fd4f1a3f4a8
allow building with Qt5 (bug #40252)
John W. Eaton <jwe@octave.org>
parents:
22179
diff
changeset
|
40 #include <QMimeData> |
2fd4f1a3f4a8
allow building with Qt5 (bug #40252)
John W. Eaton <jwe@octave.org>
parents:
22179
diff
changeset
|
41 #include <QProcess> |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
24731
diff
changeset
|
42 #include <QPushButton> |
13501 | 43 #include <QStyle> |
22250
2fd4f1a3f4a8
allow building with Qt5 (bug #40252)
John W. Eaton <jwe@octave.org>
parents:
22179
diff
changeset
|
44 #include <QTabBar> |
13501 | 45 #include <QTextStream> |
22250
2fd4f1a3f4a8
allow building with Qt5 (bug #40252)
John W. Eaton <jwe@octave.org>
parents:
22179
diff
changeset
|
46 #include <QVBoxLayout> |
18656
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18651
diff
changeset
|
47 #include <Qsci/qscicommandset.h> |
13501 | 48 |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27404
diff
changeset
|
49 #include "file-editor.h" |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27556
diff
changeset
|
50 #include "gui-preferences-ed.h" |
27818
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
51 #include "gui-preferences-sc.h" |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27556
diff
changeset
|
52 #include "gui-preferences-global.h" |
23479
06bf3a0b08bf
maint: Use "" instead of <> for our own include files.
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
53 #include "main-window.h" |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
54 #include "octave-qobject.h" |
29560
5b7e721844df
provide QOverload template if it is not in <QtGlobal> (bug #60416)
John W. Eaton <jwe@octave.org>
parents:
29550
diff
changeset
|
55 #include "octave-qtutils.h" |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27404
diff
changeset
|
56 #include "shortcut-manager.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
|
57 |
25790
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
58 #include "oct-env.h" |
27404
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
59 |
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
60 #include "event-manager.h" |
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
61 #include "interpreter.h" |
23479
06bf3a0b08bf
maint: Use "" instead of <> for our own include files.
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
62 #include "oct-map.h" |
27404
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
63 #include "pt-eval.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
|
64 #include "utils.h" |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
65 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
66 namespace octave |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
67 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
68 // Functions of the the reimplemented tab widget |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
69 |
29713
7b4b7e2a524d
fix signal connection to grand parent
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29707
diff
changeset
|
70 file_editor_tab_widget::file_editor_tab_widget (QWidget *p, file_editor *fe) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
71 : QTabWidget (p) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
72 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
73 tab_bar *bar = new tab_bar (this); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
74 |
29713
7b4b7e2a524d
fix signal connection to grand parent
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29707
diff
changeset
|
75 connect (bar, &tab_bar::close_current_tab_signal, |
7b4b7e2a524d
fix signal connection to grand parent
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29707
diff
changeset
|
76 fe, &file_editor::request_close_file); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
77 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
78 this->setTabBar (bar); |
24713 | 79 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
80 setTabsClosable (true); |
27054
1e70f1fe7c0e
always use scroll buttons in case of too many tabs (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27053
diff
changeset
|
81 setUsesScrollButtons (true); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
82 setMovable (true); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
83 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
84 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
85 tab_bar *file_editor_tab_widget::get_tab_bar (void) const |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
86 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
87 return qobject_cast<tab_bar *> (tabBar ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
88 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
89 |
27633
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
90 std::list<file_editor_tab *> |
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
91 file_editor_tab_widget::tab_list (void) const |
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
92 { |
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
93 std::list<file_editor_tab *> retval; |
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
94 for (int i = 0; i < count (); i++) |
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
95 retval.push_back (static_cast<file_editor_tab *> (widget (i))); |
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
96 return retval; |
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
97 } |
24713 | 98 |
28382
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
99 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
100 // File editor |
24713 | 101 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
102 file_editor::file_editor (QWidget *p, base_qobject& oct_qobj) |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
103 : file_editor_interface (p, oct_qobj) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
104 { |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
105 // Set current editing directory before construction because loaded |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
106 // files will change ced accordingly. |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
107 m_ced = QDir::currentPath (); |
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
|
108 |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
109 // Set actions that are later added by the main window to null, |
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
110 // preventing access to them when they are still undefined. |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
111 m_undo_action = nullptr; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
112 m_copy_action = nullptr; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
113 m_paste_action = nullptr; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
114 m_selectall_action = nullptr; |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
115 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
116 m_find_dialog = nullptr; |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
117 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
118 m_closed = false; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
119 m_no_focus = false; |
29715
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
120 m_editor_ready = false; |
20986
00835323fb44
prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents:
20955
diff
changeset
|
121 |
27075
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
122 m_copy_action_enabled = false; |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
123 m_undo_action_enabled = false; |
29698
bbf5d4ea616c
fix enabled state of editor save action depending on modification state
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29691
diff
changeset
|
124 m_current_tab_modified = false; |
27075
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
125 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
126 construct (); |
22169
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
127 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
128 setVisible (false); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
129 setAcceptDrops (true); |
28382
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
130 setFocusPolicy (Qt::StrongFocus); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
131 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
132 |
28382
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
133 void file_editor::focusInEvent (QFocusEvent *e) |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
134 { |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
135 // The focus is transferred to the active tab and its edit |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
136 // area in this focus in event handler. This is to avoid |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
137 // using focus proxies with conflicts in the proxy change |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
138 // presumably introduced by bug |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
139 // https://bugreports.qt.io/browse/QTBUG-61092 |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
140 reset_focus (); // Make sure editor tab with edit area get focus |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
141 |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
142 QDockWidget::focusInEvent (e); |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
143 } |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
144 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
145 // insert global actions, that should also be displayed in the editor window, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
146 // into the editor's menu and/or toolbar |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
147 void file_editor::insert_global_actions (QList<QAction *> shared_actions) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
148 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
149 // actions/menus that have to be added to the toolbar or the menu |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
150 QAction *open_action = shared_actions.at (OPEN_ACTION); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
151 QAction *new_action = shared_actions.at (NEW_SCRIPT_ACTION); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
152 QAction *new_fcn_action = shared_actions.at (NEW_FUNCTION_ACTION); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
153 m_fileMenu->insertAction (m_mru_file_menu->menuAction (), open_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
154 m_fileMenu->insertAction (open_action, new_fcn_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
155 m_fileMenu->insertAction (new_fcn_action, new_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
156 m_tool_bar->insertAction (m_popdown_mru_action, open_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
157 m_tool_bar->insertAction (open_action, new_action); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
158 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
159 // actions that are additionally enabled/disabled later by the editor |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
160 // undo |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
161 m_undo_action = shared_actions.at (UNDO_ACTION); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
162 m_tool_bar->insertAction (m_redo_action, m_undo_action); |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
163 m_edit_menu->insertAction (m_redo_action, m_undo_action); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
164 // select all |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
165 m_selectall_action = shared_actions.at (SELECTALL_ACTION); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
166 m_edit_menu->insertAction (m_find_action, m_selectall_action); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
167 m_edit_menu->insertSeparator (m_find_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
168 // paste |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
169 m_paste_action = shared_actions.at (PASTE_ACTION); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
170 m_tool_bar->insertAction (m_find_action, m_paste_action); |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
171 m_edit_menu->insertAction (m_selectall_action, m_paste_action); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
172 m_edit_menu->insertSeparator (m_selectall_action); |
27074
d302dfa0c572
fix order of cut, copy paste actions in editor menu and toolbar (bug #56230)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27055
diff
changeset
|
173 // copy |
d302dfa0c572
fix order of cut, copy paste actions in editor menu and toolbar (bug #56230)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27055
diff
changeset
|
174 m_copy_action = shared_actions.at (COPY_ACTION); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
175 m_tool_bar->insertAction (m_paste_action, m_copy_action); |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
176 m_edit_menu->insertAction (m_paste_action, m_copy_action); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
177 // find files |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
178 m_find_files_action = shared_actions.at (FIND_FILES_ACTION); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
179 m_edit_menu->insertAction (m_find_action, m_find_files_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
180 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
181 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
182 void file_editor::handle_enter_debug_mode (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
183 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
184 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
185 gui_settings *settings = rmgr.get_settings (); |
27818
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
186 QString sc_run = settings->sc_value (sc_edit_run_run_file); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
187 QString sc_cont = settings->sc_value (sc_main_debug_continue); |
26875
ce972086bfd6
save & run action in editor now also continues in debug mode (bug #44730)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26873
diff
changeset
|
188 |
ce972086bfd6
save & run action in editor now also continues in debug mode (bug #44730)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26873
diff
changeset
|
189 if (sc_run == sc_cont) |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
190 m_run_action->setShortcut (QKeySequence ()); // prevent ambiguous shortcuts |
26875
ce972086bfd6
save & run action in editor now also continues in debug mode (bug #44730)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26873
diff
changeset
|
191 |
ce972086bfd6
save & run action in editor now also continues in debug mode (bug #44730)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26873
diff
changeset
|
192 m_run_action->setToolTip (tr ("Continue")); // update tool tip |
28798
82ccc4e69ba3
show value in editor when hovering over variable in debug mode (bug #56990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28788
diff
changeset
|
193 |
82ccc4e69ba3
show value in editor when hovering over variable in debug mode (bug #56990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28788
diff
changeset
|
194 emit enter_debug_mode_signal (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
195 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
196 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
197 void file_editor::handle_exit_debug_mode (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
198 { |
27630
262cdd0f7619
don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27629
diff
changeset
|
199 shortcut_manager& scmgr = m_octave_qobj.get_shortcut_manager (); |
27818
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
200 scmgr.set_shortcut (m_run_action, sc_edit_run_run_file); |
26875
ce972086bfd6
save & run action in editor now also continues in debug mode (bug #44730)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26873
diff
changeset
|
201 m_run_action->setToolTip (tr ("Save File and Run")); // update tool tip |
28798
82ccc4e69ba3
show value in editor when hovering over variable in debug mode (bug #56990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28788
diff
changeset
|
202 |
82ccc4e69ba3
show value in editor when hovering over variable in debug mode (bug #56990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28788
diff
changeset
|
203 emit exit_debug_mode_signal (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
204 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
205 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
206 void file_editor::check_actions (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
207 { |
29439
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
208 // Do not include shared actions not only related to the editor |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
209 bool have_tabs = m_tab_widget->count () > 0; |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
210 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
211 m_edit_cmd_menu->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
212 m_edit_fmt_menu->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
213 m_edit_nav_menu->setEnabled (have_tabs); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
214 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
215 m_comment_selection_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
216 m_uncomment_selection_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
217 m_comment_var_selection_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
218 m_indent_selection_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
219 m_unindent_selection_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
220 m_smart_indent_line_or_selection_action->setEnabled (have_tabs); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
221 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
222 m_context_help_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
223 m_context_doc_action->setEnabled (have_tabs); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
224 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
225 m_view_editor_menu->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
226 m_zoom_in_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
227 m_zoom_out_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
228 m_zoom_normal_action->setEnabled (have_tabs); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
229 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
230 m_find_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
231 m_find_next_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
232 m_find_previous_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
233 m_print_action->setEnabled (have_tabs); |
29439
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
234 |
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
235 m_run_action->setEnabled (have_tabs && m_is_octave_file); |
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
236 |
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
237 m_toggle_breakpoint_action->setEnabled (have_tabs && m_is_octave_file); |
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
238 m_next_breakpoint_action->setEnabled (have_tabs && m_is_octave_file); |
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
239 m_previous_breakpoint_action->setEnabled (have_tabs && m_is_octave_file); |
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
240 m_remove_all_breakpoints_action->setEnabled (have_tabs && m_is_octave_file); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
241 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
242 m_edit_function_action->setEnabled (have_tabs); |
29698
bbf5d4ea616c
fix enabled state of editor save action depending on modification state
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29691
diff
changeset
|
243 m_save_action->setEnabled (have_tabs && m_current_tab_modified); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
244 m_save_as_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
245 m_close_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
246 m_close_all_action->setEnabled (have_tabs); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
247 m_close_others_action->setEnabled (have_tabs && m_tab_widget->count () > 1); |
27330
e449134870fb
allow to sort editor tabs alphabetically (bug #42602)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27302
diff
changeset
|
248 m_sort_tabs_action->setEnabled (have_tabs && m_tab_widget->count () > 1); |
26873
9ec36417c262
debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26561
diff
changeset
|
249 |
29439
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
250 emit editor_tabs_changed_signal (have_tabs, m_is_octave_file); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
251 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
252 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
253 // empty_script determines whether we have to create an empty script |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
254 // 1. At startup, when the editor has to be (really) visible |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
255 // (Here we can not use the visibility changed signal) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
256 // 2. When the editor becomes visible when octave is running |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
257 void file_editor::empty_script (bool startup, bool visible) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
258 { |
29715
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
259 |
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
260 if (startup) |
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
261 m_editor_ready = true; |
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
262 else |
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
263 { |
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
264 if (! m_editor_ready) |
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
265 return; // not yet ready but got visibility changed signals |
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
266 } |
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
267 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
268 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
269 gui_settings *settings = rmgr.get_settings (); |
27805
dccc551aa83b
replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27787
diff
changeset
|
270 if (settings->value (global_use_custom_editor.key, |
dccc551aa83b
replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27787
diff
changeset
|
271 global_use_custom_editor.def).toBool ()) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
272 return; // do not open an empty script in the external editor |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
273 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
274 bool real_visible; |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
275 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
276 if (startup) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
277 real_visible = isVisible (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
278 else |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
279 real_visible = visible; |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
280 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
281 if (! real_visible || m_tab_widget->count () > 0) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
282 return; |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
283 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
284 if (startup && ! isFloating ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
285 { |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
286 // check if editor is really visible or hidden between tabbed widgets |
29597
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
287 QWidget *parent = parentWidget (); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
288 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
289 if (parent) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
290 { |
29597
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
291 QList<QTabBar *> tab_list = parent->findChildren<QTabBar *>(); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
292 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
293 bool in_tab = false; |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
294 int i = 0; |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
295 while ((i < tab_list.count ()) && (! in_tab)) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
296 { |
29597
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
297 QTabBar *tab = tab_list.at (i); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
298 i++; |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
299 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
300 int j = 0; |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
301 while ((j < tab->count ()) && (! in_tab)) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
302 { |
29597
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
303 // check all tabs for the editor |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
304 if (tab->tabText (j) == windowTitle ()) |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
305 { |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
306 // editor is in this tab widget |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
307 in_tab = true; |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
308 int top = tab->currentIndex (); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
309 if (! (top > -1 && tab->tabText (top) == windowTitle ())) |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
310 return; // not current tab -> not visible |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
311 } |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
312 j++; |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
313 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
314 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
315 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
316 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
317 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
318 request_new_file (""); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
319 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
320 |
27611
0495b64288f7
use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
27605
diff
changeset
|
321 void file_editor::restore_session (gui_settings *settings) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
322 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
323 //restore previous session |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
324 if (! settings->value (ed_restore_session).toBool ()) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
325 return; |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
326 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
327 // get the data from the settings file |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
328 QStringList sessionFileNames |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27651
diff
changeset
|
329 = settings->value (ed_session_names).toStringList (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
330 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
331 QStringList session_encodings |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27651
diff
changeset
|
332 = settings->value (ed_session_enc).toStringList (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
333 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
334 QStringList session_index |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27651
diff
changeset
|
335 = settings->value (ed_session_ind).toStringList (); |
25748
f3aa4a90b91f
also restore cursor line numbers when restoring previous editor session_data
Torsten <mttl@mailbox.org>
parents:
25743
diff
changeset
|
336 |
f3aa4a90b91f
also restore cursor line numbers when restoring previous editor session_data
Torsten <mttl@mailbox.org>
parents:
25743
diff
changeset
|
337 QStringList session_lines |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27651
diff
changeset
|
338 = settings->value (ed_session_lines).toStringList (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
339 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
340 // fill a list of the struct and sort it (depending on index) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
341 QList<session_data> s_data; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
342 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
343 bool do_encoding = (session_encodings.count () == sessionFileNames.count ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
344 bool do_index = (session_index.count () == sessionFileNames.count ()); |
25748
f3aa4a90b91f
also restore cursor line numbers when restoring previous editor session_data
Torsten <mttl@mailbox.org>
parents:
25743
diff
changeset
|
345 bool do_lines = (session_lines.count () == sessionFileNames.count ()); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
346 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
347 for (int n = 0; n < sessionFileNames.count (); ++n) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
348 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
349 QFileInfo file = QFileInfo (sessionFileNames.at (n)); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
350 if (! file.exists ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
351 continue; |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
352 |
25748
f3aa4a90b91f
also restore cursor line numbers when restoring previous editor session_data
Torsten <mttl@mailbox.org>
parents:
25743
diff
changeset
|
353 session_data item = { 0, -1, sessionFileNames.at (n), |
25743
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
354 QString (), QString ()}; |
25748
f3aa4a90b91f
also restore cursor line numbers when restoring previous editor session_data
Torsten <mttl@mailbox.org>
parents:
25743
diff
changeset
|
355 if (do_lines) |
f3aa4a90b91f
also restore cursor line numbers when restoring previous editor session_data
Torsten <mttl@mailbox.org>
parents:
25743
diff
changeset
|
356 item.line = session_lines.at (n).toInt (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
357 if (do_index) |
25293
ae0518976e2b
open files in correct order when restoring editor session (bug #53711)
Torsten <mttl@mailbox.org>
parents:
25274
diff
changeset
|
358 item.index = session_index.at (n).toInt (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
359 if (do_encoding) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
360 item.encoding = session_encodings.at (n); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
361 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
362 s_data << item; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
363 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
364 |
28836
d0a64e67749e
avoid deprecated qSort function
John W. Eaton <jwe@octave.org>
parents:
28382
diff
changeset
|
365 std::sort (s_data.begin (), s_data.end ()); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
366 |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
367 // finally open the files with the desired encoding in the desired order |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
368 for (int n = 0; n < s_data.count (); ++n) |
25748
f3aa4a90b91f
also restore cursor line numbers when restoring previous editor session_data
Torsten <mttl@mailbox.org>
parents:
25743
diff
changeset
|
369 request_open_file (s_data.at (n).file_name, s_data.at (n).encoding, |
f3aa4a90b91f
also restore cursor line numbers when restoring previous editor session_data
Torsten <mttl@mailbox.org>
parents:
25743
diff
changeset
|
370 s_data.at (n).line); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
371 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
372 |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27277
diff
changeset
|
373 void file_editor::activate (void) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
374 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
375 if (m_no_focus) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
376 return; // No focus for the editor if external open/close request |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
377 |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27277
diff
changeset
|
378 octave_dock_widget::activate (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
379 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
380 // set focus to current tab |
28382
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
381 reset_focus (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
382 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
383 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
384 void file_editor::set_focus (QWidget *fet) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
385 { |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27277
diff
changeset
|
386 setFocus (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
387 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
388 // set focus to desired tab |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
389 if (fet) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
390 m_tab_widget->setCurrentWidget (fet); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
391 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
392 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
393 // function enabling/disabling the menu accelerators depending on the |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
394 // focus of the editor |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
395 void file_editor::enable_menu_shortcuts (bool enable) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
396 { |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
397 // Hide or show the find dialog together with the focus of the |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
398 // editor widget depending on the overall visibility of the find dialog. |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
399 // Do not change internal visibility state. |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
400 if (m_find_dialog) |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
401 m_find_dialog->set_visible (enable); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
402 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
403 // Take care of the shortcuts |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
404 QHash<QMenu *, QStringList>::const_iterator i = m_hash_menu_text.constBegin (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
405 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
406 while (i != m_hash_menu_text.constEnd ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
407 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
408 i.key ()->setTitle (i.value ().at (! enable)); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
409 ++i; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
410 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
411 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
412 // when editor loses focus, enable the actions, which are always active |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
413 // in the main window due to missing info on selected text and undo actions |
27075
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
414 if (m_copy_action && m_undo_action) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
415 { |
27075
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
416 if (enable) |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
417 { |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
418 m_copy_action->setEnabled (m_copy_action_enabled); |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
419 m_undo_action->setEnabled (m_undo_action_enabled); |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
420 } |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
421 else |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
422 { |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
423 m_copy_action_enabled = m_copy_action->isEnabled (); |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
424 m_undo_action_enabled = m_undo_action->isEnabled (); |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
425 m_copy_action->setEnabled (true); |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
426 m_undo_action->setEnabled (true); |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
427 } |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
428 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
429 } |
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
|
430 |
29372
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
431 // Save open files for restoring in next session |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
432 // (even if last session will not be restored next time) |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
433 // together with encoding and the tab index |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
434 void file_editor::save_session (void) |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
435 { |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
436 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
437 gui_settings *settings = rmgr.get_settings (); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
438 |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
439 QStringList fetFileNames; |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
440 QStringList fet_encodings; |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
441 QStringList fet_index; |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
442 QStringList fet_lines; |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
443 |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
444 std::list<file_editor_tab *> editor_tab_lst = m_tab_widget->tab_list (); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
445 |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
446 for (auto editor_tab : editor_tab_lst) |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
447 { |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
448 QString file_name = editor_tab->file_name (); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
449 |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
450 // Don't append unnamed files. |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
451 |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
452 if (! file_name.isEmpty ()) |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
453 { |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
454 fetFileNames.append (file_name); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
455 fet_encodings.append (editor_tab->encoding ()); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
456 |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
457 QString index; |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
458 fet_index.append (index.setNum (m_tab_widget->indexOf (editor_tab))); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
459 |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
460 int l, c; |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
461 editor_tab->qsci_edit_area ()->getCursorPosition (&l, &c); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
462 fet_lines.append (index.setNum (l + 1)); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
463 } |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
464 } |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
465 |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
466 settings->setValue (ed_session_names.key, fetFileNames); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
467 settings->setValue (ed_session_enc.key, fet_encodings); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
468 settings->setValue (ed_session_ind.key, fet_index); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
469 settings->setValue (ed_session_lines.key, fet_lines); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
470 settings->sync (); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
471 } |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
472 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
473 bool file_editor::check_closing (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
474 { |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
475 // When the application or the editor is closing and the user wants to |
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
476 // close all files, in the latter case all editor tabs are checked whether |
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
477 // they need to be saved. During these checks tabs are not closed since |
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
478 // the user might cancel closing Octave during one of these saving dialogs. |
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
479 // Therefore, saving the session for restoring at next start is not done |
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
480 // before the application is definitely closing. |
27633
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
481 |
29372
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
482 // Save the session. Even is closing is cancelled, this would be |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
483 // overwritten by the next attempt to close the editor |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
484 save_session (); |
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
485 |
27633
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
486 std::list<file_editor_tab *> fe_tab_lst = m_tab_widget->tab_list (); |
27651
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
487 m_number_of_tabs = fe_tab_lst.size (); |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
488 |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
489 for (auto fe_tab : fe_tab_lst) |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
490 { |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
491 // Wait for all editor tabs to have saved their files if required |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
492 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
493 connect (fe_tab, &file_editor_tab::tab_ready_to_close, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
494 this, &file_editor::handle_tab_ready_to_close, |
27651
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
495 Qt::UniqueConnection); |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
496 } |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
497 |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
498 m_closing_canceled = false; |
27633
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
499 |
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
500 for (auto fe_tab : fe_tab_lst) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
501 { |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
502 // If there was a cancellation, make the already saved/discarded tabs |
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
503 // recover from the exit by removing the read-only state and by |
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
504 // recovering the debugger breakpoints. Finally return false in order |
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
505 // to cancel closing the application or the editor. |
27633
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
506 |
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
507 if (fe_tab->check_file_modified (false) == QMessageBox::Cancel) |
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
508 { |
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
509 emit fetab_recover_from_exit (); |
27651
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
510 |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
511 m_closing_canceled = true; |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
512 |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
513 for (auto fet : fe_tab_lst) |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
514 disconnect (fet, &file_editor_tab::tab_ready_to_close, 0, 0); |
27651
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
515 |
27633
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
516 return false; |
fd009322dd9f
eliminate static variable in file_editor_tab class
John W. Eaton <jwe@octave.org>
parents:
27630
diff
changeset
|
517 } |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
518 } |
21054
221847e5f488
fix issues when restoring breakpoints and closing tabs or whole application
Torsten <ttl@justmail.de>
parents:
21002
diff
changeset
|
519 |
27605
60cecb3fed04
fix saving modified files when closing editor tabs or octave
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27560
diff
changeset
|
520 return true; |
60cecb3fed04
fix saving modified files when closing editor tabs or octave
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27560
diff
changeset
|
521 } |
60cecb3fed04
fix saving modified files when closing editor tabs or octave
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27560
diff
changeset
|
522 |
60cecb3fed04
fix saving modified files when closing editor tabs or octave
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27560
diff
changeset
|
523 void file_editor::handle_tab_ready_to_close (void) |
60cecb3fed04
fix saving modified files when closing editor tabs or octave
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27560
diff
changeset
|
524 { |
27651
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
525 if (m_closing_canceled) |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
526 return; |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
527 |
29747
c0466e8ab704
avoid crash when closing GUI with open editor tabs (bug #60500)
John W. Eaton <jwe@octave.org>
parents:
29573
diff
changeset
|
528 // FIXME: Why count down to zero here before doing anything? Why |
c0466e8ab704
avoid crash when closing GUI with open editor tabs (bug #60500)
John W. Eaton <jwe@octave.org>
parents:
29573
diff
changeset
|
529 // not remove and delete each tab that is ready to be closed, one |
c0466e8ab704
avoid crash when closing GUI with open editor tabs (bug #60500)
John W. Eaton <jwe@octave.org>
parents:
29573
diff
changeset
|
530 // per invocation? |
c0466e8ab704
avoid crash when closing GUI with open editor tabs (bug #60500)
John W. Eaton <jwe@octave.org>
parents:
29573
diff
changeset
|
531 |
27605
60cecb3fed04
fix saving modified files when closing editor tabs or octave
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27560
diff
changeset
|
532 m_number_of_tabs--; |
60cecb3fed04
fix saving modified files when closing editor tabs or octave
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27560
diff
changeset
|
533 |
60cecb3fed04
fix saving modified files when closing editor tabs or octave
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27560
diff
changeset
|
534 if (m_number_of_tabs > 0) |
60cecb3fed04
fix saving modified files when closing editor tabs or octave
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27560
diff
changeset
|
535 return; |
60cecb3fed04
fix saving modified files when closing editor tabs or octave
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27560
diff
changeset
|
536 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
537 // Here, the application or the editor will be closed -> store the session |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
538 |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
539 // Take care of the find dialog |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
540 if (m_find_dialog) |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
541 m_find_dialog->close (); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
542 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
543 // Finally close all the tabs and return indication that we can exit |
25357
7aeafec2b102
keep editor hidden at next startup when it was hidden (bug #53830)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
544 // the application or close the editor. |
27929
265b386f8b20
maint: Use two spaces between sentences in code comments.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
545 // Closing and deleting the tabs makes the editor visible. In case it was |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
546 // hidden before, this state has to be restored afterwards. |
25357
7aeafec2b102
keep editor hidden at next startup when it was hidden (bug #53830)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
547 bool vis = isVisible (); |
7aeafec2b102
keep editor hidden at next startup when it was hidden (bug #53830)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
548 |
29372
fd1c45b62ba9
fix restoring editor session after having closed all tabs (bug #60051)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
549 std::list<file_editor_tab *> editor_tab_lst = m_tab_widget->tab_list (); |
27636
dc319e1ea4a3
simplify loop over tabs in file_editor::handle_tab_ready_to_close
John W. Eaton <jwe@octave.org>
parents:
27635
diff
changeset
|
550 for (auto editor_tab : editor_tab_lst) |
29747
c0466e8ab704
avoid crash when closing GUI with open editor tabs (bug #60500)
John W. Eaton <jwe@octave.org>
parents:
29573
diff
changeset
|
551 editor_tab->deleteLater (); |
27636
dc319e1ea4a3
simplify loop over tabs in file_editor::handle_tab_ready_to_close
John W. Eaton <jwe@octave.org>
parents:
27635
diff
changeset
|
552 |
dc319e1ea4a3
simplify loop over tabs in file_editor::handle_tab_ready_to_close
John W. Eaton <jwe@octave.org>
parents:
27635
diff
changeset
|
553 m_tab_widget->clear (); |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
554 |
25357
7aeafec2b102
keep editor hidden at next startup when it was hidden (bug #53830)
Torsten <mttl@mailbox.org>
parents:
25354
diff
changeset
|
555 setVisible (vis); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
556 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
557 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
558 void file_editor::request_new_file (const QString& commands) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
559 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
560 // Custom editor? If yes, we can only call the editor without passing |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
561 // some initial contents and even without being sure a new file is opened |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
562 if (call_custom_editor ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
563 return; |
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
|
564 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
565 // New file isn't a file_editor_tab function since the file |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
566 // editor tab has yet to be created and there is no object to |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
567 // pass a signal to. Hence, functionality is here. |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
568 |
27400
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
569 file_editor_tab *fileEditorTab = make_file_editor_tab (m_ced); |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
570 add_file_editor_tab (fileEditorTab, ""); // new tab with empty title |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
571 fileEditorTab->new_file (commands); // title is updated here |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27277
diff
changeset
|
572 activate (); // focus editor and new tab |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
573 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
574 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
575 void file_editor::request_close_file (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
576 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
577 file_editor_tab *editor_tab |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
578 = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
579 editor_tab->conditional_close (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
580 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
581 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
582 void file_editor::request_close_all_files (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
583 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
584 file_editor_tab *editor_tab; |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
585 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
586 // loop over all tabs starting from last one otherwise deletion changes index |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
587 for (int index = m_tab_widget->count ()-1; index >= 0; index--) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
588 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
589 editor_tab = static_cast<file_editor_tab *> (m_tab_widget->widget (index)); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
590 editor_tab->conditional_close (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
591 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
592 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
593 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
594 void file_editor::request_close_other_files (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
595 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
596 file_editor_tab *editor_tab; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
597 QWidget *tabID = m_tab_widget->currentWidget (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
598 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
599 // loop over all tabs starting from last one otherwise deletion changes index |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
600 for (int index = m_tab_widget->count ()-1; index >= 0; index--) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
601 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
602 if (tabID != m_tab_widget->widget (index)) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
603 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
604 editor_tab |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
605 = static_cast<file_editor_tab *> (m_tab_widget->widget (index)); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
606 editor_tab->conditional_close (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
607 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
608 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
609 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
610 |
29469
b4906d3eeb63
provide a tab context menu entry for copying the full path of an editor file
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29468
diff
changeset
|
611 void file_editor::copy_full_file_path (bool) |
b4906d3eeb63
provide a tab context menu entry for copying the full path of an editor file
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29468
diff
changeset
|
612 { |
b4906d3eeb63
provide a tab context menu entry for copying the full path of an editor file
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29468
diff
changeset
|
613 file_editor_tab *editor_tab |
b4906d3eeb63
provide a tab context menu entry for copying the full path of an editor file
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29468
diff
changeset
|
614 = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ()); |
b4906d3eeb63
provide a tab context menu entry for copying the full path of an editor file
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29468
diff
changeset
|
615 |
b4906d3eeb63
provide a tab context menu entry for copying the full path of an editor file
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29468
diff
changeset
|
616 if (editor_tab) |
b4906d3eeb63
provide a tab context menu entry for copying the full path of an editor file
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29468
diff
changeset
|
617 QGuiApplication::clipboard ()->setText (editor_tab->file_name ()); |
b4906d3eeb63
provide a tab context menu entry for copying the full path of an editor file
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29468
diff
changeset
|
618 } |
b4906d3eeb63
provide a tab context menu entry for copying the full path of an editor file
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29468
diff
changeset
|
619 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
620 // open a file from the mru list |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
621 void file_editor::request_mru_open_file (QAction *action) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
622 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
623 if (action) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
624 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
625 request_open_file (action->data ().toStringList ().at (0), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
626 action->data ().toStringList ().at (1)); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
627 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
628 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
629 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
630 void file_editor::request_print_file (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
631 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
632 emit fetab_print_file (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
633 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
634 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
635 void file_editor::request_redo (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
636 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
637 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
638 QsciScintillaBase::SCI_REDO); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
639 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
640 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
641 void file_editor::request_cut (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
642 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
643 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
644 QsciScintillaBase::SCI_CUT); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
645 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
646 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
647 void file_editor::request_context_help (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
648 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
649 emit fetab_context_help (m_tab_widget->currentWidget (), false); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
650 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
651 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
652 void file_editor::request_context_doc (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
653 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
654 emit fetab_context_help (m_tab_widget->currentWidget (), true); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
655 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
656 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
657 void file_editor::request_context_edit (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
658 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
659 emit fetab_context_edit (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
660 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
661 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
662 void file_editor::request_save_file (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
663 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
664 emit fetab_save_file (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
665 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
666 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
667 void file_editor::request_save_file_as (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
668 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
669 emit fetab_save_file_as (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
670 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
671 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
672 void file_editor::request_run_file (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
673 { |
27404
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
674 emit interpreter_event |
28851
1ac5a76ae91d
use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents:
28847
diff
changeset
|
675 ([=] (interpreter& interp) |
27404
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
676 { |
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
677 // INTERPRETER THREAD |
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
678 |
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
679 tree_evaluator& tw = interp.get_evaluator (); |
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
680 |
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
681 if (tw.in_debug_repl ()) |
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
682 emit request_dbcont_signal (); |
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
683 else |
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
684 emit fetab_run_file (m_tab_widget->currentWidget ()); |
a3ec8c75ece3
avoid possible threading issue when running file from GUI editor
John W. Eaton <jwe@octave.org>
parents:
27400
diff
changeset
|
685 }); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
686 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
687 |
26873
9ec36417c262
debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26561
diff
changeset
|
688 void file_editor::request_step_into_file () |
9ec36417c262
debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26561
diff
changeset
|
689 { |
9ec36417c262
debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26561
diff
changeset
|
690 emit fetab_run_file (m_tab_widget->currentWidget (), true); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
691 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
692 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
693 void file_editor::request_context_run (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
694 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
695 emit fetab_context_run (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
696 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
697 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
698 void file_editor::request_toggle_bookmark (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
699 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
700 emit fetab_toggle_bookmark (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
701 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
702 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
703 void file_editor::request_next_bookmark (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
704 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
705 emit fetab_next_bookmark (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
706 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
707 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
708 void file_editor::request_previous_bookmark (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
709 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
710 emit fetab_previous_bookmark (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
711 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
712 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
713 void file_editor::request_remove_bookmark (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
714 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
715 emit fetab_remove_bookmark (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
716 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
717 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
718 void file_editor::request_move_match_brace (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
719 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
720 emit fetab_move_match_brace (m_tab_widget->currentWidget (), false); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
721 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
722 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
723 void file_editor::request_sel_match_brace (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
724 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
725 emit fetab_move_match_brace (m_tab_widget->currentWidget (), true); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
726 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
727 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
728 // FIXME: What should this do with conditional breakpoints? |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
729 void file_editor::request_toggle_breakpoint (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
730 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
731 emit fetab_toggle_breakpoint (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
732 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
733 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
734 void file_editor::request_next_breakpoint (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
735 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
736 emit fetab_next_breakpoint (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
737 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
738 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
739 void file_editor::request_previous_breakpoint (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
740 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
741 emit fetab_previous_breakpoint (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
742 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
743 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
744 void file_editor::request_remove_breakpoint (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
745 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
746 emit fetab_remove_all_breakpoints (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
747 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
748 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
749 // slots for Edit->Commands actions |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
750 void file_editor::request_delete_start_word (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
751 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
752 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
753 QsciScintillaBase::SCI_DELWORDLEFT); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
754 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
755 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
756 void file_editor::request_delete_end_word (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
757 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
758 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
759 QsciScintillaBase::SCI_DELWORDRIGHT); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
760 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
761 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
762 void file_editor::request_delete_start_line (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
763 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
764 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
765 QsciScintillaBase::SCI_DELLINELEFT); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
766 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
767 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
768 void file_editor::request_delete_end_line (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
769 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
770 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
771 QsciScintillaBase::SCI_DELLINERIGHT); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
772 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
773 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
774 void file_editor::request_delete_line (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
775 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
776 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
777 QsciScintillaBase::SCI_LINEDELETE); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
778 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
779 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
780 void file_editor::request_copy_line (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
781 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
782 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
783 QsciScintillaBase::SCI_LINECOPY); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
784 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
785 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
786 void file_editor::request_cut_line (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
787 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
788 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
789 QsciScintillaBase::SCI_LINECUT); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
790 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
791 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
792 void file_editor::request_duplicate_selection (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
793 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
794 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
795 QsciScintillaBase::SCI_SELECTIONDUPLICATE); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
796 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
797 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
798 void file_editor::request_transpose_line (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
799 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
800 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
801 QsciScintillaBase::SCI_LINETRANSPOSE); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
802 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
803 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
804 void file_editor::request_comment_selected_text (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
805 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
806 emit fetab_comment_selected_text (m_tab_widget->currentWidget (), false); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
807 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
808 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
809 void file_editor::request_uncomment_selected_text (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
810 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
811 emit fetab_uncomment_selected_text (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
812 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
813 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
814 void file_editor::request_comment_var_selected_text (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
815 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
816 emit fetab_comment_selected_text (m_tab_widget->currentWidget (), true); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
817 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
818 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
819 // slots for Edit->Format actions |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
820 void file_editor::request_upper_case (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
821 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
822 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
823 QsciScintillaBase::SCI_UPPERCASE); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
824 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
825 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
826 void file_editor::request_lower_case (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
827 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
828 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
829 QsciScintillaBase::SCI_LOWERCASE); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
830 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
831 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
832 void file_editor::request_indent_selected_text (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
833 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
834 emit fetab_indent_selected_text (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
835 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
836 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
837 void file_editor::request_unindent_selected_text (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
838 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
839 emit fetab_unindent_selected_text (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
840 } |
24484
abb075ada761
Allow commenting with manually selected comment strings (bug #52695):
Torsten <mttl@mailbox.org>
parents:
24232
diff
changeset
|
841 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
842 void file_editor::request_smart_indent_line_or_selected_text () |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
843 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
844 emit fetab_smart_indent_line_or_selected_text (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
845 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
846 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
847 void file_editor::request_conv_eol_windows (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
848 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
849 emit fetab_convert_eol (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
850 QsciScintilla::EolWindows); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
851 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
852 void |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
853 file_editor::request_conv_eol_unix (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
854 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
855 emit fetab_convert_eol (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
856 QsciScintilla::EolUnix); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
857 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
858 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
859 void file_editor::request_conv_eol_mac (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
860 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
861 emit fetab_convert_eol (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
862 QsciScintilla::EolMac); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
863 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
864 |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
865 // Slot for initially creating and showing the find dialog |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
866 void file_editor::request_find (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
867 { |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
868 // Create the dialog |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
869 find_create (); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
870 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
871 // Since find_create shows the dialog without activating the widget |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
872 // (which is reuqired in other cases) do this manually here |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
873 m_find_dialog->activateWindow (); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
874 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
875 // Initiate search text from possible selection and save the initial |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
876 // data from the dialog on the defined structure |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
877 m_find_dialog->init_search_text (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
878 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
879 |
27971
ec769a7ab9fb
fix more spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27957
diff
changeset
|
880 // This method creates the find dialog. |
ec769a7ab9fb
fix more spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27957
diff
changeset
|
881 |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
882 void file_editor::find_create () |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
883 { |
27835
8b514b304be8
fix multiple editor find dialogs
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27818
diff
changeset
|
884 if (m_find_dialog) |
8b514b304be8
fix multiple editor find dialogs
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27818
diff
changeset
|
885 m_find_dialog->close (); |
8b514b304be8
fix multiple editor find dialogs
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27818
diff
changeset
|
886 |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
887 if (isFloating ()) |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
888 m_find_dialog = new find_dialog (m_octave_qobj, this, this); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
889 else |
29597
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
890 m_find_dialog = new find_dialog (m_octave_qobj, this, parentWidget ()); |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
891 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
892 // Add required actions |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
893 m_find_dialog->addAction (m_find_next_action); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
894 m_find_dialog->addAction (m_find_previous_action); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
895 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
896 // Update edit area |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
897 file_editor_tab *fet |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
898 = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ()); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
899 m_find_dialog->update_edit_area (fet->qsci_edit_area ()); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
900 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
901 // Icon is the same as the editor |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
902 m_find_dialog->setWindowIcon (windowIcon ()); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
903 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
904 // Position: lower right of editor's position |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
905 int xp = x () + frameGeometry ().width (); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
906 int yp = y () + frameGeometry ().height (); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
907 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
908 if (! isFloating ()) |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
909 { |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
910 // Fix position if editor is docked |
29597
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
911 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
912 QWidget *parent = parentWidget (); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
913 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
914 if (parent) |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
915 { |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
916 xp = xp + parent->x (); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
917 yp = yp + parent->y (); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
918 } |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
919 } |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
920 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
921 if (yp < 0) |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
922 yp = 0; |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
923 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
924 // The size of the find dialog is considered in restore_settings |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
925 // since its size might change depending on the options |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
926 m_find_dialog->restore_settings (QPoint (xp, yp)); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
927 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
928 // Set visible |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
929 m_find_dialog->set_visible (true); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
930 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
931 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
932 void file_editor::request_find_next (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
933 { |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
934 if (m_find_dialog) |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
935 m_find_dialog->find_next (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
936 } |
24232
e0bcd17ac070
smart indentation for selections or current line in code editor
John W. Eaton <jwe@octave.org>
parents:
24130
diff
changeset
|
937 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
938 void file_editor::request_find_previous (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
939 { |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
940 if (m_find_dialog) |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
941 m_find_dialog->find_prev (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
942 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
943 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
944 void file_editor::request_goto_line (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
945 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
946 emit fetab_goto_line (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
947 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
948 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
949 void file_editor::request_completion (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
950 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
951 emit fetab_completion (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
952 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
953 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
954 void file_editor::handle_file_name_changed (const QString& fname, |
27053
1bdfd2b523c9
use tab icon for indicating a modified editor file (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27051
diff
changeset
|
955 const QString& tip, |
1bdfd2b523c9
use tab icon for indicating a modified editor file (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27051
diff
changeset
|
956 bool modified) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
957 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
958 QObject *fileEditorTab = sender (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
959 if (fileEditorTab) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
960 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
961 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
962 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
963 for (int i = 0; i < m_tab_widget->count (); i++) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
964 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
965 if (m_tab_widget->widget (i) == fileEditorTab) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
966 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
967 m_tab_widget->setTabText (i, fname); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
968 m_tab_widget->setTabToolTip (i, tip); |
29698
bbf5d4ea616c
fix enabled state of editor save action depending on modification state
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29691
diff
changeset
|
969 |
bbf5d4ea616c
fix enabled state of editor save action depending on modification state
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29691
diff
changeset
|
970 m_save_action->setEnabled (modified); |
bbf5d4ea616c
fix enabled state of editor save action depending on modification state
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29691
diff
changeset
|
971 m_current_tab_modified = modified; |
bbf5d4ea616c
fix enabled state of editor save action depending on modification state
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29691
diff
changeset
|
972 |
27053
1bdfd2b523c9
use tab icon for indicating a modified editor file (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27051
diff
changeset
|
973 if (modified) |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
974 m_tab_widget->setTabIcon (i, rmgr.icon ("document-save")); |
27053
1bdfd2b523c9
use tab icon for indicating a modified editor file (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27051
diff
changeset
|
975 else |
1bdfd2b523c9
use tab icon for indicating a modified editor file (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27051
diff
changeset
|
976 m_tab_widget->setTabIcon (i, QIcon ()); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
977 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
978 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
979 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
980 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
981 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
982 void file_editor::handle_tab_close_request (int index) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
983 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
984 file_editor_tab *editor_tab |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
985 = static_cast<file_editor_tab *> (m_tab_widget->widget (index)); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
986 editor_tab->conditional_close (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
987 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
988 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
989 void |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
990 file_editor::handle_tab_remove_request (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
991 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
992 QObject *fileEditorTab = sender (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
993 if (fileEditorTab) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
994 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
995 for (int i = 0; i < m_tab_widget->count (); i++) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
996 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
997 if (m_tab_widget->widget (i) == fileEditorTab) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
998 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
999 m_tab_widget->removeTab (i); |
29747
c0466e8ab704
avoid crash when closing GUI with open editor tabs (bug #60500)
John W. Eaton <jwe@octave.org>
parents:
29573
diff
changeset
|
1000 |
c0466e8ab704
avoid crash when closing GUI with open editor tabs (bug #60500)
John W. Eaton <jwe@octave.org>
parents:
29573
diff
changeset
|
1001 // Deleting the sender (even with deleteLater) seems a |
c0466e8ab704
avoid crash when closing GUI with open editor tabs (bug #60500)
John W. Eaton <jwe@octave.org>
parents:
29573
diff
changeset
|
1002 // bit strange. Is there a better way? |
c0466e8ab704
avoid crash when closing GUI with open editor tabs (bug #60500)
John W. Eaton <jwe@octave.org>
parents:
29573
diff
changeset
|
1003 fileEditorTab->deleteLater (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1004 break; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1005 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1006 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1007 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1008 check_actions (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1009 |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27277
diff
changeset
|
1010 activate (); // focus stays in editor when tab is closed |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1011 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1012 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1013 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1014 // context menu of edit area |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1015 void file_editor::active_tab_changed (int index) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1016 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1017 emit fetab_change_request (m_tab_widget->widget (index)); |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27277
diff
changeset
|
1018 activate (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1019 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1020 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1021 void file_editor::handle_editor_state_changed (bool copy_available, |
29698
bbf5d4ea616c
fix enabled state of editor save action depending on modification state
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29691
diff
changeset
|
1022 bool is_octave_file, |
bbf5d4ea616c
fix enabled state of editor save action depending on modification state
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29691
diff
changeset
|
1023 bool is_modified) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1024 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1025 // In case there is some scenario where traffic could be coming from |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1026 // all the file editor tabs, just process info from the current active tab. |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1027 if (sender () == m_tab_widget->currentWidget ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1028 { |
29698
bbf5d4ea616c
fix enabled state of editor save action depending on modification state
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29691
diff
changeset
|
1029 m_save_action->setEnabled (is_modified); |
bbf5d4ea616c
fix enabled state of editor save action depending on modification state
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29691
diff
changeset
|
1030 m_current_tab_modified = is_modified; |
bbf5d4ea616c
fix enabled state of editor save action depending on modification state
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29691
diff
changeset
|
1031 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1032 if (m_copy_action) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1033 m_copy_action->setEnabled (copy_available); |
29698
bbf5d4ea616c
fix enabled state of editor save action depending on modification state
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29691
diff
changeset
|
1034 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1035 m_cut_action->setEnabled (copy_available); |
29439
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
1036 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1037 m_run_selection_action->setEnabled (copy_available); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1038 m_run_action->setEnabled (is_octave_file); |
29439
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
1039 m_is_octave_file = is_octave_file; |
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
1040 |
fe06fafb4cac
fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29374
diff
changeset
|
1041 emit editor_tabs_changed_signal (true, m_is_octave_file); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1042 } |
27075
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
1043 |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
1044 m_copy_action_enabled = m_copy_action->isEnabled (); |
fb427fafd494
fix enabled copy action in editor without selected text
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27074
diff
changeset
|
1045 m_undo_action_enabled = m_undo_action->isEnabled (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1046 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1047 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1048 void file_editor::handle_mru_add_file (const QString& file_name, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1049 const QString& encoding) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1050 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1051 int index; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1052 while ((index = m_mru_files.indexOf (file_name)) >= 0) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1053 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1054 m_mru_files.removeAt (index); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1055 m_mru_files_encodings.removeAt (index); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1056 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1057 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1058 m_mru_files.prepend (file_name); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1059 m_mru_files_encodings.prepend (encoding); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1060 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1061 mru_menu_update (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1062 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1063 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1064 void file_editor::check_conflict_save (const QString& saveFileName, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1065 bool remove_on_success) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1066 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1067 // Check whether this file is already open in the editor. |
27637
d16336646e18
return pointer to file_editor_tab from file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27636
diff
changeset
|
1068 file_editor_tab *tab = find_tab_widget (saveFileName); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1069 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1070 if (tab) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1071 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1072 // Note: to overwrite the contents of some other file editor tab |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1073 // with the same name requires identifying which file editor tab |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
1074 // that is (not too difficult) then closing that tab. Of course, |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1075 // that could trigger another dialog box if the file editor tab |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1076 // with the same name has modifications in it. This could become |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1077 // somewhat confusing to the user. For now, opt to do nothing. |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1078 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1079 // Create a NonModal message about error. |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1080 QMessageBox *msgBox |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1081 = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1082 tr ("File not saved! A file with the selected name\n%1\n" |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1083 "is already open in the editor"). |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1084 arg (saveFileName), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1085 QMessageBox::Ok, nullptr); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1086 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1087 msgBox->setWindowModality (Qt::NonModal); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1088 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1089 msgBox->show (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1090 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1091 return; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1092 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1093 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1094 QObject *saveFileObject = sender (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1095 QWidget *saveFileWidget = nullptr; |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1096 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1097 for (int i = 0; i < m_tab_widget->count (); i++) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1098 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1099 if (m_tab_widget->widget (i) == saveFileObject) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1100 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1101 saveFileWidget = m_tab_widget->widget (i); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1102 break; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1103 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1104 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1105 if (! saveFileWidget) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1106 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1107 // Create a NonModal message about error. |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1108 QMessageBox *msgBox |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1109 = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1110 tr ("The associated file editor tab has disappeared."), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1111 QMessageBox::Ok, nullptr); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1112 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1113 msgBox->setWindowModality (Qt::NonModal); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1114 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1115 msgBox->show (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1116 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1117 return; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1118 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1119 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1120 // Can save without conflict, have the file editor tab do so. |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1121 emit fetab_save_file (saveFileWidget, saveFileName, remove_on_success); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1122 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1123 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1124 void file_editor::handle_insert_debugger_pointer_request (const QString& file, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1125 int line) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1126 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1127 request_open_file (file, QString (), line, true); // default encoding |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1128 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1129 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1130 void file_editor::handle_delete_debugger_pointer_request (const QString& file, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1131 int line) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1132 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1133 if (! file.isEmpty ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1134 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1135 // Check whether this file is already open in the editor. |
27637
d16336646e18
return pointer to file_editor_tab from file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27636
diff
changeset
|
1136 file_editor_tab *tab = find_tab_widget (file); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1137 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1138 if (tab) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1139 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1140 m_tab_widget->setCurrentWidget (tab); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1141 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1142 if (line > 0) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1143 emit fetab_delete_debugger_pointer (tab, line); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1144 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1145 emit fetab_set_focus (tab); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1146 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1147 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1148 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1149 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1150 void file_editor::handle_update_breakpoint_marker_request (bool insert, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1151 const QString& file, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1152 int line, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1153 const QString& cond) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1154 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1155 request_open_file (file, QString (), line, false, true, insert, cond); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1156 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1157 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1158 void file_editor::handle_edit_file_request (const QString& file) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1159 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1160 request_open_file (file); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1161 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1162 |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
1163 // Slot used for signals indicating that a file was changed/renamed or |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1164 // is going to be deleted/renamed |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1165 void file_editor::handle_file_remove (const QString& old_name, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1166 const QString& new_name) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1167 { |
25743
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1168 // Clear old list of file data and declare a structure for file data |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1169 m_tmp_closed_files.clear (); |
30745
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1170 removed_file_data f_data; |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1171 |
25790
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1172 // Preprocessing old name(s) |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1173 QString old_name_clean = old_name.trimmed (); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1174 int s = old_name_clean.size (); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1175 |
29573
6fc423987872
avoid crash in GUI for rmdir("") (bug #60473)
John W. Eaton <jwe@octave.org>
parents:
29372
diff
changeset
|
1176 if (s > 1 && old_name_clean.at (0) == QChar ('\"') |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
1177 && old_name_clean.at (s - 1) == QChar ('\"')) |
25790
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1178 old_name_clean = old_name_clean.mid (1, s - 2); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1179 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1180 QStringList old_names = old_name_clean.split ("\" \""); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1181 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1182 // Check if new name is a file or directory |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1183 QFileInfo newf (new_name); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1184 bool new_is_dir = newf.isDir (); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1185 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1186 // Now loop over all old files/dirs (several files by movefile ()) |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1187 for (int i = 0; i < old_names.count (); i++) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1188 { |
25790
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1189 // Check if old name is a file or directory |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1190 QFileInfo old (old_names.at (i)); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1191 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1192 if (old.isDir ()) |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1193 { |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1194 // Call the function which handles directories and return |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1195 handle_dir_remove (old_names.at (i), new_name); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1196 } |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1197 else |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1198 { |
27929
265b386f8b20
maint: Use two spaces between sentences in code comments.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1199 // It is a single file. Is it open? |
27637
d16336646e18
return pointer to file_editor_tab from file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27636
diff
changeset
|
1200 file_editor_tab *editor_tab = find_tab_widget (old_names.at (i)); |
25790
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1201 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1202 if (editor_tab) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1203 { |
30745
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1204 |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1205 editor_tab->enable_file_watcher (false); |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1206 |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1207 // For re-enabling tracking if error while removing/renaming |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1208 f_data.editor_tab = editor_tab; |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1209 // For renaming into new file (if new_file is not empty) |
25790
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1210 if (new_is_dir) |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1211 { |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1212 std::string ndir = new_name.toStdString (); |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1213 std::string ofile = old.fileName ().toStdString (); |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
1214 f_data.new_file_name |
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
1215 = QString::fromStdString (sys::env::make_absolute (ofile, ndir)); |
25790
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1216 } |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1217 else |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1218 f_data.new_file_name = new_name; |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1219 |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1220 // Add file data to list |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
1221 m_tmp_closed_files << f_data; |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1222 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1223 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1224 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1225 } |
24082
0052d47ddc3e
Backed out changeset ba164db1c4a4
Torsten <mttl@mailbox.org>
parents:
24048
diff
changeset
|
1226 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1227 // Slot for signal indicating that a file was renamed |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1228 void file_editor::handle_file_renamed (bool load_new) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1229 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1230 m_no_focus = true; // Remember for not focussing editor |
25743
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1231 |
30745
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1232 // Loop over all files that have to be handled. Start at the end of the |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
1233 // list, otherwise the stored indexes are not correct. |
25743
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1234 for (int i = m_tmp_closed_files.count () - 1; i >= 0; i--) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1235 { |
25743
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1236 if (load_new) |
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1237 { |
30745
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1238 // Close file (remove) or rename into new file (rename) |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1239 if (m_tmp_closed_files.at (i).new_file_name.isEmpty ()) |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1240 m_tmp_closed_files.at (i).editor_tab->file_has_changed (QString (), true); |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1241 else |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1242 m_tmp_closed_files.at (i).editor_tab->set_file_name ( |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1243 m_tmp_closed_files.at (i).new_file_name); |
25743
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1244 } |
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1245 else |
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1246 { |
30745
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1247 // Something went wrong while renaming or removing: |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1248 // Leave everything as it is but reactivate tracking |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
1249 m_tmp_closed_files.at (i).editor_tab->enable_file_watcher (true); |
25743
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1250 } |
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1251 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1252 } |
25743
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1253 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1254 m_no_focus = false; // Back to normal focus |
25743
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1255 |
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1256 // Clear the list of file data |
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1257 m_tmp_closed_files.clear (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1258 } |
24082
0052d47ddc3e
Backed out changeset ba164db1c4a4
Torsten <mttl@mailbox.org>
parents:
24048
diff
changeset
|
1259 |
27611
0495b64288f7
use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
27605
diff
changeset
|
1260 void file_editor::notice_settings (const gui_settings *settings) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1261 { |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27651
diff
changeset
|
1262 int size_idx = settings->value (global_icon_size).toInt (); |
26058
ecd86b8b8979
use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents:
25923
diff
changeset
|
1263 size_idx = (size_idx > 0) - (size_idx < 0) + 1; // Make valid index from 0 to 2 |
ecd86b8b8979
use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents:
25923
diff
changeset
|
1264 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1265 QStyle *st = style (); |
26058
ecd86b8b8979
use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents:
25923
diff
changeset
|
1266 int icon_size = st->pixelMetric (global_icon_sizes[size_idx]); |
ecd86b8b8979
use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents:
25923
diff
changeset
|
1267 m_tool_bar->setIconSize (QSize (icon_size, icon_size)); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1268 |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1269 // Tab position and rotation |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
1270 QTabWidget::TabPosition pos |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27651
diff
changeset
|
1271 = static_cast<QTabWidget::TabPosition> (settings->value (ed_tab_position).toInt ()); |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1272 bool rotated = settings->value (ed_tabs_rotated).toBool (); |
27276
7455523fdf01
style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
1273 |
27090
e83d3161b256
make editor toolbar, tabs and statusbar more comapct (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27089
diff
changeset
|
1274 m_tab_widget->setTabPosition (pos); |
e83d3161b256
make editor toolbar, tabs and statusbar more comapct (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27089
diff
changeset
|
1275 |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1276 if (rotated) |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1277 m_tab_widget->setTabsClosable (false); // No close buttons |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1278 // FIXME: close buttons can not be correctly placed in rotated tabs |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1279 |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1280 // Get the tab bar and set the rotation |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1281 int rotation = rotated; |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1282 if (pos == QTabWidget::West) |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1283 rotation = -rotation; |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1284 |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1285 tab_bar *bar = m_tab_widget->get_tab_bar (); |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1286 bar->set_rotated (rotation); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1287 |
27090
e83d3161b256
make editor toolbar, tabs and statusbar more comapct (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27089
diff
changeset
|
1288 // Get suitable height of a tab related to font and icon size |
e83d3161b256
make editor toolbar, tabs and statusbar more comapct (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27089
diff
changeset
|
1289 int height = 1.5*QFontMetrics (m_tab_widget->font ()).height (); |
e83d3161b256
make editor toolbar, tabs and statusbar more comapct (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27089
diff
changeset
|
1290 int is = 1.5*m_tab_widget->iconSize ().height (); |
e83d3161b256
make editor toolbar, tabs and statusbar more comapct (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27089
diff
changeset
|
1291 if (is > height) |
e83d3161b256
make editor toolbar, tabs and statusbar more comapct (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27089
diff
changeset
|
1292 height = is; |
e83d3161b256
make editor toolbar, tabs and statusbar more comapct (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27089
diff
changeset
|
1293 |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1294 // Calculate possibly limited width and set the elide mode |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1295 int chars = settings->value (ed_tabs_max_width).toInt (); |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1296 int width = 9999; |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1297 if (chars > 0) |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1298 width = chars * QFontMetrics (m_tab_widget->font ()).averageCharWidth (); |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1299 |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1300 // Get tab bar size properties for style sheet depending on rotation |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1301 QString width_str ("width"); |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1302 QString height_str ("height"); |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1303 if ((pos == QTabWidget::West) || (pos == QTabWidget::East)) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1304 { |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1305 width_str = QString ("height"); |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1306 height_str = QString ("width"); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1307 } |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1308 |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1309 QString style_sheet |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1310 = QString ("QTabBar::tab {max-" + height_str + ": %1px;\n" |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1311 "max-" + width_str + ": %2px; }") |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1312 .arg (height).arg (width); |
27120
c2a8365c73fc
add workaround for missing editor tab close buttons on macos (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27102
diff
changeset
|
1313 |
c2a8365c73fc
add workaround for missing editor tab close buttons on macos (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27102
diff
changeset
|
1314 #if defined (Q_OS_MAC) |
c2a8365c73fc
add workaround for missing editor tab close buttons on macos (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27102
diff
changeset
|
1315 // FIXME: This is a workaround for missing tab close buttons on MacOS |
c2a8365c73fc
add workaround for missing editor tab close buttons on macos (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27102
diff
changeset
|
1316 // in several Qt versions (https://bugreports.qt.io/browse/QTBUG-61092) |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1317 if (! rotated) |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1318 { |
30964
04601f6c47f4
fix broken icon path after new icon structure in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
1319 QString icon = global_icon_paths.at (ICON_THEME_OCTAVE) + "widget-close.png"; |
04601f6c47f4
fix broken icon path after new icon structure in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
1320 |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1321 QString close_button_css_mac ( |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1322 "QTabBar::close-button" |
30964
04601f6c47f4
fix broken icon path after new icon structure in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
1323 " { image: url(" + icon + ");" |
04601f6c47f4
fix broken icon path after new icon structure in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
1324 " padding: 4px;" |
04601f6c47f4
fix broken icon path after new icon structure in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30772
diff
changeset
|
1325 " subcontrol-position: bottom; }\n" |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1326 "QTabBar::close-button:hover" |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1327 " { background-color: #cccccc; }"); |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1328 |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1329 style_sheet = style_sheet + close_button_css_mac; |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
1330 } |
27120
c2a8365c73fc
add workaround for missing editor tab close buttons on macos (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27102
diff
changeset
|
1331 #endif |
c2a8365c73fc
add workaround for missing editor tab close buttons on macos (bug #56158)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27102
diff
changeset
|
1332 |
27090
e83d3161b256
make editor toolbar, tabs and statusbar more comapct (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27089
diff
changeset
|
1333 m_tab_widget->setStyleSheet (style_sheet); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1334 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1335 bool show_it; |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1336 show_it = settings->value (ed_show_line_numbers).toBool (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1337 m_show_linenum_action->setChecked (show_it); |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1338 show_it = settings->value (ed_show_white_space).toBool (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1339 m_show_whitespace_action->setChecked (show_it); |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1340 show_it = settings->value (ed_show_eol_chars).toBool (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1341 m_show_eol_action->setChecked (show_it); |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1342 show_it = settings->value (ed_show_indent_guides).toBool (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1343 m_show_indguide_action->setChecked (show_it); |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1344 show_it = settings->value (ed_long_line_marker).toBool (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1345 m_show_longline_action->setChecked (show_it); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1346 |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1347 show_it = settings->value (ed_show_toolbar).toBool (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1348 m_show_toolbar_action->setChecked (show_it); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1349 m_tool_bar->setVisible (show_it); |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1350 show_it = settings->value (ed_show_edit_status_bar).toBool (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1351 m_show_statusbar_action->setChecked (show_it); |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1352 show_it = settings->value (ed_show_hscroll_bar).toBool (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1353 m_show_hscrollbar_action->setChecked (show_it); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1354 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1355 set_shortcuts (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1356 |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1357 // Find dialog with the same icon as the editor |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1358 if (m_find_dialog) |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1359 m_find_dialog->setWindowIcon (windowIcon ()); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1360 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1361 // Relay signal to file editor tabs. |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1362 emit fetab_settings_changed (settings); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1363 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1364 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1365 void file_editor::set_shortcuts (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1366 { |
27956
2310164737b3
fix many spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27047
diff
changeset
|
1367 // Shortcuts also available in the main window, as well as the related |
2310164737b3
fix many spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27047
diff
changeset
|
1368 // shortcuts, are defined in main_window and added to the editor |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1369 |
27630
262cdd0f7619
don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27629
diff
changeset
|
1370 shortcut_manager& scmgr = m_octave_qobj.get_shortcut_manager (); |
262cdd0f7619
don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents:
27629
diff
changeset
|
1371 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1372 // File menu |
27818
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1373 scmgr.set_shortcut (m_edit_function_action, sc_edit_file_edit_function); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1374 scmgr.set_shortcut (m_save_action, sc_edit_file_save); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1375 scmgr.set_shortcut (m_save_as_action, sc_edit_file_save_as); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1376 scmgr.set_shortcut (m_close_action, sc_edit_file_close); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1377 scmgr.set_shortcut (m_close_all_action, sc_edit_file_close_all); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1378 scmgr.set_shortcut (m_close_others_action, sc_edit_file_close_other); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1379 scmgr.set_shortcut (m_print_action, sc_edit_file_print); |
17903
de8591a19bc6
check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents:
17901
diff
changeset
|
1380 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1381 // Edit menu |
27818
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1382 scmgr.set_shortcut (m_redo_action, sc_edit_edit_redo); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1383 scmgr.set_shortcut (m_cut_action, sc_edit_edit_cut); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1384 scmgr.set_shortcut (m_find_action, sc_edit_edit_find_replace); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1385 scmgr.set_shortcut (m_find_next_action, sc_edit_edit_find_next); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1386 scmgr.set_shortcut (m_find_previous_action, sc_edit_edit_find_previous); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1387 |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1388 scmgr.set_shortcut (m_delete_start_word_action, sc_edit_edit_delete_start_word); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1389 scmgr.set_shortcut (m_delete_end_word_action, sc_edit_edit_delete_end_word); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1390 scmgr.set_shortcut (m_delete_start_line_action, sc_edit_edit_delete_start_line); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1391 scmgr.set_shortcut (m_delete_end_line_action, sc_edit_edit_delete_end_line); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1392 scmgr.set_shortcut (m_delete_line_action, sc_edit_edit_delete_line); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1393 scmgr.set_shortcut (m_copy_line_action, sc_edit_edit_copy_line); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1394 scmgr.set_shortcut (m_cut_line_action, sc_edit_edit_cut_line); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1395 scmgr.set_shortcut (m_duplicate_selection_action, sc_edit_edit_duplicate_selection); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1396 scmgr.set_shortcut (m_transpose_line_action, sc_edit_edit_transpose_line); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1397 scmgr.set_shortcut (m_comment_selection_action, sc_edit_edit_comment_selection); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1398 scmgr.set_shortcut (m_uncomment_selection_action, sc_edit_edit_uncomment_selection); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1399 scmgr.set_shortcut (m_comment_var_selection_action, sc_edit_edit_comment_var_selection); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1400 |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1401 scmgr.set_shortcut (m_upper_case_action, sc_edit_edit_upper_case); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1402 scmgr.set_shortcut (m_lower_case_action, sc_edit_edit_lower_case); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1403 scmgr.set_shortcut (m_indent_selection_action, sc_edit_edit_indent_selection); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1404 scmgr.set_shortcut (m_unindent_selection_action, sc_edit_edit_unindent_selection); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1405 scmgr.set_shortcut (m_smart_indent_line_or_selection_action, sc_edit_edit_smart_indent_line_or_selection); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1406 scmgr.set_shortcut (m_completion_action, sc_edit_edit_completion_list); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1407 scmgr.set_shortcut (m_goto_line_action, sc_edit_edit_goto_line); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1408 scmgr.set_shortcut (m_move_to_matching_brace, sc_edit_edit_move_to_brace); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1409 scmgr.set_shortcut (m_sel_to_matching_brace, sc_edit_edit_select_to_brace); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1410 scmgr.set_shortcut (m_toggle_bookmark_action, sc_edit_edit_toggle_bookmark); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1411 scmgr.set_shortcut (m_next_bookmark_action, sc_edit_edit_next_bookmark); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1412 scmgr.set_shortcut (m_previous_bookmark_action, sc_edit_edit_previous_bookmark); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1413 scmgr.set_shortcut (m_remove_bookmark_action, sc_edit_edit_remove_bookmark); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1414 scmgr.set_shortcut (m_preferences_action, sc_edit_edit_preferences); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1415 scmgr.set_shortcut (m_styles_preferences_action, sc_edit_edit_styles_preferences); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1416 |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1417 scmgr.set_shortcut (m_conv_eol_windows_action, sc_edit_edit_conv_eol_winows); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1418 scmgr.set_shortcut (m_conv_eol_unix_action, sc_edit_edit_conv_eol_unix); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1419 scmgr.set_shortcut (m_conv_eol_mac_action, sc_edit_edit_conv_eol_mac); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1420 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1421 // View menu |
27818
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1422 scmgr.set_shortcut (m_show_linenum_action, sc_edit_view_show_line_numbers); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1423 scmgr.set_shortcut (m_show_whitespace_action, sc_edit_view_show_white_spaces); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1424 scmgr.set_shortcut (m_show_eol_action, sc_edit_view_show_eol_chars); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1425 scmgr.set_shortcut (m_show_indguide_action, sc_edit_view_show_ind_guides); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1426 scmgr.set_shortcut (m_show_longline_action, sc_edit_view_show_long_line); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1427 scmgr.set_shortcut (m_show_toolbar_action, sc_edit_view_show_toolbar); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1428 scmgr.set_shortcut (m_show_statusbar_action, sc_edit_view_show_statusbar); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1429 scmgr.set_shortcut (m_show_hscrollbar_action, sc_edit_view_show_hscrollbar); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1430 scmgr.set_shortcut (m_zoom_in_action, sc_edit_view_zoom_in); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1431 scmgr.set_shortcut (m_zoom_out_action, sc_edit_view_zoom_out); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1432 scmgr.set_shortcut (m_zoom_normal_action, sc_edit_view_zoom_normal); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1433 scmgr.set_shortcut (m_sort_tabs_action, sc_edit_view_sort_tabs); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1434 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1435 // Debug menu |
27818
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1436 scmgr.set_shortcut (m_toggle_breakpoint_action, sc_edit_debug_toggle_breakpoint); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1437 scmgr.set_shortcut (m_next_breakpoint_action, sc_edit_debug_next_breakpoint); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1438 scmgr.set_shortcut (m_previous_breakpoint_action, sc_edit_debug_previous_breakpoint); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1439 scmgr.set_shortcut (m_remove_all_breakpoints_action, sc_edit_debug_remove_breakpoints); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1440 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1441 // Run menu |
27818
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1442 scmgr.set_shortcut (m_run_action, sc_edit_run_run_file); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1443 scmgr.set_shortcut (m_run_selection_action, sc_edit_run_run_selection); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1444 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1445 // Help menu |
27818
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1446 scmgr.set_shortcut (m_context_help_action, sc_edit_help_help_keyword); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1447 scmgr.set_shortcut (m_context_doc_action, sc_edit_help_doc_keyword); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1448 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1449 // Tab navigation without menu entries |
27818
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1450 scmgr.set_shortcut (m_switch_left_tab_action, sc_edit_tabs_switch_left_tab); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1451 scmgr.set_shortcut (m_switch_right_tab_action, sc_edit_tabs_switch_right_tab); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1452 scmgr.set_shortcut (m_move_tab_left_action, sc_edit_tabs_move_tab_left); |
fa0582694fda
replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27805
diff
changeset
|
1453 scmgr.set_shortcut (m_move_tab_right_action, sc_edit_tabs_move_tab_right); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1454 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1455 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1456 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1457 // This slot is a reimplementation of the virtual slot in octave_dock_widget. |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
1458 // We need this for creating an empty script when the editor has no open |
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
1459 // files and is made visible. |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1460 void file_editor::handle_visibility (bool visible) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1461 { |
29199
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28851
diff
changeset
|
1462 octave_dock_widget::handle_visibility (visible); |
0b18887bc997
simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28851
diff
changeset
|
1463 |
29715
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
1464 if (! m_editor_ready) |
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
1465 return; |
82e45c11da7d
fix auto completion in default empty script of GUI editor (bug #60689)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29713
diff
changeset
|
1466 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1467 if (m_closed && visible) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1468 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1469 m_closed = false; |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1470 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1471 gui_settings *settings = rmgr.get_settings (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1472 restore_session (settings); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1473 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1474 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1475 empty_script (false, visible); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1476 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1477 |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1478 // This slot is a reimplementation of the virtual slot in octave_dock_widget. |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1479 // We need this for updating the parent of the find dialog |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1480 void file_editor::toplevel_change (bool) |
27089
9326c2258e60
fix visibility of find dialog when editor is docked/undocked (bug #5)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27075
diff
changeset
|
1481 { |
27787
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1482 if (m_find_dialog) |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1483 { |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1484 // close current dialog |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1485 m_find_dialog->close (); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1486 |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1487 // re-create dialog with the new parent (editor or main-win) |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1488 find_create (); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1489 m_find_dialog->activateWindow (); |
5169ed0ff0f0
only one find dialog for all editor tabs (bug #57238)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27691
diff
changeset
|
1490 } |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1491 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1492 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1493 void file_editor::update_octave_directory (const QString& dir) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1494 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1495 m_ced = dir; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1496 emit fetab_set_directory (m_ced); // for save dialog |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1497 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1498 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1499 void file_editor::copyClipboard (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1500 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1501 if (editor_tab_has_focus ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1502 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1503 QsciScintillaBase::SCI_COPY); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1504 } |
18545
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
1505 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1506 void file_editor::pasteClipboard (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1507 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1508 if (editor_tab_has_focus ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1509 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1510 QsciScintillaBase::SCI_PASTE); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1511 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1512 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1513 void file_editor::selectAll (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1514 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1515 if (editor_tab_has_focus ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1516 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1517 QsciScintillaBase::SCI_SELECTALL); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1518 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1519 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1520 void file_editor::do_undo (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1521 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1522 if (editor_tab_has_focus ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1523 emit fetab_scintilla_command (m_tab_widget->currentWidget (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1524 QsciScintillaBase::SCI_UNDO); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1525 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1526 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1527 // Open a file, if not already open, and mark the current execution location |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1528 // and/or a breakpoint with condition cond. |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1529 void file_editor::request_open_file (const QString& openFileName, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1530 const QString& encoding, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1531 int line, bool debug_pointer, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1532 bool breakpoint_marker, bool insert, |
25743
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
1533 const QString& cond, int index) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1534 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1535 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1536 gui_settings *settings = rmgr.get_settings (); |
29934
116dbaba5a74
fix opening a file in a custom editor (bug #60990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29747
diff
changeset
|
1537 |
116dbaba5a74
fix opening a file in a custom editor (bug #60990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29747
diff
changeset
|
1538 if (settings->value (global_use_custom_editor).toBool ()) |
116dbaba5a74
fix opening a file in a custom editor (bug #60990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29747
diff
changeset
|
1539 { |
116dbaba5a74
fix opening a file in a custom editor (bug #60990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29747
diff
changeset
|
1540 // Custom editor |
116dbaba5a74
fix opening a file in a custom editor (bug #60990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29747
diff
changeset
|
1541 if (debug_pointer || breakpoint_marker) |
116dbaba5a74
fix opening a file in a custom editor (bug #60990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29747
diff
changeset
|
1542 return; // Do not call custom editor during debugging |
116dbaba5a74
fix opening a file in a custom editor (bug #60990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29747
diff
changeset
|
1543 |
116dbaba5a74
fix opening a file in a custom editor (bug #60990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29747
diff
changeset
|
1544 if (call_custom_editor (openFileName, line)) |
116dbaba5a74
fix opening a file in a custom editor (bug #60990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29747
diff
changeset
|
1545 return; // Custom editor called |
116dbaba5a74
fix opening a file in a custom editor (bug #60990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29747
diff
changeset
|
1546 } |
116dbaba5a74
fix opening a file in a custom editor (bug #60990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29747
diff
changeset
|
1547 |
25622
a7ee69d23f32
add a gui preference for opening files when debugging in console (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25508
diff
changeset
|
1548 bool show_dbg_file |
27672
a36443e94f8a
simplify gui_settings->value (PREF.key, PREF.def) calls
John W. Eaton <jwe@octave.org>
parents:
27651
diff
changeset
|
1549 = settings->value (ed_show_dbg_file).toBool (); |
25622
a7ee69d23f32
add a gui preference for opening files when debugging in console (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25508
diff
changeset
|
1550 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1551 if (openFileName.isEmpty ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1552 { |
27956
2310164737b3
fix many spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
27047
diff
changeset
|
1553 // This happens if edit is called without an argument |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
1554 // Open editor with empty edit area instead (as new file would do) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1555 request_new_file (""); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1556 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1557 else |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1558 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1559 // Check whether this file is already open in the editor. |
27637
d16336646e18
return pointer to file_editor_tab from file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27636
diff
changeset
|
1560 file_editor_tab *tab = find_tab_widget (openFileName); |
18545
17baa684892c
fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents:
18472
diff
changeset
|
1561 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1562 if (tab) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1563 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1564 m_tab_widget->setCurrentWidget (tab); |
16407
4d438dffbfac
gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents:
16399
diff
changeset
|
1565 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1566 if (line > 0) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1567 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1568 if (insert) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1569 emit fetab_goto_line (tab, line); |
16546
c1e90c7cfd30
try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents:
16525
diff
changeset
|
1570 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1571 if (debug_pointer) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1572 emit fetab_insert_debugger_pointer (tab, line); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
1573 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1574 if (breakpoint_marker) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1575 emit fetab_do_breakpoint_marker (insert, tab, line, cond); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1576 } |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
1577 |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27929
diff
changeset
|
1578 if (show_dbg_file && ! ((breakpoint_marker || debug_pointer) |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27929
diff
changeset
|
1579 && is_editor_console_tabbed ())) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1580 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1581 emit fetab_set_focus (tab); |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27277
diff
changeset
|
1582 activate (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1583 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1584 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1585 else |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1586 { |
25622
a7ee69d23f32
add a gui preference for opening files when debugging in console (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25508
diff
changeset
|
1587 if (! show_dbg_file && (breakpoint_marker || debug_pointer)) |
a7ee69d23f32
add a gui preference for opening files when debugging in console (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25508
diff
changeset
|
1588 return; // Do not open a file for showing dbg markers |
a7ee69d23f32
add a gui preference for opening files when debugging in console (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25508
diff
changeset
|
1589 |
a7ee69d23f32
add a gui preference for opening files when debugging in console (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25508
diff
changeset
|
1590 if (breakpoint_marker && ! insert) |
a7ee69d23f32
add a gui preference for opening files when debugging in console (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25508
diff
changeset
|
1591 return; // Never open a file when removing breakpoints |
a7ee69d23f32
add a gui preference for opening files when debugging in console (bug #49119)
Torsten <mttl@mailbox.org>
parents:
25508
diff
changeset
|
1592 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1593 file_editor_tab *fileEditorTab = nullptr; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1594 // Reuse <unnamed> tab if it hasn't yet been modified. |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1595 bool reusing = false; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1596 tab = find_tab_widget (""); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1597 if (tab) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1598 { |
27637
d16336646e18
return pointer to file_editor_tab from file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27636
diff
changeset
|
1599 fileEditorTab = tab; |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1600 if (fileEditorTab->qsci_edit_area ()->isModified ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1601 fileEditorTab = nullptr; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1602 else |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1603 reusing = true; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1604 } |
21565
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
1605 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1606 // If <unnamed> was absent or modified, create a new tab. |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1607 if (! fileEditorTab) |
27400
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
1608 fileEditorTab = make_file_editor_tab (); |
21565
08baf0ebc9a9
Reappropriate <unnamed> editor tab when opening a new file (bug #47529)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21562
diff
changeset
|
1609 |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1610 fileEditorTab->set_encoding (encoding); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1611 QString result = fileEditorTab->load_file (openFileName); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1612 if (result == "") |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1613 { |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1614 // Supply empty title then have the file_editor_tab update |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1615 // with full or short name. |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1616 if (! reusing) |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1617 add_file_editor_tab (fileEditorTab, "", index); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1618 fileEditorTab->update_window_title (false); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1619 // file already loaded, add file to mru list here |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1620 QFileInfo file_info = QFileInfo (openFileName); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1621 handle_mru_add_file (file_info.canonicalFilePath (), |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1622 encoding); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1623 |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1624 if (line > 0) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1625 { |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1626 if (insert) |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1627 emit fetab_goto_line (fileEditorTab, line); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1628 |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1629 if (debug_pointer) |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1630 emit fetab_insert_debugger_pointer (fileEditorTab, |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1631 line); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1632 if (breakpoint_marker) |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1633 emit fetab_do_breakpoint_marker (insert, fileEditorTab, |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1634 line, cond); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1635 } |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1636 } |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1637 else |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1638 { |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1639 delete fileEditorTab; |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1640 fileEditorTab = nullptr; |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1641 |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1642 if (QFile::exists (openFileName)) |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1643 { |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1644 // File not readable: |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1645 // create a NonModal message about error. |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1646 QMessageBox *msgBox |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1647 = new QMessageBox (QMessageBox::Critical, |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1648 tr ("Octave Editor"), |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1649 tr ("Could not open file\n%1\nfor read: %2."). |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1650 arg (openFileName).arg (result), |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1651 QMessageBox::Ok, this); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1652 |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1653 msgBox->setWindowModality (Qt::NonModal); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1654 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1655 msgBox->show (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1656 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1657 else |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1658 { |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1659 // File does not exist, should it be created? |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1660 bool create_file = true; |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1661 QMessageBox *msgBox; |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1662 |
27849
28d7ec92bae6
replace prefs literals by symbolic constant in main window
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27835
diff
changeset
|
1663 if (! settings->value (ed_create_new_file).toBool ()) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1664 { |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1665 msgBox = new QMessageBox (QMessageBox::Question, |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1666 tr ("Octave Editor"), |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1667 tr ("File\n%1\ndoes not exist. " |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1668 "Do you want to create it?").arg (openFileName), |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
1669 QMessageBox::NoButton, nullptr); |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1670 QPushButton *create_button = |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1671 msgBox->addButton (tr ("Create"), QMessageBox::YesRole); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1672 msgBox->addButton (tr ("Cancel"), QMessageBox::RejectRole); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1673 msgBox->setDefaultButton (create_button); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1674 msgBox->exec (); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1675 |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1676 QAbstractButton *clicked_button = msgBox->clickedButton (); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1677 if (clicked_button != create_button) |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1678 create_file = false; |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1679 |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1680 delete msgBox; |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1681 } |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1682 |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1683 if (create_file) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1684 { |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1685 // create the file and call the editor again |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1686 QFile file (openFileName); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1687 if (! file.open (QIODevice::WriteOnly)) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1688 { |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1689 // error opening the file |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1690 msgBox = new QMessageBox (QMessageBox::Critical, |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1691 tr ("Octave Editor"), |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1692 tr ("Could not open file\n%1\nfor write: %2."). |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1693 arg (openFileName).arg (file.errorString ()), |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1694 QMessageBox::Ok, this); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1695 |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1696 msgBox->setWindowModality (Qt::NonModal); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1697 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1698 msgBox->show (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1699 } |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1700 else |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1701 { |
26369
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1702 file.close (); |
0249ba4c9589
Fix static analyzer detected V668 issues (bug #55347).
Andreas Weber <octave@josoansi.de>
parents:
26109
diff
changeset
|
1703 request_open_file (openFileName); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1704 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1705 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1706 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1707 } |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
1708 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1709 if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ())) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1710 { |
25923
a7511a1489b8
call octave functions with return value from GUI (bug #47585)
Torsten <mttl@mailbox.org>
parents:
25914
diff
changeset
|
1711 // update breakpoint pointers, really show editor |
a7511a1489b8
call octave functions with return value from GUI (bug #47585)
Torsten <mttl@mailbox.org>
parents:
25914
diff
changeset
|
1712 // and the current editor tab |
26080
13d11afc8122
fix crash after editor dialog about creation of non-existing file
Torsten <mttl@mailbox.org>
parents:
26058
diff
changeset
|
1713 if (fileEditorTab) |
13d11afc8122
fix crash after editor dialog about creation of non-existing file
Torsten <mttl@mailbox.org>
parents:
26058
diff
changeset
|
1714 fileEditorTab->update_breakpoints (); |
27281
0915fec3d3a9
prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27277
diff
changeset
|
1715 activate (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1716 emit file_loaded_signal (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1717 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1718 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1719 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1720 } |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
1721 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1722 void file_editor::request_preferences (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1723 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1724 emit request_settings_dialog ("editor"); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1725 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1726 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1727 void file_editor::request_styles_preferences (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1728 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1729 emit request_settings_dialog ("editor_styles"); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1730 } |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1731 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1732 void file_editor::show_line_numbers (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1733 { |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1734 toggle_preference (ed_show_line_numbers); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1735 } |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
1736 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1737 void file_editor::show_white_space (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1738 { |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1739 toggle_preference (ed_show_white_space); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1740 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1741 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1742 void file_editor::show_eol_chars (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1743 { |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1744 toggle_preference (ed_show_eol_chars); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1745 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1746 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1747 void file_editor::show_indent_guides (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1748 { |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1749 toggle_preference (ed_show_indent_guides); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1750 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1751 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1752 void file_editor::show_long_line (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1753 { |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1754 toggle_preference (ed_long_line_marker); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1755 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1756 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1757 void file_editor::show_toolbar (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1758 { |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1759 toggle_preference (ed_show_toolbar); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1760 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1761 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1762 void file_editor::show_statusbar (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1763 { |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1764 toggle_preference (ed_show_edit_status_bar); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1765 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1766 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1767 void file_editor::show_hscrollbar (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1768 { |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1769 toggle_preference (ed_show_hscroll_bar); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1770 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1771 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1772 void file_editor::zoom_in (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1773 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1774 emit fetab_zoom_in (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1775 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1776 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1777 void file_editor::zoom_out (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1778 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1779 emit fetab_zoom_out (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1780 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1781 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1782 void file_editor::zoom_normal (bool) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1783 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1784 emit fetab_zoom_normal (m_tab_widget->currentWidget ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1785 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1786 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1787 void file_editor::create_context_menu (QMenu *menu) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1788 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1789 // remove all standard actions from scintilla |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1790 QList<QAction *> all_actions = menu->actions (); |
27676
ea7d36e9f197
use standard C++ range-based for loops instead of Qt foreach macro
John W. Eaton <jwe@octave.org>
parents:
27672
diff
changeset
|
1791 |
ea7d36e9f197
use standard C++ range-based for loops instead of Qt foreach macro
John W. Eaton <jwe@octave.org>
parents:
27672
diff
changeset
|
1792 for (auto *a : all_actions) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1793 menu->removeAction (a); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1794 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1795 // add editor's actions with icons and customized shortcuts |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1796 menu->addAction (m_cut_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1797 menu->addAction (m_copy_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1798 menu->addAction (m_paste_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1799 menu->addSeparator (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1800 menu->addAction (m_selectall_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1801 menu->addSeparator (); |
25274
1f1e1e72e958
make file editor context menu more like menu bar edit menu
John W. Eaton <jwe@octave.org>
parents:
25064
diff
changeset
|
1802 menu->addAction (m_find_files_action); |
1f1e1e72e958
make file editor context menu more like menu bar edit menu
John W. Eaton <jwe@octave.org>
parents:
25064
diff
changeset
|
1803 menu->addAction (m_find_action); |
1f1e1e72e958
make file editor context menu more like menu bar edit menu
John W. Eaton <jwe@octave.org>
parents:
25064
diff
changeset
|
1804 menu->addAction (m_find_next_action); |
1f1e1e72e958
make file editor context menu more like menu bar edit menu
John W. Eaton <jwe@octave.org>
parents:
25064
diff
changeset
|
1805 menu->addAction (m_find_previous_action); |
1f1e1e72e958
make file editor context menu more like menu bar edit menu
John W. Eaton <jwe@octave.org>
parents:
25064
diff
changeset
|
1806 menu->addSeparator (); |
1f1e1e72e958
make file editor context menu more like menu bar edit menu
John W. Eaton <jwe@octave.org>
parents:
25064
diff
changeset
|
1807 menu->addMenu (m_edit_cmd_menu); |
1f1e1e72e958
make file editor context menu more like menu bar edit menu
John W. Eaton <jwe@octave.org>
parents:
25064
diff
changeset
|
1808 menu->addMenu (m_edit_fmt_menu); |
1f1e1e72e958
make file editor context menu more like menu bar edit menu
John W. Eaton <jwe@octave.org>
parents:
25064
diff
changeset
|
1809 menu->addMenu (m_edit_nav_menu); |
1f1e1e72e958
make file editor context menu more like menu bar edit menu
John W. Eaton <jwe@octave.org>
parents:
25064
diff
changeset
|
1810 menu->addSeparator (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1811 menu->addAction (m_run_selection_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1812 } |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1813 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1814 void file_editor::edit_status_update (bool undo, bool redo) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1815 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1816 if (m_undo_action) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1817 m_undo_action->setEnabled (undo); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1818 m_redo_action->setEnabled (redo); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1819 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1820 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1821 // handler for the close event |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1822 void file_editor::closeEvent (QCloseEvent *e) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1823 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1824 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1825 gui_settings *settings = rmgr.get_settings (); |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1826 if (settings->value (ed_hiding_closes_files).toBool ()) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1827 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1828 if (check_closing ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1829 { |
27651
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
1830 // All tabs are closed without cancelling, |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
1831 // store closing state for restoring session when shown again. |
c9ebcb9050b4
fix broken storing of editor session data at shutdown
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27640
diff
changeset
|
1832 // Editor is closing when session data is stored in preferences |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1833 m_closed = true; |
27605
60cecb3fed04
fix saving modified files when closing editor tabs or octave
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27560
diff
changeset
|
1834 e->ignore (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1835 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1836 else |
25623
331f46b9ee6c
fix close events of some main dock widgets (bug #54185)
Torsten <mttl@mailbox.org>
parents:
25622
diff
changeset
|
1837 { |
331f46b9ee6c
fix close events of some main dock widgets (bug #54185)
Torsten <mttl@mailbox.org>
parents:
25622
diff
changeset
|
1838 e->ignore (); |
331f46b9ee6c
fix close events of some main dock widgets (bug #54185)
Torsten <mttl@mailbox.org>
parents:
25622
diff
changeset
|
1839 return; |
331f46b9ee6c
fix close events of some main dock widgets (bug #54185)
Torsten <mttl@mailbox.org>
parents:
25622
diff
changeset
|
1840 } |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1841 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1842 else |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1843 e->accept (); |
25623
331f46b9ee6c
fix close events of some main dock widgets (bug #54185)
Torsten <mttl@mailbox.org>
parents:
25622
diff
changeset
|
1844 |
331f46b9ee6c
fix close events of some main dock widgets (bug #54185)
Torsten <mttl@mailbox.org>
parents:
25622
diff
changeset
|
1845 octave_dock_widget::closeEvent (e); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1846 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1847 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1848 void file_editor::dragEnterEvent (QDragEnterEvent *e) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1849 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1850 if (e->mimeData ()->hasUrls ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1851 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1852 e->acceptProposedAction (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1853 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1854 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1855 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1856 void file_editor::dropEvent (QDropEvent *e) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1857 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1858 if (e->mimeData ()->hasUrls ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1859 { |
27676
ea7d36e9f197
use standard C++ range-based for loops instead of Qt foreach macro
John W. Eaton <jwe@octave.org>
parents:
27672
diff
changeset
|
1860 for (const auto& url : e->mimeData ()->urls ()) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1861 request_open_file (url.toLocalFile ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1862 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1863 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1864 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1865 bool file_editor::is_editor_console_tabbed (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1866 { |
29597
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1867 // FIXME: is there a way to do this job that doesn't require casting |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1868 // the parent to a main_window object? |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1869 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1870 main_window *w = dynamic_cast<main_window *> (parentWidget ()); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1871 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1872 if (w) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1873 { |
29597
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1874 QList<QDockWidget *> w_list = w->tabifiedDockWidgets (this); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1875 QDockWidget *console = |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1876 static_cast<QDockWidget *> (w->get_dock_widget_list ().at (0)); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1877 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1878 for (int i = 0; i < w_list.count (); i++) |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1879 { |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1880 if (w_list.at (i) == console) |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1881 return true; |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
1882 } |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1883 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1884 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1885 return false; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1886 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1887 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1888 void file_editor::construct (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1889 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1890 QWidget *editor_widget = new QWidget (this); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1891 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1892 // FIXME: what was the intended purpose of this unused variable? |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1893 // QStyle *editor_style = QApplication::style (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1894 |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
1895 // Menu bar: do not set it native, required in macOS and Ubuntu Unity (Qt5) |
27929
265b386f8b20
maint: Use two spaces between sentences in code comments.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1896 // for a visible menu bar in the editor widget. This property is ignored |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1897 // on other platforms. |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1898 m_menu_bar = new QMenuBar (editor_widget); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1899 m_menu_bar->setNativeMenuBar (false); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1900 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1901 m_tool_bar = new QToolBar (editor_widget); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1902 m_tool_bar->setMovable (true); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1903 |
29713
7b4b7e2a524d
fix signal connection to grand parent
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29707
diff
changeset
|
1904 m_tab_widget = new file_editor_tab_widget (editor_widget, this); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1905 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1906 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1907 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1908 // the mru-list and an empty array of actions |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1909 gui_settings *settings = rmgr.get_settings (); |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1910 m_mru_files = settings->value (ed_mru_file_list).toStringList (); |
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
1911 m_mru_files_encodings = settings->value (ed_mru_file_encodings) |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
24731
diff
changeset
|
1912 .toStringList (); |
18944
b2c4d6d461f0
fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents:
18767
diff
changeset
|
1913 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1914 if (m_mru_files_encodings.count () != m_mru_files.count ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1915 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1916 // encodings don't have the same count -> do not use them! |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1917 m_mru_files_encodings = QStringList (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1918 for (int i = 0; i < m_mru_files.count (); i++) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1919 m_mru_files_encodings << QString (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1920 } |
24130
6fdbdb66d7cb
set editor menu bar as non-native menu bar on all platforms
Torsten <mttl@mailbox.org>
parents:
24123
diff
changeset
|
1921 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1922 for (int i = 0; i < MaxMRUFiles; ++i) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1923 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1924 m_mru_file_actions[i] = new QAction (this); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1925 m_mru_file_actions[i]->setVisible (false); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1926 } |
24130
6fdbdb66d7cb
set editor menu bar as non-native menu bar on all platforms
Torsten <mttl@mailbox.org>
parents:
24123
diff
changeset
|
1927 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1928 // menu bar |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1929 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1930 // file menu |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
1931 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1932 m_fileMenu = add_menu (m_menu_bar, tr ("&File")); |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1933 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1934 // new and open menus are inserted later by the main window |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1935 m_mru_file_menu = new QMenu (tr ("&Recent Editor Files"), m_fileMenu); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1936 for (int i = 0; i < MaxMRUFiles; ++i) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1937 m_mru_file_menu->addAction (m_mru_file_actions[i]); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1938 m_fileMenu->addMenu (m_mru_file_menu); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1939 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1940 m_fileMenu->addSeparator (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1941 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1942 m_edit_function_action |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1943 = add_action (m_fileMenu, |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1944 tr ("&Edit Function"), |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1945 SLOT (request_context_edit (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1946 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1947 m_fileMenu->addSeparator (); |
20814
2da4058d65c7
store the encoding of recent editor files in the mru list
Torsten <ttl@justmail.de>
parents:
20796
diff
changeset
|
1948 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1949 m_save_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1950 = add_action (m_fileMenu, rmgr.icon ("document-save"), |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1951 tr ("&Save File"), SLOT (request_save_file (bool))); |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1952 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1953 m_save_as_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1954 = add_action (m_fileMenu, rmgr.icon ("document-save-as"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1955 tr ("Save File &As..."), |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1956 SLOT (request_save_file_as (bool))); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
1957 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1958 m_fileMenu->addSeparator (); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1959 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1960 m_close_action |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
1961 = add_action (m_fileMenu, rmgr.icon ("window-close", false), |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1962 tr ("&Close"), SLOT (request_close_file (bool))); |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1963 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1964 m_close_all_action |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
1965 = add_action (m_fileMenu, rmgr.icon ("window-close", false), |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1966 tr ("Close All"), SLOT (request_close_all_files (bool))); |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1967 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1968 m_close_others_action |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
1969 = add_action (m_fileMenu, rmgr.icon ("window-close", false), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1970 tr ("Close Other Files"), |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1971 SLOT (request_close_other_files (bool))); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1972 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1973 m_fileMenu->addSeparator (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1974 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1975 m_print_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1976 = add_action (m_fileMenu, rmgr.icon ("document-print"), |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1977 tr ("Print..."), SLOT (request_print_file (bool))); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1978 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1979 // edit menu (undo, copy, paste and select all later via main window) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1980 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1981 m_edit_menu = add_menu (m_menu_bar, tr ("&Edit")); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
1982 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1983 m_redo_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1984 = add_action (m_edit_menu, rmgr.icon ("edit-redo"), |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1985 tr ("&Redo"), SLOT (request_redo (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1986 m_redo_action->setEnabled (false); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1987 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1988 m_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
|
1989 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1990 m_cut_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1991 = add_action (m_edit_menu, rmgr.icon ("edit-cut"), |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1992 tr ("Cu&t"), SLOT (request_cut (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
1993 m_cut_action->setEnabled (false); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
1994 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1995 m_find_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1996 = add_action (m_edit_menu, rmgr.icon ("edit-find-replace"), |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
1997 tr ("&Find and Replace..."), SLOT (request_find (bool))); |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1998 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
1999 m_find_next_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2000 = add_action (m_edit_menu, tr ("Find &Next..."), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2001 SLOT (request_find_next (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2002 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2003 m_find_previous_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2004 = add_action (m_edit_menu, tr ("Find &Previous..."), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2005 SLOT (request_find_previous (bool))); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2006 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2007 m_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
|
2008 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2009 m_edit_cmd_menu = m_edit_menu->addMenu (tr ("&Commands")); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2010 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2011 m_delete_line_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2012 = add_action (m_edit_cmd_menu, tr ("Delete Line"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2013 SLOT (request_delete_line (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2014 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2015 m_copy_line_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2016 = add_action (m_edit_cmd_menu, tr ("Copy Line"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2017 SLOT (request_copy_line (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2018 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2019 m_cut_line_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2020 = add_action (m_edit_cmd_menu, tr ("Cut Line"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2021 SLOT (request_cut_line (bool))); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2022 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2023 m_edit_cmd_menu->addSeparator (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2024 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2025 m_delete_start_word_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2026 = add_action (m_edit_cmd_menu, tr ("Delete to Start of Word"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2027 SLOT (request_delete_start_word (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2028 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2029 m_delete_end_word_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2030 = add_action (m_edit_cmd_menu, tr ("Delete to End of Word"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2031 SLOT (request_delete_end_word (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2032 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2033 m_delete_start_line_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2034 = add_action (m_edit_cmd_menu, tr ("Delete to Start of Line"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2035 SLOT (request_delete_start_line (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2036 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2037 m_delete_end_line_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2038 = add_action (m_edit_cmd_menu, tr ("Delete to End of Line"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2039 SLOT (request_delete_end_line (bool))); |
22169
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2040 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2041 m_edit_cmd_menu->addSeparator (); |
22169
b3ced5e3cebb
Enable shortcuts for find next / find previous
Lachlan Andrew <lachlanbis@gmail.com>
parents:
22022
diff
changeset
|
2042 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2043 m_duplicate_selection_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2044 = add_action (m_edit_cmd_menu, tr ("Duplicate Selection/Line"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2045 SLOT (request_duplicate_selection (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2046 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2047 m_transpose_line_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2048 = add_action (m_edit_cmd_menu, tr ("Transpose Line"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2049 SLOT (request_transpose_line (bool))); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2050 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2051 m_edit_cmd_menu->addSeparator (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2052 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2053 m_completion_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2054 = add_action (m_edit_cmd_menu, tr ("&Show Completion List"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2055 SLOT (request_completion (bool))); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2056 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2057 m_edit_fmt_menu = m_edit_menu->addMenu (tr ("&Format")); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2058 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2059 m_upper_case_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2060 = add_action (m_edit_fmt_menu, tr ("&Uppercase Selection"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2061 SLOT (request_upper_case (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2062 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2063 m_lower_case_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2064 = add_action (m_edit_fmt_menu, tr ("&Lowercase Selection"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2065 SLOT (request_lower_case (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2066 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2067 m_edit_fmt_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
|
2068 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2069 m_comment_selection_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2070 = add_action (m_edit_fmt_menu, tr ("&Comment"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2071 SLOT (request_comment_selected_text (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2072 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2073 m_uncomment_selection_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2074 = add_action (m_edit_fmt_menu, tr ("&Uncomment"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2075 SLOT (request_uncomment_selected_text (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2076 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2077 m_comment_var_selection_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2078 = add_action (m_edit_fmt_menu, tr ("Comment (Choosing String)"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2079 SLOT (request_comment_var_selected_text (bool))); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2080 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2081 m_edit_fmt_menu->addSeparator (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2082 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2083 m_indent_selection_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2084 = add_action (m_edit_fmt_menu, tr ("&Indent Selection Rigidly"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2085 SLOT (request_indent_selected_text (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2086 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2087 m_unindent_selection_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2088 = add_action (m_edit_fmt_menu, tr ("&Unindent Selection Rigidly"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2089 SLOT (request_unindent_selected_text (bool))); |
19247
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
2090 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2091 m_smart_indent_line_or_selection_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2092 = add_action (m_edit_fmt_menu, tr ("Indent Code"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2093 SLOT (request_smart_indent_line_or_selected_text (void))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2094 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2095 m_edit_fmt_menu->addSeparator (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2096 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2097 m_conv_eol_windows_action |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2098 = add_action (m_edit_fmt_menu, |
25064
27ade14df345
Some minor string changes (bug #53526).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25062
diff
changeset
|
2099 tr ("Convert Line Endings to &Windows (CRLF)"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2100 SLOT (request_conv_eol_windows (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2101 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2102 m_conv_eol_unix_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2103 = add_action (m_edit_fmt_menu, tr ("Convert Line Endings to &Unix (LF)"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2104 SLOT (request_conv_eol_unix (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2105 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2106 m_conv_eol_mac_action |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2107 = add_action (m_edit_fmt_menu, |
26524
027f3c884763
Change EOL format label from "Mac (CR)" to "Legacy Mac (CR)" in GUI
Andrew Janke <andrew@apjanke.net>
parents:
26376
diff
changeset
|
2108 tr ("Convert Line Endings to Legacy &Mac (CR)"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2109 SLOT (request_conv_eol_mac (bool))); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2110 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2111 m_edit_nav_menu = m_edit_menu->addMenu (tr ("Navi&gation")); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2112 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2113 m_goto_line_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2114 = add_action (m_edit_nav_menu, tr ("Go &to Line..."), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2115 SLOT (request_goto_line (bool))); |
24232
e0bcd17ac070
smart indentation for selections or current line in code editor
John W. Eaton <jwe@octave.org>
parents:
24130
diff
changeset
|
2116 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2117 m_edit_cmd_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
|
2118 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2119 m_move_to_matching_brace |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2120 = add_action (m_edit_nav_menu, tr ("Move to Matching Brace"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2121 SLOT (request_move_match_brace (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2122 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2123 m_sel_to_matching_brace |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2124 = add_action (m_edit_nav_menu, tr ("Select to Matching Brace"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2125 SLOT (request_sel_match_brace (bool))); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2126 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2127 m_edit_nav_menu->addSeparator (); |
19247
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19246
diff
changeset
|
2128 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2129 m_next_bookmark_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2130 = add_action (m_edit_nav_menu, tr ("&Next Bookmark"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2131 SLOT (request_next_bookmark (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2132 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2133 m_previous_bookmark_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2134 = add_action (m_edit_nav_menu, tr ("Pre&vious Bookmark"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2135 SLOT (request_previous_bookmark (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2136 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2137 m_toggle_bookmark_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2138 = add_action (m_edit_nav_menu, tr ("Toggle &Bookmark"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2139 SLOT (request_toggle_bookmark (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2140 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2141 m_remove_bookmark_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2142 = add_action (m_edit_nav_menu, tr ("&Remove All Bookmarks"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2143 SLOT (request_remove_bookmark (bool))); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2144 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2145 m_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
|
2146 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2147 m_preferences_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2148 = add_action (m_edit_menu, rmgr.icon ("preferences-system"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2149 tr ("&Preferences..."), |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2150 SLOT (request_preferences (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2151 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2152 m_styles_preferences_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2153 = add_action (m_edit_menu, rmgr.icon ("preferences-system"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2154 tr ("&Styles Preferences..."), |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2155 SLOT (request_styles_preferences (bool))); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2156 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2157 // view menu |
19629
8ef79bc61d8a
add actions for moving/selecting to matching brace
Torsten <ttl@justmail.de>
parents:
19608
diff
changeset
|
2158 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2159 QMenu *view_menu = add_menu (m_menu_bar, tr ("&View")); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2160 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2161 m_view_editor_menu = view_menu->addMenu (tr ("&Editor")); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2162 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2163 m_show_linenum_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2164 = add_action (m_view_editor_menu, tr ("Show &Line Numbers"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2165 SLOT (show_line_numbers (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2166 m_show_linenum_action->setCheckable (true); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2167 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2168 m_show_whitespace_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2169 = add_action (m_view_editor_menu, tr ("Show &Whitespace Characters"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2170 SLOT (show_white_space (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2171 m_show_whitespace_action->setCheckable (true); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2172 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2173 m_show_eol_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2174 = add_action (m_view_editor_menu, tr ("Show Line &Endings"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2175 SLOT (show_eol_chars (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2176 m_show_eol_action->setCheckable (true); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2177 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2178 m_show_indguide_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2179 = add_action (m_view_editor_menu, tr ("Show &Indentation Guides"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2180 SLOT (show_indent_guides (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2181 m_show_indguide_action->setCheckable (true); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2182 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2183 m_show_longline_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2184 = add_action (m_view_editor_menu, tr ("Show Long Line &Marker"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2185 SLOT (show_long_line (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2186 m_show_longline_action->setCheckable (true); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2187 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2188 m_view_editor_menu->addSeparator (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2189 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2190 m_show_toolbar_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2191 = add_action (m_view_editor_menu, tr ("Show &Toolbar"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2192 SLOT (show_toolbar (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2193 m_show_toolbar_action->setCheckable (true); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2194 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2195 m_show_statusbar_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2196 = add_action (m_view_editor_menu, tr ("Show &Statusbar"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2197 SLOT (show_statusbar (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2198 m_show_statusbar_action->setCheckable (true); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2199 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2200 m_show_hscrollbar_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2201 = add_action (m_view_editor_menu, tr ("Show &Horizontal Scrollbar"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2202 SLOT (show_hscrollbar (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2203 m_show_hscrollbar_action->setCheckable (true); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2204 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2205 view_menu->addSeparator (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2206 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2207 m_zoom_in_action |
30772
36dc11ee220d
reorganize GUIs icons
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30745
diff
changeset
|
2208 = add_action (view_menu, rmgr.icon ("view-zoom-in"), tr ("Zoom &In"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2209 SLOT (zoom_in (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2210 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2211 m_zoom_out_action |
30772
36dc11ee220d
reorganize GUIs icons
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30745
diff
changeset
|
2212 = add_action (view_menu, rmgr.icon ("view-zoom-out"), tr ("Zoom &Out"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2213 SLOT (zoom_out (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2214 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2215 m_zoom_normal_action |
30772
36dc11ee220d
reorganize GUIs icons
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30745
diff
changeset
|
2216 = add_action (view_menu, rmgr.icon ("view-zoom-original"), tr ("&Normal Size"), |
36dc11ee220d
reorganize GUIs icons
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30745
diff
changeset
|
2217 SLOT (zoom_normal (bool))); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2218 |
27330
e449134870fb
allow to sort editor tabs alphabetically (bug #42602)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27302
diff
changeset
|
2219 view_menu->addSeparator (); |
e449134870fb
allow to sort editor tabs alphabetically (bug #42602)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27302
diff
changeset
|
2220 |
e449134870fb
allow to sort editor tabs alphabetically (bug #42602)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27302
diff
changeset
|
2221 m_sort_tabs_action |
e449134870fb
allow to sort editor tabs alphabetically (bug #42602)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27302
diff
changeset
|
2222 = add_action (view_menu, tr ("&Sort Tabs Alphabetically"), |
e449134870fb
allow to sort editor tabs alphabetically (bug #42602)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27302
diff
changeset
|
2223 SLOT (sort_tabs_alph (void)), |
e449134870fb
allow to sort editor tabs alphabetically (bug #42602)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27302
diff
changeset
|
2224 m_tab_widget->get_tab_bar ()); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2225 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2226 m_menu_bar->addMenu (view_menu); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2227 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2228 // debug menu |
21002
314245afff3a
add a menu entry for showing/hiding the editor horizontal scrollbar
Torsten <ttl@justmail.de>
parents:
21001
diff
changeset
|
2229 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2230 m_debug_menu = add_menu (m_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
|
2231 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2232 m_toggle_breakpoint_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2233 = add_action (m_debug_menu, rmgr.icon ("bp-toggle"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2234 tr ("Toggle &Breakpoint"), |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2235 SLOT (request_toggle_breakpoint (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2236 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2237 m_next_breakpoint_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2238 = add_action (m_debug_menu, rmgr.icon ("bp-next"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2239 tr ("&Next Breakpoint"), |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2240 SLOT (request_next_breakpoint (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2241 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2242 m_previous_breakpoint_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2243 = add_action (m_debug_menu, rmgr.icon ("bp-prev"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2244 tr ("Pre&vious Breakpoint"), |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2245 SLOT (request_previous_breakpoint (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2246 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2247 m_remove_all_breakpoints_action |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2248 = add_action (m_debug_menu, rmgr.icon ("bp-rm-all"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2249 tr ("&Remove All Breakpoints"), |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2250 SLOT (request_remove_breakpoint (bool))); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2251 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2252 m_debug_menu->addSeparator (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2253 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2254 // The other debug actions will be added by the main window. |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2255 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2256 // run menu |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2257 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2258 QMenu *_run_menu = add_menu (m_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
|
2259 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2260 m_run_action |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2261 = add_action (_run_menu, |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2262 rmgr.icon ("system-run"), |
26875
ce972086bfd6
save & run action in editor now also continues in debug mode (bug #44730)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26873
diff
changeset
|
2263 tr ("Save File and Run / Continue"), |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2264 SLOT (request_run_file (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2265 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2266 m_run_selection_action |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2267 = add_action (_run_menu, |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2268 tr ("Run &Selection"), |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2269 SLOT (request_context_run (bool))); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2270 m_run_selection_action->setEnabled (false); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2271 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2272 // help menu |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2273 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2274 QMenu *_help_menu = add_menu (m_menu_bar, tr ("&Help")); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2275 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2276 m_context_help_action |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2277 = add_action (_help_menu, |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2278 tr ("&Help on Keyword"), |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2279 SLOT (request_context_help (bool))); |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2280 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2281 m_context_doc_action |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2282 = add_action (_help_menu, |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2283 tr ("&Documentation on Keyword"), |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2284 SLOT (request_context_doc (bool))); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2285 |
24731
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2286 // tab navigation (no menu, only actions; slots in tab_bar) |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2287 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2288 m_switch_left_tab_action |
24731
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2289 = add_action (nullptr, "", SLOT (switch_left_tab (void)), |
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2290 m_tab_widget->get_tab_bar ()); |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2291 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2292 m_switch_right_tab_action |
24731
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2293 = add_action (nullptr, "", SLOT (switch_right_tab (void)), |
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2294 m_tab_widget->get_tab_bar ()); |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2295 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2296 m_move_tab_left_action |
24731
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2297 = add_action (nullptr, "", SLOT (move_tab_left (void)), |
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2298 m_tab_widget->get_tab_bar ()); |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2299 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2300 m_move_tab_right_action |
24731
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2301 = add_action (nullptr, "", SLOT (move_tab_right (void)), |
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2302 m_tab_widget->get_tab_bar ()); |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2303 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2304 // toolbar |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2305 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2306 // popdown menu with mru files |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2307 QToolButton *popdown_button = new QToolButton (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2308 popdown_button->setToolTip (tr ("Recent Files")); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2309 popdown_button->setMenu (m_mru_file_menu); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2310 popdown_button->setPopupMode (QToolButton::InstantPopup); |
26108
ed2339e64a57
Place down-arrow icon on most-recently-used popdown menu in editor (bug #55032).
Rik <rik@octave.org>
parents:
25293
diff
changeset
|
2311 popdown_button->setArrowType (Qt::DownArrow); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2312 popdown_button->setToolButtonStyle (Qt::ToolButtonTextOnly); |
18665
777281eeb3d4
add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents:
18656
diff
changeset
|
2313 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2314 // new and open actions are inserted later from main window |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2315 m_popdown_mru_action = m_tool_bar->addWidget (popdown_button); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2316 m_tool_bar->addAction (m_save_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2317 m_tool_bar->addAction (m_save_as_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2318 m_tool_bar->addAction (m_print_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2319 m_tool_bar->addSeparator (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2320 // m_undo_action: later via main window |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2321 m_tool_bar->addAction (m_redo_action); |
25813
d98d7df9fd15
updated context menus in editor and console window (bug #46884)
Torsten <mttl@mailbox.org>
parents:
25790
diff
changeset
|
2322 m_tool_bar->addSeparator (); |
27074
d302dfa0c572
fix order of cut, copy paste actions in editor menu and toolbar (bug #56230)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27055
diff
changeset
|
2323 m_tool_bar->addAction (m_cut_action); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2324 // m_copy_action: later via the main window |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2325 // m_paste_action: later via the main window |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2326 m_tool_bar->addAction (m_find_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2327 //m_tool_bar->addAction (m_find_next_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2328 //m_tool_bar->addAction (m_find_previous_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2329 m_tool_bar->addSeparator (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2330 m_tool_bar->addAction (m_run_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2331 m_tool_bar->addSeparator (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2332 m_tool_bar->addAction (m_toggle_breakpoint_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2333 m_tool_bar->addAction (m_previous_breakpoint_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2334 m_tool_bar->addAction (m_next_breakpoint_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2335 m_tool_bar->addAction (m_remove_all_breakpoints_action); |
20754
e6ccc8ae9e41
add list of mru files to the toolbar of the editor
Torsten <ttl@justmail.de>
parents:
20720
diff
changeset
|
2336 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2337 // layout |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2338 QVBoxLayout *vbox_layout = new QVBoxLayout (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2339 vbox_layout->addWidget (m_menu_bar); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2340 vbox_layout->addWidget (m_tool_bar); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2341 vbox_layout->addWidget (m_tab_widget); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2342 vbox_layout->setMargin (0); |
27090
e83d3161b256
make editor toolbar, tabs and statusbar more comapct (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27089
diff
changeset
|
2343 vbox_layout->setSpacing (0); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2344 editor_widget->setLayout (vbox_layout); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2345 setWidget (editor_widget); |
16981
e86df0d43309
make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents:
16970
diff
changeset
|
2346 |
29465
0e9319d40977
add all open tabs to the context menu of the editor tabs (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29439
diff
changeset
|
2347 // Create the basic context menu of the tab bar with editor actions. |
0e9319d40977
add all open tabs to the context menu of the editor tabs (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29439
diff
changeset
|
2348 // Actions for selecting an tab are added when the menu is activated. |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2349 tab_bar *bar = m_tab_widget->get_tab_bar (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2350 QMenu *ctx_men = bar->get_context_menu (); |
29465
0e9319d40977
add all open tabs to the context menu of the editor tabs (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29439
diff
changeset
|
2351 ctx_men->addSeparator (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2352 ctx_men->addAction (m_close_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2353 ctx_men->addAction (m_close_all_action); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2354 ctx_men->addAction (m_close_others_action); |
27330
e449134870fb
allow to sort editor tabs alphabetically (bug #42602)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27302
diff
changeset
|
2355 ctx_men->addSeparator (); |
e449134870fb
allow to sort editor tabs alphabetically (bug #42602)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27302
diff
changeset
|
2356 ctx_men->addAction (m_sort_tabs_action); |
29469
b4906d3eeb63
provide a tab context menu entry for copying the full path of an editor file
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29468
diff
changeset
|
2357 add_action (ctx_men, tr ("Copy Full File &Path"), |
b4906d3eeb63
provide a tab context menu entry for copying the full path of an editor file
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29468
diff
changeset
|
2358 SLOT (copy_full_file_path (bool)), this); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2359 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2360 // signals |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2361 connect (m_mru_file_menu, &QMenu::triggered, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2362 this, &file_editor::request_mru_open_file); |
23321
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2363 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2364 mru_menu_update (); |
23150
d133d90b495a
connect execute command signal in editor constructor (bug #50171)
Torsten <mttl@mailbox.org>
parents:
23146
diff
changeset
|
2365 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2366 connect (m_tab_widget, &file_editor_tab_widget::tabCloseRequested, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2367 this, &file_editor::handle_tab_close_request); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2368 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2369 connect (m_tab_widget, &file_editor_tab_widget::currentChanged, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2370 this, &file_editor::active_tab_changed); |
17676
c060ad097056
add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents:
17639
diff
changeset
|
2371 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2372 resize (500, 400); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2373 set_title (tr ("Editor")); |
16558 | 2374 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2375 check_actions (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2376 } |
16558 | 2377 |
28382
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2378 // Slot when autocompletion list was cancelled |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2379 void file_editor::handle_autoc_cancelled (void) |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2380 { |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2381 // List was cancelled but somehow still active and blocking the |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2382 // edit area from accepting shortcuts. Only after another keypress |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2383 // shortcuts and lists are working againnas expected. This is |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2384 // probably caused by qt bug https://bugreports.qt.io/browse/QTBUG-83720 |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2385 // Hack: Accept the list, which is hidden but still active |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2386 // and undo the text insertion, if any |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2387 |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2388 file_editor_tab *f = reset_focus (); |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2389 octave_qscintilla *qsci = f->qsci_edit_area (); |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2390 |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2391 int line, col; |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2392 qsci->getCursorPosition (&line, &col); |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2393 int l1 = qsci->lineLength (line); // Current line length |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2394 |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2395 // Accept autocompletion |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2396 qsci->SendScintilla (QsciScintillaBase::SCI_AUTOCCOMPLETE); |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2397 |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2398 // Was text inserted? If yes, undo |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2399 if (qsci->text (line).length () - l1) |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2400 qsci->undo (); |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2401 } |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2402 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
2403 file_editor_tab *file_editor::reset_focus (void) |
28382
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2404 { |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2405 // Reset the focus of the tab and the related edit area |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2406 file_editor_tab *f |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
2407 = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ()); |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
2408 emit fetab_set_focus (f); |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
2409 return f; |
28382
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2410 } |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2411 |
27400
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2412 file_editor_tab * |
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2413 file_editor::make_file_editor_tab (const QString& directory) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2414 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2415 file_editor_tab *f = new file_editor_tab (m_octave_qobj, directory); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
2416 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2417 // signals from the qscintilla edit area |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2418 connect (f->qsci_edit_area (), &octave_qscintilla::status_update, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2419 this, &file_editor::edit_status_update); |
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
|
2420 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2421 connect (f->qsci_edit_area (), &octave_qscintilla::create_context_menu_signal, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2422 this, &file_editor::create_context_menu); |
27556
410622ac120f
improve run selection from editor (bug #42705)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27467
diff
changeset
|
2423 |
28382
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2424 connect (f->qsci_edit_area (), |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
2425 SIGNAL (SCN_AUTOCCOMPLETED (const char *, int, int, int)), |
28382
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2426 this, SLOT (reset_focus (void))); |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2427 |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2428 connect (f->qsci_edit_area (), SIGNAL (SCN_AUTOCCANCELLED (void)), |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2429 this, SLOT (handle_autoc_cancelled (void))); |
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2430 |
28798
82ccc4e69ba3
show value in editor when hovering over variable in debug mode (bug #56990)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28788
diff
changeset
|
2431 // signals from the qscintilla edit area |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2432 connect (this, &file_editor::enter_debug_mode_signal, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2433 f->qsci_edit_area (), &octave_qscintilla::handle_enter_debug_mode); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2434 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2435 connect (this, &file_editor::exit_debug_mode_signal, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2436 f->qsci_edit_area (), &octave_qscintilla::handle_exit_debug_mode); |
28382
2b52e473b6ef
fix focus issues in editor due to qt bug with focus proxy chains (bug #57635)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27971
diff
changeset
|
2437 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2438 // Signals from the file editor_tab |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2439 connect (f, &file_editor_tab::autoc_closed, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2440 this, &file_editor::reset_focus); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2441 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2442 connect (f, &file_editor_tab::file_name_changed, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2443 this, &file_editor::handle_file_name_changed); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2444 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2445 connect (f, &file_editor_tab::editor_state_changed, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2446 this, &file_editor::handle_editor_state_changed); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2447 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2448 connect (f, &file_editor_tab::tab_remove_request, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2449 this, &file_editor::handle_tab_remove_request); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2450 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2451 connect (f, &file_editor_tab::editor_check_conflict_save, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2452 this, &file_editor::check_conflict_save); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2453 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2454 connect (f, &file_editor_tab::mru_add_file, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2455 this, &file_editor::handle_mru_add_file); |
16558 | 2456 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2457 connect (f, &file_editor_tab::request_open_file, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2458 this, [=] (const QString& fname, const QString& encoding) { request_open_file (fname, encoding); }); |
16558 | 2459 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2460 connect (f, &file_editor_tab::edit_area_changed, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2461 this, &file_editor::edit_area_changed); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2462 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2463 connect (f, &file_editor_tab::set_focus_editor_signal, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2464 this, &file_editor::set_focus); |
20995
aab7a3c7168e
edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents:
20992
diff
changeset
|
2465 |
28788
aba2c4eadb83
add functions of loaded packages to auto-completion list (bug #56207)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
28567
diff
changeset
|
2466 // Signals from the file_editor or main-win non-trivial operations |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2467 connect (this, &file_editor::fetab_settings_changed, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2468 f, [=] (const gui_settings *settings) { f->notice_settings (settings); }); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2469 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2470 connect (this, &file_editor::fetab_change_request, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2471 f, &file_editor_tab::change_editor_state); |
23177
0b59e37dd83e
unhide editor when a file was changed by an external application (bug #50106)
Torsten <mttl@mailbox.org>
parents:
23152
diff
changeset
|
2472 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
2473 connect (this, QOverload<const QWidget *, const QString&, bool>::of (&file_editor::fetab_save_file), |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
2474 f, QOverload<const QWidget *, const QString&, bool>::of (&file_editor_tab::save_file)); |
16558 | 2475 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2476 // Signals from the file_editor trivial operations |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2477 connect (this, &file_editor::fetab_recover_from_exit, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2478 f, &file_editor_tab::recover_from_exit); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2479 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2480 connect (this, &file_editor::fetab_set_directory, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2481 f, &file_editor_tab::set_current_directory); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2482 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2483 connect (this, &file_editor::fetab_zoom_in, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2484 f, &file_editor_tab::zoom_in); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2485 connect (this, &file_editor::fetab_zoom_out, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2486 f, &file_editor_tab::zoom_out); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2487 connect (this, &file_editor::fetab_zoom_normal, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2488 f, &file_editor_tab::zoom_normal); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2489 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2490 connect (this, &file_editor::fetab_context_help, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2491 f, &file_editor_tab::context_help); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2492 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2493 connect (this, &file_editor::fetab_context_edit, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2494 f, &file_editor_tab::context_edit); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2495 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
2496 connect (this, QOverload<const QWidget *>::of (&file_editor::fetab_save_file), |
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
2497 f, QOverload<const QWidget *>::of (&file_editor_tab::save_file)); |
29597
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2498 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2499 connect (this, &file_editor::fetab_save_file_as, |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2500 f, QOverload<const QWidget *>::of (&file_editor_tab::save_file_as)); |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
2501 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2502 connect (this, &file_editor::fetab_print_file, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2503 f, &file_editor_tab::print_file); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2504 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2505 connect (this, &file_editor::fetab_run_file, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2506 f, &file_editor_tab::run_file); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2507 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2508 connect (this, &file_editor::fetab_context_run, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2509 f, &file_editor_tab::context_run); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2510 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2511 connect (this, &file_editor::fetab_toggle_bookmark, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2512 f, &file_editor_tab::toggle_bookmark); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2513 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2514 connect (this, &file_editor::fetab_next_bookmark, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2515 f, &file_editor_tab::next_bookmark); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2516 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2517 connect (this, &file_editor::fetab_previous_bookmark, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2518 f, &file_editor_tab::previous_bookmark); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2519 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2520 connect (this, &file_editor::fetab_remove_bookmark, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2521 f, &file_editor_tab::remove_bookmark); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2522 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2523 connect (this, &file_editor::fetab_toggle_breakpoint, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2524 f, &file_editor_tab::toggle_breakpoint); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2525 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2526 connect (this, &file_editor::fetab_next_breakpoint, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2527 f, &file_editor_tab::next_breakpoint); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2528 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2529 connect (this, &file_editor::fetab_previous_breakpoint, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2530 f, &file_editor_tab::previous_breakpoint); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2531 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2532 connect (this, &file_editor::fetab_remove_all_breakpoints, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2533 f, &file_editor_tab::remove_all_breakpoints); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2534 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2535 connect (this, &file_editor::fetab_scintilla_command, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2536 f, &file_editor_tab::scintilla_command); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2537 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2538 connect (this, &file_editor::fetab_comment_selected_text, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2539 f, &file_editor_tab::comment_selected_text); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2540 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2541 connect (this, &file_editor::fetab_uncomment_selected_text, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2542 f, &file_editor_tab::uncomment_selected_text); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2543 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2544 connect (this, &file_editor::fetab_indent_selected_text, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2545 f, &file_editor_tab::indent_selected_text); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2546 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2547 connect (this, &file_editor::fetab_unindent_selected_text, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2548 f, &file_editor_tab::unindent_selected_text); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2549 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2550 connect (this, &file_editor::fetab_smart_indent_line_or_selected_text, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2551 f, &file_editor_tab::smart_indent_line_or_selected_text); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2552 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2553 connect (this, &file_editor::fetab_convert_eol, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2554 f, &file_editor_tab::convert_eol); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2555 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2556 connect (this, &file_editor::fetab_goto_line, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2557 f, &file_editor_tab::goto_line); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2558 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2559 connect (this, &file_editor::fetab_move_match_brace, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2560 f, &file_editor_tab::move_match_brace); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2561 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2562 connect (this, &file_editor::fetab_completion, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2563 f, &file_editor_tab::show_auto_completion); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2564 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2565 connect (this, &file_editor::fetab_set_focus, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2566 f, &file_editor_tab::set_focus); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2567 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2568 connect (this, &file_editor::fetab_insert_debugger_pointer, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2569 f, &file_editor_tab::insert_debugger_pointer); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2570 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2571 connect (this, &file_editor::fetab_delete_debugger_pointer, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2572 f, &file_editor_tab::delete_debugger_pointer); |
16558 | 2573 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2574 connect (this, &file_editor::fetab_do_breakpoint_marker, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2575 f, &file_editor_tab::do_breakpoint_marker); |
16558 | 2576 |
29597
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2577 connect (this, &file_editor::update_gui_lexer_signal, |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2578 f, &file_editor_tab::update_lexer_settings); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2579 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2580 // Convert other signals from the edit area and tab to editor signals. |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2581 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2582 connect (f->qsci_edit_area (), &octave_qscintilla::execute_command_in_terminal_signal, |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2583 this, &file_editor::execute_command_in_terminal_signal); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2584 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2585 connect (f->qsci_edit_area (), &octave_qscintilla::focus_console_after_command_signal, |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2586 this, &file_editor::focus_console_after_command_signal); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2587 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2588 connect (f, &file_editor_tab::run_file_signal, |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2589 this, &file_editor::run_file_signal); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2590 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2591 connect (f, &file_editor_tab::edit_mfile_request, |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2592 this, &file_editor::edit_mfile_request); |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2593 |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2594 connect (f, &file_editor_tab::debug_quit_signal, |
07591becbc40
eliminate more child to parent signal/slot connections
John W. Eaton <jwe@octave.org>
parents:
29574
diff
changeset
|
2595 this, &file_editor::debug_quit_signal); |
16558 | 2596 |
27302
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27281
diff
changeset
|
2597 // Any interpreter_event signal from a file_editor_tab_widget is |
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27281
diff
changeset
|
2598 // handled the same as for the parent main_window object. |
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27281
diff
changeset
|
2599 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2600 connect (f, QOverload<const fcn_callback&>::of (&file_editor_tab::interpreter_event), |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2601 this, QOverload<const fcn_callback&>::of (&file_editor::interpreter_event)); |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2602 |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2603 connect (f, QOverload<const meth_callback&>::of (&file_editor_tab::interpreter_event), |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29469
diff
changeset
|
2604 this, QOverload<const meth_callback&>::of (&file_editor::interpreter_event)); |
27302
5f170ea12fa1
use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents:
27281
diff
changeset
|
2605 |
27400
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2606 return f; |
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2607 } |
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2608 |
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2609 void file_editor::add_file_editor_tab (file_editor_tab *f, const QString& fn, |
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2610 int index) |
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2611 { |
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2612 if (index == -1) |
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2613 m_tab_widget->addTab (f, fn); |
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2614 else |
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2615 m_tab_widget->insertTab (index, f, fn); |
7cf857166440
connect signals when creating file_editor_tab in file editor
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
2616 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2617 m_tab_widget->setCurrentWidget (f); |
16558 | 2618 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2619 check_actions (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2620 } |
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
|
2621 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2622 void file_editor::mru_menu_update (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2623 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2624 int num_files = qMin (m_mru_files.size (), int (MaxMRUFiles)); |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15861
diff
changeset
|
2625 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2626 // configure and show active actions of mru-menu |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2627 for (int i = 0; i < num_files; ++i) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2628 { |
25062 | 2629 QString text = QString ("&%1 %2"). |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2630 arg ((i+1) % int (MaxMRUFiles)).arg (m_mru_files.at (i)); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2631 m_mru_file_actions[i]->setText (text); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2632 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2633 QStringList action_data; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2634 action_data << m_mru_files.at (i) << m_mru_files_encodings.at (i); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2635 m_mru_file_actions[i]->setData (action_data); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2636 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2637 m_mru_file_actions[i]->setVisible (true); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2638 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2639 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2640 // hide unused mru-menu entries |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2641 for (int j = num_files; j < MaxMRUFiles; ++j) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2642 m_mru_file_actions[j]->setVisible (false); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2643 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2644 // delete entries in string-list beyond MaxMRUFiles |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2645 while (m_mru_files.size () > MaxMRUFiles) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2646 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2647 m_mru_files.removeLast (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2648 m_mru_files_encodings.removeLast (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2649 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2650 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2651 // save actual mru-list in settings |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2652 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2653 gui_settings *settings = rmgr.get_settings (); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2654 |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
2655 settings->setValue (ed_mru_file_list.key, m_mru_files); |
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
2656 settings->setValue (ed_mru_file_encodings.key, m_mru_files_encodings); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2657 settings->sync (); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2658 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2659 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2660 bool file_editor::call_custom_editor (const QString& file_name, int line) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2661 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2662 // Check if the user wants to use a custom file editor. |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2663 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2664 gui_settings *settings = rmgr.get_settings (); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2665 |
27805
dccc551aa83b
replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27787
diff
changeset
|
2666 if (settings->value (global_use_custom_editor.key, |
dccc551aa83b
replace literal strings by symbolic constants for global preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27787
diff
changeset
|
2667 global_use_custom_editor.def).toBool ()) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2668 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2669 // use the external editor interface for handling the call |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2670 emit request_open_file_external (file_name, line); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2671 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2672 if (line < 0 && ! file_name.isEmpty ()) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2673 handle_mru_add_file (QFileInfo (file_name).canonicalFilePath (), |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2674 QString ()); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2675 |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2676 return true; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2677 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2678 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2679 return false; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2680 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2681 |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
2682 void file_editor::toggle_preference (const gui_pref& preference) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2683 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2684 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
2685 gui_settings *settings = rmgr.get_settings (); |
27861
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
2686 |
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
2687 bool old = settings->value (preference).toBool (); |
3fada47cc58a
replacing literals for editor prefs by symbolic constants
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27849
diff
changeset
|
2688 settings->setValue (preference.key, ! old); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2689 notice_settings (settings); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2690 } |
19945
f7a805f02723
link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents:
19930
diff
changeset
|
2691 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2692 // Function for closing the files in a removed directory |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2693 void file_editor::handle_dir_remove (const QString& old_name, |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2694 const QString& new_name) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2695 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2696 QDir old_dir (old_name); |
30745
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2697 removed_file_data f_data; |
20693
7751bd56d0be
added actions and shortcuts for switching editor tabs
Torsten <ttl@justmail.de>
parents:
20630
diff
changeset
|
2698 |
27635
a10b3e56d678
simplify loop over tabs in file_editor::handle_dir_remove
John W. Eaton <jwe@octave.org>
parents:
27634
diff
changeset
|
2699 std::list<file_editor_tab *> editor_tab_lst = m_tab_widget->tab_list (); |
a10b3e56d678
simplify loop over tabs in file_editor::handle_dir_remove
John W. Eaton <jwe@octave.org>
parents:
27634
diff
changeset
|
2700 |
a10b3e56d678
simplify loop over tabs in file_editor::handle_dir_remove
John W. Eaton <jwe@octave.org>
parents:
27634
diff
changeset
|
2701 for (auto editor_tab : editor_tab_lst) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2702 { |
27635
a10b3e56d678
simplify loop over tabs in file_editor::handle_dir_remove
John W. Eaton <jwe@octave.org>
parents:
27634
diff
changeset
|
2703 QString file_name = editor_tab->file_name (); |
a10b3e56d678
simplify loop over tabs in file_editor::handle_dir_remove
John W. Eaton <jwe@octave.org>
parents:
27634
diff
changeset
|
2704 |
a10b3e56d678
simplify loop over tabs in file_editor::handle_dir_remove
John W. Eaton <jwe@octave.org>
parents:
27634
diff
changeset
|
2705 if (file_name.isEmpty ()) |
26928
3e6aa7c7bbbb
prevent unnamed editor tab from being closed by rmdir (bug #55888)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26554
diff
changeset
|
2706 continue; // Nothing to do, no valid file name |
3e6aa7c7bbbb
prevent unnamed editor tab from being closed by rmdir (bug #55888)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26554
diff
changeset
|
2707 |
27047
66fa9ebb0c3e
prevent editor from closing files that are not affected by rmdir (bug #55823)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26928
diff
changeset
|
2708 // Get abs. file path and its path relative to the removed directory |
27635
a10b3e56d678
simplify loop over tabs in file_editor::handle_dir_remove
John W. Eaton <jwe@octave.org>
parents:
27634
diff
changeset
|
2709 QString rel_path_to_file = old_dir.relativeFilePath (file_name); |
a10b3e56d678
simplify loop over tabs in file_editor::handle_dir_remove
John W. Eaton <jwe@octave.org>
parents:
27634
diff
changeset
|
2710 QString abs_path_to_file = old_dir.absoluteFilePath (file_name); |
27047
66fa9ebb0c3e
prevent editor from closing files that are not affected by rmdir (bug #55823)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26928
diff
changeset
|
2711 |
66fa9ebb0c3e
prevent editor from closing files that are not affected by rmdir (bug #55823)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26928
diff
changeset
|
2712 // Test whether the file is located within the directory that will |
27929
265b386f8b20
maint: Use two spaces between sentences in code comments.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
2713 // be removed. For this, two conditions must be met: |
27047
66fa9ebb0c3e
prevent editor from closing files that are not affected by rmdir (bug #55823)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26928
diff
changeset
|
2714 // 1. The path of the file rel. to the dir is not equal to the |
66fa9ebb0c3e
prevent editor from closing files that are not affected by rmdir (bug #55823)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26928
diff
changeset
|
2715 // its absolute one. |
66fa9ebb0c3e
prevent editor from closing files that are not affected by rmdir (bug #55823)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26928
diff
changeset
|
2716 // If both are equal, then there is no relative path and removed |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27861
diff
changeset
|
2717 // directory and file are on different drives (e.g. on windows) |
27047
66fa9ebb0c3e
prevent editor from closing files that are not affected by rmdir (bug #55823)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26928
diff
changeset
|
2718 // 2. The (real) relative path does not start with "../", i.e., |
66fa9ebb0c3e
prevent editor from closing files that are not affected by rmdir (bug #55823)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26928
diff
changeset
|
2719 // the file can be reached from the directory by descending only |
66fa9ebb0c3e
prevent editor from closing files that are not affected by rmdir (bug #55823)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26928
diff
changeset
|
2720 if ((rel_path_to_file != abs_path_to_file) |
66fa9ebb0c3e
prevent editor from closing files that are not affected by rmdir (bug #55823)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26928
diff
changeset
|
2721 && (rel_path_to_file.left (3) != QString ("../"))) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2722 { |
27047
66fa9ebb0c3e
prevent editor from closing files that are not affected by rmdir (bug #55823)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26928
diff
changeset
|
2723 // The currently considered file is included in the |
30745
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2724 // removed/renamed diectory: remeber it |
25743
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
2725 if (editor_tab) |
c2a703df0215
preserve tab position and line when reloading renamed editor file (bug #49322)
Torsten <mttl@mailbox.org>
parents:
25742
diff
changeset
|
2726 { |
30745
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2727 editor_tab->enable_file_watcher (false); |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2728 f_data.editor_tab = editor_tab; |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2729 |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2730 // Add the new file path and the encoding for later reloading |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2731 // if new_name is given |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2732 if (! new_name.isEmpty ()) |
25790
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
2733 { |
30745
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2734 QDir new_dir (new_name); |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2735 QString append_to_new_dir; |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2736 if (new_dir.exists ()) |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2737 { |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2738 // The new directory already exists (movefile was used). |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2739 // This means, we have to add the name (not the path) |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2740 // of the old dir and the relative path to the file |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2741 // to new dir. |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2742 append_to_new_dir |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2743 = old_dir.dirName () + "/" + rel_path_to_file; |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2744 } |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2745 else |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2746 append_to_new_dir = rel_path_to_file; |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2747 |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2748 f_data.new_file_name |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2749 = new_dir.absoluteFilePath (append_to_new_dir); |
25790
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
2750 } |
872111558bc0
reload editor files when their path changes by using movefile (bug #43922)
Torsten <mttl@mailbox.org>
parents:
25748
diff
changeset
|
2751 else |
30745
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2752 f_data.new_file_name = ""; // no new name, just removing this file |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2753 |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2754 // Store data in list for later reloading |
2f6904439d3c
fix updating the name of renamed editor files
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
2755 m_tmp_closed_files << f_data; |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2756 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2757 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2758 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2759 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2760 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2761 bool file_editor::editor_tab_has_focus (void) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2762 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2763 QWidget *foc_w = focusWidget (); |
24730
05c9f42512cb
* file-editor.cc: fix broken copy/cut/past/undo actions
Torsten <mttl@mailbox.org>
parents:
24717
diff
changeset
|
2764 if (foc_w && foc_w->inherits ("octave::octave_qscintilla")) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2765 return true; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2766 return false; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2767 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2768 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2769 // Check whether this file is already open in the editor. |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29935
diff
changeset
|
2770 file_editor_tab *file_editor::find_tab_widget (const QString& file) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2771 { |
27634
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2772 std::string std_file = file.toStdString (); |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2773 |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2774 std::list<file_editor_tab *> fe_tab_lst = m_tab_widget->tab_list (); |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2775 |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2776 for (auto fe_tab : fe_tab_lst) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2777 { |
27634
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2778 QString tab_file = fe_tab->file_name (); |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2779 |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2780 // We check file == tab_file because |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2781 // |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2782 // same_file ("", "") |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2783 // |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2784 // is false |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2785 |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2786 if (same_file (std_file, tab_file.toStdString ()) || file == tab_file) |
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2787 return fe_tab; |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2788 } |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2789 |
27634
57b9cf9d8796
simplify loop over tabs in file_editor::find_tab_widget
John W. Eaton <jwe@octave.org>
parents:
27633
diff
changeset
|
2790 return nullptr; |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2791 } |
23321
ac4d0a72927a
provide a context menu for the tab bar of the editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23304
diff
changeset
|
2792 |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2793 QAction * file_editor::add_action (QMenu *menu, const QString& text, |
24731
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2794 const char *member, |
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2795 QWidget *receiver) |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2796 { |
24731
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2797 return add_action (menu, QIcon (), text, member, receiver); |
24717
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2798 } |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2799 |
63b5ac6a5ee7
* file-editor.cc: More style fixes.
John W. Eaton <jwe@octave.org>
parents:
24716
diff
changeset
|
2800 QAction * file_editor::add_action (QMenu *menu, const QIcon& icon, |
24731
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2801 const QString& text, const char *member, |
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2802 QWidget *receiver) |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2803 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2804 QAction *a; |
24731
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2805 QWidget *r = this; |
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2806 |
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2807 if (receiver != nullptr) |
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2808 r = receiver; |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2809 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2810 if (menu) |
24731
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2811 a = menu->addAction (icon, text, r, member); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2812 else |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2813 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2814 a = new QAction (this); |
24731
a01472d4a170
use tab navigation from tab_bar in file editor
Torsten <mttl@mailbox.org>
parents:
24730
diff
changeset
|
2815 connect (a, SIGNAL (triggered ()), r, member); |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2816 } |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2817 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2818 addAction (a); // important for shortcut context |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2819 a->setShortcutContext (Qt::WidgetWithChildrenShortcut); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2820 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2821 return a; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2822 } |
23276
ea143f4f76a5
Allow to close an editor tab with the middle mouse button (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23223
diff
changeset
|
2823 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2824 QMenu* file_editor::add_menu (QMenuBar *p, QString name) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2825 { |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2826 QMenu *menu = p->addMenu (name); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2827 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2828 QString base_name = name; // get a copy |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2829 // replace intended '&' ("&&") by a temp. string |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2830 base_name.replace ("&&", "___octave_amp_replacement___"); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2831 // remove single '&' (shortcut) |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2832 base_name.remove ("&"); |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2833 // restore intended '&' |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2834 base_name.replace ("___octave_amp_replacement___", "&&"); |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2835 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2836 // remember names with and without shortcut |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2837 m_hash_menu_text[menu] = QStringList () << name << base_name; |
24020
387be1a6c3dc
style fixes for GUI editor
John W. Eaton <jwe@octave.org>
parents:
23920
diff
changeset
|
2838 |
24716
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2839 return menu; |
2b3e0b570e77
move GUI file editor classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24715
diff
changeset
|
2840 } |
23304
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2841 } |
fb495c47e82d
allow double left click for closing tabs in the file editor (bug #44605)
Torsten <mttl@mailbox.org>
parents:
23300
diff
changeset
|
2842 |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15861
diff
changeset
|
2843 #endif |