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