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