annotate libgui/src/m-editor/file-editor.cc @ 18609:ebd063b7b1c6 gui-release

maint: Periodic merge of stable to gui-release.
author John W. Eaton <jwe@octave.org>
date Thu, 20 Mar 2014 12:28:53 -0400
parents 26d15a57f45b bfb735b70978
children 086093fbdc1a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
1 /*
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
2
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17740
diff changeset
3 Copyright (C) 2011-2013 Jacob Dawid
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
4
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
5 This file is part of Octave.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
6
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
8 under the terms of the GNU General Public License as published by the
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
10 option) any later version.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
11
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
15 for more details.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
16
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
17 You should have received a copy of the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
18 along with Octave; see the file COPYING. If not, see
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
19 <http://www.gnu.org/licenses/>.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
20
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
21 */
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
22
15286
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15204
diff changeset
23 #ifdef HAVE_CONFIG_H
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15204
diff changeset
24 #include <config.h>
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15204
diff changeset
25 #endif
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15204
diff changeset
26
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15861
diff changeset
27 #ifdef HAVE_QSCINTILLA
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15861
diff changeset
28
14707
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
29 #include "file-editor.h"
15356
842ab161c10a GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents: 15321
diff changeset
30 #include "resource-manager.h"
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
31 #include <QVBoxLayout>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
32 #include <QApplication>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
33 #include <QFile>
13584
e76a22bfe406 editor: added bookmark feature
ttl <ttl@justmail.de>
parents: 13566
diff changeset
34 #include <QFont>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
35 #include <QFileDialog>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
36 #include <QMessageBox>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
37 #include <QStyle>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
38 #include <QTextStream>
18399
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
39 #include <QTabBar>
16407
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
40 #include <QProcess>
17901
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
41 #include <QInputDialog>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
42
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
43 #include "octave-link.h"
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
44 #include "utils.h"
18545
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
45 #include "main-window.h"
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
46
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
47 file_editor::file_editor (QWidget *p)
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
48 : file_editor_interface (p)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
49 {
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
50 // Set current editing directory before construct because loaded
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
51 // files will change ced accordingly.
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
52 ced = QDir::currentPath ();
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
53
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
54 construct ();
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
55
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
56 setVisible (false);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
57 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
58
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
59 file_editor::~file_editor (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
60 {
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
61 QSettings *settings = resource_manager::get_settings ();
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
62
16740
cfefcc2a4dae do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents: 16739
diff changeset
63 // Have all file editor tabs signal what their file names are.
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
64 editor_tab_map.clear ();
16740
cfefcc2a4dae do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents: 16739
diff changeset
65 emit fetab_file_name_query (0);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
66
16740
cfefcc2a4dae do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents: 16739
diff changeset
67 // save file names (even if last session will not be restored next time)
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
68 QStringList fetFileNames;
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
69 for (editor_tab_map_const_iterator p = editor_tab_map.begin ();
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
70 p != editor_tab_map.end (); p++)
16740
cfefcc2a4dae do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents: 16739
diff changeset
71 {
cfefcc2a4dae do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents: 16739
diff changeset
72 QString file_name = p->first;
cfefcc2a4dae do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents: 16739
diff changeset
73 if (!file_name.isEmpty () && file_name.at (file_name.size () - 1) != '/')
cfefcc2a4dae do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents: 16739
diff changeset
74 fetFileNames.append (p->first); // do not append unnamed files
cfefcc2a4dae do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents: 16739
diff changeset
75 }
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
76
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
77 settings->setValue ("editor/savedSessionTabs", fetFileNames);
15356
842ab161c10a GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents: 15321
diff changeset
78 settings->sync ();
15993
41471c02d51c gui: show menu with recently used editor files also in file menu of main window
Torsten <ttl@justmail.de>
parents: 15984
diff changeset
79
16638
3c2e457eeb72 ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents: 16637
diff changeset
80 for (int index = _tab_widget->count ()-1; index >= 0; index--)
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
81 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
82 // true: app closing
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
83 emit fetab_close_request (_tab_widget->widget (index), true);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
84 }
16638
3c2e457eeb72 ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents: 16637
diff changeset
85
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
86 if (_mru_file_menu)
41471c02d51c gui: show menu with recently used editor files also in file menu of main window
Torsten <ttl@justmail.de>
parents: 15984
diff changeset
87 delete _mru_file_menu;
13524
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
88 }
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
89
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
90 void
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
91 file_editor::focus (void)
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
92 {
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
93 set_focus ();
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
94 }
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
95
15980
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
96 // set focus to editor and its current tab
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
97 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
98 file_editor::set_focus (void)
15980
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
99 {
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
100 if (!isVisible ())
41471c02d51c gui: show menu with recently used editor files also in file menu of main window
Torsten <ttl@justmail.de>
parents: 15984
diff changeset
101 setVisible (true);
15980
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
102 setFocus ();
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
103 activateWindow ();
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
104 raise ();
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
105 QWidget *fileEditorTab = _tab_widget->currentWidget ();
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
106 if (fileEditorTab)
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
107 emit fetab_set_focus (fileEditorTab);
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
108 }
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
109
14795
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14788
diff changeset
110 QMenu *
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
111 file_editor::debug_menu (void)
14795
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14788
diff changeset
112 {
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14788
diff changeset
113 return _debug_menu;
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14788
diff changeset
114 }
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14788
diff changeset
115
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
116 QToolBar *
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
117 file_editor::toolbar (void)
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
118 {
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
119 return _tool_bar;
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
120 }
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
121
13524
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
122 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16413
diff changeset
123 file_editor::handle_enter_debug_mode (void)
14830
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
124 {
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
125 _run_action->setEnabled (false);
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
126 }
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
127
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
128 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16413
diff changeset
129 file_editor::handle_exit_debug_mode (void)
14830
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
130 {
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
131 _run_action->setEnabled (true);
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
132 }
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
133
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
134 void
16452
744ff2fe11ce add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents: 16443
diff changeset
135 file_editor::request_new_file (const QString& commands)
13524
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
136 {
17903
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
137 // Custom editor? If yes, we can only call the editor without passing
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
138 // some initial contents and even without being sure a new file is opened
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
139 if (call_custom_editor ())
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
140 return;
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
141
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
142 // New file isn't a file_editor_tab function since the file
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
143 // editor tab has yet to be created and there is no object to
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
144 // pass a signal to. Hence, functionality is here.
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
145
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
146 file_editor_tab *fileEditorTab = new file_editor_tab (ced);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
147 if (fileEditorTab)
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
148 {
15982
131d40cd805b gui: cleanup some string constants for translations
Torsten <ttl@justmail.de>
parents: 15980
diff changeset
149 add_file_editor_tab (fileEditorTab, ""); // new tab with empty title
16452
744ff2fe11ce add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents: 16443
diff changeset
150 fileEditorTab->new_file (commands); // title is updated here
15993
41471c02d51c gui: show menu with recently used editor files also in file menu of main window
Torsten <ttl@justmail.de>
parents: 15984
diff changeset
151 set_focus (); // focus editor and new tab
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
152 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
153 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
154
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
155 void
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
156 file_editor::request_new_script (const QString& commands)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
157 {
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
158 request_new_file (commands);
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
159 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
160
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
161 void
17901
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
162 file_editor::request_new_function (bool)
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
163 {
17901
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
164 bool ok;
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
165 // get the name of the new function
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
166 QString new_name = QInputDialog::getText (this, tr ("New Function"),
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
167 tr ("New function name:\n"), QLineEdit::Normal, "", &ok);
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
168 if (ok && new_name.length () > 0)
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
169 {
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
170 // append suffix if it not already exists
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
171 if (new_name.rightRef (2) != ".m")
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
172 new_name.append (".m");
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
173 // check whether new files are created without prompt
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
174 QSettings *settings = resource_manager::get_settings ();
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
175 if (! settings->value ("editor/create_new_file",false).toBool ())
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
176 {
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
177 // no, so enable this settings and wait for end of new file loading
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
178 settings->setValue ("editor/create_new_file",true);
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
179 connect (this, SIGNAL (file_loaded_signal ()),
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
180 this, SLOT (restore_create_file_setting ()));
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
181 }
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
182 // start the edit command
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
183 emit execute_command_in_terminal_signal ("edit " + new_name);
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
184 }
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
185 }
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
186
17901
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
187 void
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
188 file_editor::restore_create_file_setting ()
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
189 {
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
190 // restore the new files creation setting
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
191 QSettings *settings = resource_manager::get_settings ();
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
192 settings->setValue ("editor/create_new_file",false);
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
193 disconnect (this, SIGNAL (file_loaded_signal ()),
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
194 this, SLOT (restore_create_file_setting ()));
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
195 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
196
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
197 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
198 file_editor::request_open_file (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
199 {
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
200 // Open file isn't a file_editor_tab function since the file
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
201 // editor tab has yet to be created and there is no object to
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
202 // pass a signal to. Hence, functionality is here.
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
203
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
204 // Create a NonModal message.
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
205 QFileDialog *fileDialog = new QFileDialog (this);
16560
ebec000cbfc5 gui: fix editor file name filters to allow all files
Mike Miller <mtmiller@ieee.org>
parents: 16558
diff changeset
206 fileDialog->setNameFilter (tr ("Octave Files (*.m);;All Files (*)"));
16912
6bd74153c3ae no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents: 16881
diff changeset
207
6bd74153c3ae no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents: 16881
diff changeset
208 // Giving trouble under KDE (problem is related to Qt signal handling on unix,
6bd74153c3ae no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents: 16881
diff changeset
209 // see https://bugs.kde.org/show_bug.cgi?id=260719 ,
6bd74153c3ae no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents: 16881
diff changeset
210 // it had/has no effect on Windows, though)
6bd74153c3ae no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents: 16881
diff changeset
211 fileDialog->setOption(QFileDialog::DontUseNativeDialog, true);
6bd74153c3ae no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents: 16881
diff changeset
212
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
213 fileDialog->setAcceptMode (QFileDialog::AcceptOpen);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
214 fileDialog->setViewMode (QFileDialog::Detail);
18521
713193ffc8c4 allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents: 18486
diff changeset
215 fileDialog->setFileMode (QFileDialog::ExistingFiles);
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
216 fileDialog->setDirectory (ced);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
217
18521
713193ffc8c4 allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents: 18486
diff changeset
218 connect (fileDialog, SIGNAL (filesSelected (const QStringList&)),
713193ffc8c4 allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents: 18486
diff changeset
219 this, SLOT (request_open_files (const QStringList&)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
220
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
221 fileDialog->setWindowModality (Qt::NonModal);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
222 fileDialog->setAttribute (Qt::WA_DeleteOnClose);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
223 fileDialog->show ();
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
224 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
225
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
226 // Check whether this file is already open in the editor.
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
227 QWidget *
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
228 file_editor::find_tab_widget (const QString& file) const
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
229 {
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
230 QWidget *retval = 0;
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
231
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
232 for (editor_tab_map_const_iterator p = editor_tab_map.begin ();
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
233 p != editor_tab_map.end (); p++)
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
234 {
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
235 QString tab_file = p->first;
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
236
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
237 if (same_file (file.toStdString (), tab_file.toStdString ()))
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
238 {
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
239 retval = p->second;
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
240 break;
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
241 }
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
242 }
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
243
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
244 return retval;
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
245 }
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
246
17903
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
247 bool
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
248 file_editor::call_custom_editor (const QString& file_name, int line)
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
249 {
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
250 // Check if the user wants to use a custom file editor.
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
251 QSettings *settings = resource_manager::get_settings ();
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
252
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
253 if (settings->value ("useCustomFileEditor").toBool ())
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
254 {
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
255 QString editor = settings->value ("customFileEditor").toString ();
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
256 editor.replace ("%f", file_name);
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
257 editor.replace ("%l", QString::number (line));
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
258
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
259 QProcess::startDetached (editor);
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
260
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
261 if (line < 0 && ! file_name.isEmpty ())
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
262 handle_mru_add_file (QFileInfo (file_name).canonicalFilePath ());
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
263
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
264 return true;
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
265 }
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
266
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
267 return false;
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
268 }
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
269
18545
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
270 bool
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
271 file_editor::is_editor_console_tabbed ()
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
272 {
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
273 main_window *w = static_cast<main_window *>(main_win ());
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
274 QList<QDockWidget *> w_list = w->tabifiedDockWidgets (this);
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
275 QDockWidget *console =
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
276 static_cast<QDockWidget *> (w->get_dock_widget_list ().at (0));
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
277
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
278 for (int i = 0; i < w_list.count (); i++)
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
279 {
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
280 if (w_list.at (i) == console)
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
281 return true;
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
282 }
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
283
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
284 return false;
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
285 }
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
286
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
287 void
18521
713193ffc8c4 allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents: 18486
diff changeset
288 file_editor::request_open_files (const QStringList& open_file_names)
713193ffc8c4 allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents: 18486
diff changeset
289 {
713193ffc8c4 allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents: 18486
diff changeset
290 for (int i = 0; i < open_file_names.count (); i++)
713193ffc8c4 allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents: 18486
diff changeset
291 request_open_file (open_file_names.at (i));
713193ffc8c4 allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents: 18486
diff changeset
292 }
713193ffc8c4 allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents: 18486
diff changeset
293
713193ffc8c4 allow to select mutliple files in the editors open file dialog (bug #41664)
Torsten <ttl@justmail.de>
parents: 18486
diff changeset
294 void
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
295 file_editor::request_open_file (const QString& openFileName, int line,
16386
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
296 bool debug_pointer,
16443
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16440
diff changeset
297 bool breakpoint_marker, bool insert)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
298 {
17903
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
299 if (call_custom_editor (openFileName, line))
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
300 return; // custom editor called
16407
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
301
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
302 if (openFileName.isEmpty ())
14690
ca733a66be7a Fixed bug with not opening the editor when clicking a file from the file browser. Implemented watching the file on disk.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14681
diff changeset
303 {
17941
9799a996b2c1 * file-editor.cc (request_open_file): new edit tab when file name is empty
Torsten <ttl@justmail.de>
parents: 17935
diff changeset
304 // This happens if edit is calles without an argument
9799a996b2c1 * file-editor.cc (request_open_file): new edit tab when file name is empty
Torsten <ttl@justmail.de>
parents: 17935
diff changeset
305 // Open eitor with empty edit area instead (as new file would do)
9799a996b2c1 * file-editor.cc (request_open_file): new edit tab when file name is empty
Torsten <ttl@justmail.de>
parents: 17935
diff changeset
306 request_new_file ("");
14690
ca733a66be7a Fixed bug with not opening the editor when clicking a file from the file browser. Implemented watching the file on disk.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14681
diff changeset
307 }
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
308 else
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
309 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
310 // Have all file editor tabs signal what their file names are.
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
311 editor_tab_map.clear ();
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
312 emit fetab_file_name_query (0);
14690
ca733a66be7a Fixed bug with not opening the editor when clicking a file from the file browser. Implemented watching the file on disk.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14681
diff changeset
313
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
314 // Check whether this file is already open in the editor.
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
315 QWidget *tab = find_tab_widget (openFileName);
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
316
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
317 if (tab)
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
318 {
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
319 _tab_widget->setCurrentWidget (tab);
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
320
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
321 if (line > 0)
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
322 {
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
323 emit fetab_goto_line (tab, line);
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
324
16386
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
325 if (debug_pointer)
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
326 emit fetab_insert_debugger_pointer (tab, line);
16386
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
327
16443
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16440
diff changeset
328 if (breakpoint_marker)
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
329 emit fetab_do_breakpoint_marker (insert, tab, line);
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
330 }
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
331
18545
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
332 if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ()))
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
333 {
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
334 emit fetab_set_focus (tab);
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
335 set_focus ();
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
336 }
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
337 }
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
338 else
15356
842ab161c10a GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents: 15321
diff changeset
339 {
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
340 file_editor_tab *fileEditorTab = new file_editor_tab ();
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
341 if (fileEditorTab)
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
342 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
343 QString result = fileEditorTab->load_file (openFileName);
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
344 if (result == "")
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
345 {
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
346 // Supply empty title then have the file_editor_tab update
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
347 // with full or short name.
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
348 add_file_editor_tab (fileEditorTab, "");
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
349 fileEditorTab->update_window_title (false);
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
350 // file already loaded, add file to mru list here
17706
97ed9dd479ab make sure all entries in the editor's mru-menu have an absolute path
Torsten <ttl@justmail.de>
parents: 17676
diff changeset
351 QFileInfo file_info = QFileInfo (openFileName);
97ed9dd479ab make sure all entries in the editor's mru-menu have an absolute path
Torsten <ttl@justmail.de>
parents: 17676
diff changeset
352 handle_mru_add_file (file_info.canonicalFilePath ());
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
353
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
354 if (line > 0)
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
355 {
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
356 emit fetab_goto_line (fileEditorTab, line);
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
357
16386
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
358 if (debug_pointer)
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
359 emit fetab_insert_debugger_pointer (fileEditorTab,
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
360 line);
16443
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16440
diff changeset
361 if (breakpoint_marker)
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
362 emit fetab_do_breakpoint_marker (insert, fileEditorTab,
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
363 line);
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
364 }
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
365 }
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
366 else
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
367 {
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
368 delete fileEditorTab;
17736
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
369
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
370 if (QFile::exists (openFileName))
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
371 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
372 // File not readable:
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
373 // create a NonModal message about error.
17736
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
374 QMessageBox *msgBox
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
375 = new QMessageBox (QMessageBox::Critical,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
376 tr ("Octave Editor"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
377 tr ("Could not open file\n%1\nfor read: %2.").
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
378 arg (openFileName).arg (result),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
379 QMessageBox::Ok, this);
17736
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
380
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
381 msgBox->setWindowModality (Qt::NonModal);
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
382 msgBox->setAttribute (Qt::WA_DeleteOnClose);
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
383 msgBox->show ();
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
384 }
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
385 else
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
386 {
17740
e6ed77b75aec new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents: 17736
diff changeset
387 // File does not exist, should it be crated?
e6ed77b75aec new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents: 17736
diff changeset
388 QMessageBox *msgBox;
e6ed77b75aec new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents: 17736
diff changeset
389 int answer;
17903
de8591a19bc6 check for custom editor when opening a new file from the gui (bug #40496)
Torsten <ttl@justmail.de>
parents: 17901
diff changeset
390 QSettings *settings = resource_manager::get_settings ();
17901
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
391 if (settings->value ("editor/create_new_file", false).toBool ())
17740
e6ed77b75aec new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents: 17736
diff changeset
392 {
e6ed77b75aec new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents: 17736
diff changeset
393 answer = QMessageBox::Yes;
e6ed77b75aec new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents: 17736
diff changeset
394 }
e6ed77b75aec new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents: 17736
diff changeset
395 else
e6ed77b75aec new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents: 17736
diff changeset
396 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
397 msgBox = new QMessageBox (QMessageBox::Question,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
398 tr ("Octave Editor"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
399 tr ("File\n%1\ndoes not exist. "
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
400 "Do you want to create it?").arg (openFileName),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
401 QMessageBox::Yes
18472
83cc56cc7cb7 fix restoring non-existing file from previous session (bug #41280)
Torsten <ttl@justmail.de>
parents: 18261
diff changeset
402 | QMessageBox::No, 0);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
403
17740
e6ed77b75aec new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents: 17736
diff changeset
404 msgBox->setAttribute (Qt::WA_DeleteOnClose);
e6ed77b75aec new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents: 17736
diff changeset
405 answer = msgBox->exec ();
e6ed77b75aec new preference in settings: editor creates nonexisting files wihtout prompt
Torsten <ttl@justmail.de>
parents: 17736
diff changeset
406 }
17736
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
407
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
408 if (answer == QMessageBox::Yes)
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
409 {
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
410 // create the file and call the editor again
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
411 QFile file (openFileName);
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
412 if (!file.open (QIODevice::WriteOnly))
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
413 {
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
414 // error opening the file
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
415 msgBox = new QMessageBox (QMessageBox::Critical,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
416 tr ("Octave Editor"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
417 tr ("Could not open file\n%1\nfor write: %2.").
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
418 arg (openFileName).arg (file.errorString ()),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
419 QMessageBox::Ok, this);
17736
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
420
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
421 msgBox->setWindowModality (Qt::NonModal);
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
422 msgBox->setAttribute (Qt::WA_DeleteOnClose);
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
423 msgBox->show ();
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
424 }
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
425 else
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
426 {
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
427 file.close ();
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
428 request_open_file (openFileName);
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
429 }
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
430 }
6a2e483125dd editor asks if a new file should be created when called from edit (bug #40351)
Torsten <ttl@justmail.de>
parents: 17706
diff changeset
431 }
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
432 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
433 }
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
434
18545
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
435 if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ()))
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
436 {
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
437 // really show editor and the current editor tab
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
438 set_focus ();
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
439 emit file_loaded_signal ();
17baa684892c fix flashing while debuggung and editor is tabbed behind console (bug #41757)
Torsten <ttl@justmail.de>
parents: 18472
diff changeset
440 }
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
441 }
13524
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
442 }
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
443 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
444
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
445 // open a file from the mru list
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
446 void
16614
49653ed9561b Use menu triggered signal instead of action triggered signal to rid cast.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16611
diff changeset
447 file_editor::request_mru_open_file (QAction *action)
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
448 {
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
449 if (action)
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
450 {
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
451 request_open_file (action->data ().toString ());
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
452 }
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
453 }
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
454
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
455
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
456 void
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
457 file_editor::check_conflict_save (const QString& saveFileName,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
458 bool remove_on_success)
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
459 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
460 // Have all file editor tabs signal what their file names are.
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
461 editor_tab_map.clear ();
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
462 emit fetab_file_name_query (0);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
463
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
464 // Check whether this file is already open in the editor.
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
465 QWidget *tab = find_tab_widget (saveFileName);
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
466
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
467 if (tab)
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
468 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
469 // Note: to overwrite the contents of some other file editor tab
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
470 // with the same name requires identifying which file editor tab
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
471 // that is (not too difficult) then close that tab. Of course,
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
472 // that could trigger another dialog box if the file editor tab
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
473 // with the same name has modifications in it. This could become
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
474 // somewhat confusing to the user. For now, opt to do nothing.
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
475
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
476 // Create a NonModal message about error.
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
477 QMessageBox *msgBox
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
478 = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
479 tr ("File not saved! A file with the selected name\n%1\n"
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
480 "is already open in the editor").
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
481 arg (saveFileName),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
482 QMessageBox::Ok, 0);
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
483
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
484 msgBox->setWindowModality (Qt::NonModal);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
485 msgBox->setAttribute (Qt::WA_DeleteOnClose);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
486 msgBox->show ();
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
487
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
488 return;
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
489 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
490
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
491 QObject *saveFileObject = sender ();
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
492 QWidget *saveFileWidget = 0;
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
493
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
494 for (int i = 0; i < _tab_widget->count (); i++)
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
495 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
496 if (_tab_widget->widget (i) == saveFileObject)
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
497 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
498 saveFileWidget = _tab_widget->widget (i);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
499 break;
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
500 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
501 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
502 if (!saveFileWidget)
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
503 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
504 // Create a NonModal message about error.
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
505 QMessageBox *msgBox
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
506 = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
507 tr ("The associated file editor tab has disappeared."),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
508 QMessageBox::Ok, 0);
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
509
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
510 msgBox->setWindowModality (Qt::NonModal);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
511 msgBox->setAttribute (Qt::WA_DeleteOnClose);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
512 msgBox->show ();
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
513
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
514 return;
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
515 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
516
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
517 // Can save without conflict, have the file editor tab do so.
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
518 emit fetab_save_file (saveFileWidget, saveFileName, remove_on_success);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
519 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
520
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
521 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
522 file_editor::handle_insert_debugger_pointer_request (const QString& file,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
523 int line)
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
524 {
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
525 request_open_file (file, line, true);
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
526 }
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
527
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
528 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
529 file_editor::handle_delete_debugger_pointer_request (const QString& file,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
530 int line)
16395
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
531 {
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
532 if (! file.isEmpty ())
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
533 {
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
534 // Have all file editor tabs signal what their file names are.
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
535 editor_tab_map.clear ();
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
536 emit fetab_file_name_query (0);
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
537
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
538 // Check whether this file is already open in the editor.
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
539 QWidget *tab = find_tab_widget (file);
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
540
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
541 if (tab)
16395
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
542 {
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
543 _tab_widget->setCurrentWidget (tab);
16395
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
544
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
545 if (line > 0)
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
546 emit fetab_delete_debugger_pointer (tab, line);
16395
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
547
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
548 emit fetab_set_focus (tab);
16395
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
549 }
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
550 }
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
551 }
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
552
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
553 void
16443
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16440
diff changeset
554 file_editor::handle_update_breakpoint_marker_request (bool insert,
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
555 const QString& file,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
556 int line)
16386
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
557 {
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
558 request_open_file (file, line, false, true, insert);
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
559 }
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
560
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
561 void
16399
f9a737fd8829 allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
562 file_editor::handle_edit_file_request (const QString& file)
f9a737fd8829 allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
563 {
f9a737fd8829 allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
564 request_open_file (file);
f9a737fd8829 allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
565 }
f9a737fd8829 allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
566
f9a737fd8829 allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
567 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
568 file_editor::request_undo (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
569 {
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
570 emit fetab_undo (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
571 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
572
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
573 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
574 file_editor::request_redo (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
575 {
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
576 emit fetab_redo (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
577 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
578
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
579 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
580 file_editor::request_copy (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
581 {
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
582 emit fetab_copy (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
583 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
584
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
585 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
586 file_editor::request_cut (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
587 {
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
588 emit fetab_cut (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
589 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
590
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
591 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
592 file_editor::request_paste (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
593 {
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
594 emit fetab_paste (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
595 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
596
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
597 void
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
598 file_editor::request_selectall (void)
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
599 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
600 emit fetab_selectall (_tab_widget->currentWidget ());
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
601 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
602
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
603
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
604 void
17627
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
605 file_editor::request_context_help (bool)
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
606 {
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
607 emit fetab_context_help (_tab_widget->currentWidget (), false);
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
608 }
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
609 void
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
610 file_editor::request_context_doc (bool)
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
611 {
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
612 emit fetab_context_help (_tab_widget->currentWidget (), true);
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
613 }
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
614
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
615 void
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
616 file_editor::request_context_edit (bool)
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
617 {
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
618 emit fetab_context_edit (_tab_widget->currentWidget ());
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
619 }
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
620
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
621 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
622 file_editor::request_save_file (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
623 {
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
624 emit fetab_save_file (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
625 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
626
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
627 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
628 file_editor::request_save_file_as (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
629 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
630 emit fetab_save_file_as (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
631 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
632
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
633 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
634 file_editor::request_print_file (void)
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
635 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
636 emit fetab_print_file (_tab_widget->currentWidget ());
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
637 }
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
638
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
639
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
640 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
641 file_editor::request_run_file (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
642 {
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
643 emit fetab_run_file (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
644 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
645
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
646 void
17635
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
647 file_editor::request_context_run (bool)
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
648 {
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
649 emit fetab_context_run (_tab_widget->currentWidget ());
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
650 }
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
651
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
652 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
653 file_editor::request_toggle_bookmark (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
654 {
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
655 emit fetab_toggle_bookmark (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
656 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
657
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
658 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
659 file_editor::request_next_bookmark (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
660 {
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
661 emit fetab_next_bookmark (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
662 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
663
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
664 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
665 file_editor::request_previous_bookmark (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
666 {
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
667 emit fetab_previous_bookmark (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
668 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
669
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
670 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
671 file_editor::request_remove_bookmark (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
672 {
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
673 emit fetab_remove_bookmark (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
674 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
675
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
676 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
677 file_editor::request_toggle_breakpoint (void)
14825
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
678 {
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
679 emit fetab_toggle_breakpoint (_tab_widget->currentWidget ());
14825
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
680 }
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
681
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
682 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
683 file_editor::request_next_breakpoint (void)
14825
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
684 {
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
685 emit fetab_next_breakpoint (_tab_widget->currentWidget ());
14825
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
686 }
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
687
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
688 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
689 file_editor::request_previous_breakpoint (void)
14825
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
690 {
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
691 emit fetab_previous_breakpoint (_tab_widget->currentWidget ());
14825
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
692 }
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
693
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
694 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
695 file_editor::request_remove_breakpoint (void)
14825
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
696 {
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
697 emit fetab_remove_all_breakpoints (_tab_widget->currentWidget ());
14825
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
698 }
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
699
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
700 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
701 file_editor::request_comment_selected_text (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
702 {
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
703 emit fetab_comment_selected_text (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
704 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
705
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
706 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
707 file_editor::request_uncomment_selected_text (void)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
708 {
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
709 emit fetab_uncomment_selected_text (_tab_widget->currentWidget ());
15080
4c4f2fb07a50 Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15045
diff changeset
710 }
4c4f2fb07a50 Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15045
diff changeset
711
4c4f2fb07a50 Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15045
diff changeset
712 void
18303
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
713 file_editor::request_indent_selected_text (void)
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
714 {
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
715 emit fetab_indent_selected_text (_tab_widget->currentWidget ());
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
716 }
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
717
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
718 void
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
719 file_editor::request_unindent_selected_text (void)
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
720 {
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
721 emit fetab_unindent_selected_text (_tab_widget->currentWidget ());
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
722 }
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
723
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
724
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
725 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
726 file_editor::request_find (void)
15080
4c4f2fb07a50 Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15045
diff changeset
727 {
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
728 emit fetab_find (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
729 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
730
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
731 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
732 file_editor::request_goto_line (void)
16375
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
733 {
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
734 emit fetab_goto_line (_tab_widget->currentWidget ());
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
735 }
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
736
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
737
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
738 void
18482
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
739 file_editor::request_completion (void)
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
740 {
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
741 emit fetab_completion (_tab_widget->currentWidget ());
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
742 }
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
743
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
744 void
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
745 file_editor::handle_mru_add_file (const QString& file_name)
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
746 {
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
747 _mru_files.removeAll (file_name);
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
748 _mru_files.prepend (file_name);
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
749 mru_menu_update ();
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
750 }
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
751
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
752 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
753 file_editor::mru_menu_update (void)
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
754 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
755 int num_files = qMin (_mru_files.size (), int (MaxMRUFiles));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
756
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
757 // configure and show active actions of mru-menu
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
758 for (int i = 0; i < num_files; ++i)
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
759 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
760 QString text = tr ("&%1 %2").
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
761 arg ((i+1) % int (MaxMRUFiles)).arg (_mru_files.at (i));
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
762 _mru_file_actions[i]->setText (text);
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
763 _mru_file_actions[i]->setData (_mru_files.at (i));
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
764 _mru_file_actions[i]->setVisible (true);
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
765 }
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
766
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
767 // hide unused mru-menu entries
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
768 for (int j = num_files; j < MaxMRUFiles; ++j)
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
769 _mru_file_actions[j]->setVisible (false);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
770
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
771 // delete entries in string-list beyond MaxMRUFiles
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
772 while (_mru_files.size () > MaxMRUFiles)
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
773 _mru_files.removeLast ();
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
774
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
775 // save actual mru-list in settings
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
776 QSettings *settings = resource_manager::get_settings ();
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
777
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
778 // FIXME: what should happen if settings is 0?
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
779 settings->setValue ("editor/mru_file_list", _mru_files);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
780 settings->sync ();
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
781 }
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
782
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
783 void
16307
f299079ed03a avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents: 16176
diff changeset
784 file_editor::handle_file_name_changed (const QString& fname,
f299079ed03a avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents: 16176
diff changeset
785 const QString& tip)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
786 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
787 QObject *fileEditorTab = sender ();
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
788 if (fileEditorTab)
13524
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
789 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
790 for (int i = 0; i < _tab_widget->count (); i++)
14602
c8453a013000 Cleaned up code. Fixed bug that causes the GUI to freeze when launching another editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14599
diff changeset
791 {
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
792 if (_tab_widget->widget (i) == fileEditorTab)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
793 {
16307
f299079ed03a avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents: 16176
diff changeset
794 _tab_widget->setTabText (i, fname);
f299079ed03a avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents: 16176
diff changeset
795 _tab_widget->setTabToolTip (i, tip);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
796 }
14602
c8453a013000 Cleaned up code. Fixed bug that causes the GUI to freeze when launching another editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14599
diff changeset
797 }
13524
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
798 }
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
799 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
800
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
801 void
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
802 file_editor::request_close_file (bool)
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
803 {
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
804 emit fetab_close_request (_tab_widget->currentWidget ());
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
805 }
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
806
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
807 void
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
808 file_editor::request_close_all_files (bool)
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
809 {
16637
b3f4bdd7e5f4 fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents: 16635
diff changeset
810 // loop over all tabs starting from last one otherwise deletion changes index
b3f4bdd7e5f4 fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents: 16635
diff changeset
811 for (int index = _tab_widget->count ()-1; index >= 0; index--)
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
812 emit fetab_close_request (_tab_widget->widget (index));
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
813 }
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
814
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
815 void
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
816 file_editor::request_close_other_files (bool)
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
817 {
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
818 QWidget *tabID = _tab_widget->currentWidget ();
16637
b3f4bdd7e5f4 fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents: 16635
diff changeset
819 // loop over all tabs starting from last one otherwise deletion changes index
b3f4bdd7e5f4 fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents: 16635
diff changeset
820 for (int index = _tab_widget->count ()-1; index >= 0; index--)
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
821 {
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
822 if (tabID != _tab_widget->widget (index))
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
823 emit fetab_close_request (_tab_widget->widget (index));
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
824 }
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
825 }
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
826
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
827
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
828 void
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
829 file_editor::handle_tab_close_request (int index)
13529
8e87f3ba3beb gui-editor: enabled 'Save File As'
ttl <ttl@justmail.de>
parents: 13524
diff changeset
830 {
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
831 // Signal to the tabs a request to close whomever matches the identifying
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
832 // tag (i.e., unique widget pointer). The reason for this indirection is
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
833 // that it will enable a file editor widget to toss up a non-static
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
834 // dialog box and later signal that it wants to be removed.
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
835 QWidget *tabID = _tab_widget->widget (index);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
836 emit fetab_close_request (tabID);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
837 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
838
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
839 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
840 file_editor::handle_tab_remove_request (void)
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
841 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
842 QObject *fileEditorTab = sender ();
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
843 if (fileEditorTab)
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
844 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
845 for (int i = 0; i < _tab_widget->count (); i++)
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
846 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
847 if (_tab_widget->widget (i) == fileEditorTab)
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
848 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
849 _tab_widget->removeTab (i);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
850 delete fileEditorTab;
17914
46da2c323ad6 Remove unnecessary loop in file_editor::handle_tab_remove_request.
PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
parents: 17903
diff changeset
851 break;
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
852 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
853 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
854 }
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
855 check_actions ();
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
856 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
857
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
858 void
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
859 file_editor::handle_add_filename_to_list (const QString& fileName, QWidget *ID)
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
860 {
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
861 // Should we allow multiple tabs for a single file?
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
862
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
863 editor_tab_map[fileName] = ID;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
864 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
865
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
866 void
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
867 file_editor::active_tab_changed (int index)
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
868 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
869 emit fetab_change_request (_tab_widget->widget (index));
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
870 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
871
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
872 void
18573
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
873 file_editor::zoom_in (bool)
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
874 {
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
875 emit fetab_zoom_in (_tab_widget->currentWidget ());
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
876 }
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
877
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
878 void
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
879 file_editor::zoom_out (bool)
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
880 {
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
881 emit fetab_zoom_out (_tab_widget->currentWidget ());
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
882 }
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
883
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
884 void
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
885 file_editor::zoom_normal (bool)
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
886 {
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
887 emit fetab_zoom_normal (_tab_widget->currentWidget ());
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
888 }
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
889
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
890 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
891 file_editor::handle_editor_state_changed (bool copy_available,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
892 const QString& file_name)
14690
ca733a66be7a Fixed bug with not opening the editor when clicking a file from the file browser. Implemented watching the file on disk.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14681
diff changeset
893 {
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
894 // In case there is some scenario where traffic could be coming from
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
895 // all the file editor tabs, just process info from the current active tab.
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
896 if (sender () == _tab_widget->currentWidget ())
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
897 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
898 _copy_action->setEnabled (copy_available);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
899 _cut_action->setEnabled (copy_available);
17636
230ffaf80ac9 fix enabling copy, cut and run selection actions depending on selected text
Torsten <ttl@justmail.de>
parents: 17635
diff changeset
900 _context_run_action->setEnabled (copy_available);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
901
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
902 if (!file_name.isEmpty ())
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
903 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
904 ced = QDir::cleanPath (file_name);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
905 int lastslash = ced.lastIndexOf ('/');
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
906
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
907 // Test against > 0 because if somehow the directory is "/" the
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
908 // slash should be retained. Otherwise, last slash is removed.
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
909 if (lastslash > 0 && lastslash != ced.count ())
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
910 ced = ced.left (lastslash);
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
911 }
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
912
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
913 setFocusProxy (_tab_widget->currentWidget ());
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
914 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
915 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
916
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
917 void
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16407
diff changeset
918 file_editor::notice_settings (const QSettings *settings)
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
919 {
17988
d62570cfbab9 reduce default icon size to 16 pixel for larger working areas in the widgets
Torsten <ttl@justmail.de>
parents: 17941
diff changeset
920 int icon_size = settings->value ("toolbar_icon_size", 16).toInt ();
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
921 _tool_bar->setIconSize (QSize (icon_size, icon_size));
18281
4dadae02bd4c max. width of editor tabs limited and configurable
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
922
18343
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
923 int tab_width_min = settings->value ("editor/notebook_tab_width_min", 160)
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
924 .toInt ();
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
925 int tab_width_max = settings->value ("editor/notebook_tab_width_max", 300)
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
926 .toInt ();
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
927
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
928 QString style_sheet;
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
929 if (settings->value ("editor/longWindowTitle", false).toBool ())
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
930 {
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
931 style_sheet = QString ("QTabBar::tab {max-height: 4ex; "
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
932 "min-width: %1px; max-width: %2px;}")
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
933 .arg (tab_width_min).arg (tab_width_max);
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
934 _tab_widget->setElideMode (Qt::ElideLeft);
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
935 }
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
936 else
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
937 {
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
938 style_sheet = QString ("QTabBar::tab {max-height: 4ex;}");
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
939 _tab_widget->setElideMode (Qt::ElideNone);
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
940 }
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
941
3df71e1d3b24 improve width of editor tabs when showing complete file path
Torsten <ttl@justmail.de>
parents: 18303
diff changeset
942 _tab_widget->setUsesScrollButtons (true);
18281
4dadae02bd4c max. width of editor tabs limited and configurable
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
943 _tab_widget->setStyleSheet (style_sheet);
4dadae02bd4c max. width of editor tabs limited and configurable
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
944
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
945 // Relay signal to file editor tabs.
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16407
diff changeset
946 emit fetab_settings_changed (settings);
14690
ca733a66be7a Fixed bug with not opening the editor when clicking a file from the file browser. Implemented watching the file on disk.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14681
diff changeset
947 }
ca733a66be7a Fixed bug with not opening the editor when clicking a file from the file browser. Implemented watching the file on disk.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14681
diff changeset
948
ca733a66be7a Fixed bug with not opening the editor when clicking a file from the file browser. Implemented watching the file on disk.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14681
diff changeset
949 void
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
950 file_editor::request_preferences (bool)
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
951 {
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
952 emit request_settings_dialog ("editor");
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
953 }
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
954
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
955 void
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
956 file_editor::request_styles_preferences (bool)
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
957 {
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
958 emit request_settings_dialog ("editor_styles");
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
959 }
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
960
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
961 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
962 file_editor::construct (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
963 {
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
964 QWidget *editor_widget = new QWidget (this);
15894
9cd14e53e906 eliminate some compiler warnings for GUI code
John W. Eaton <jwe@octave.org>
parents: 15873
diff changeset
965
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
966 // FIXME: what was the intended purpose of this unused variable?
15894
9cd14e53e906 eliminate some compiler warnings for GUI code
John W. Eaton <jwe@octave.org>
parents: 15873
diff changeset
967 // QStyle *editor_style = QApplication::style ();
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
968 _menu_bar = new QMenuBar (editor_widget);
18567
bfb735b70978 Force non-native menu bar for the editor on mac (bug #41823)
pantxo <pantxo.diribarne@gmail.com>
parents: 18545
diff changeset
969 #if defined (Q_OS_MAC)
bfb735b70978 Force non-native menu bar for the editor on mac (bug #41823)
pantxo <pantxo.diribarne@gmail.com>
parents: 18545
diff changeset
970 _menu_bar->setNativeMenuBar (false);
bfb735b70978 Force non-native menu bar for the editor on mac (bug #41823)
pantxo <pantxo.diribarne@gmail.com>
parents: 18545
diff changeset
971 #endif
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
972 _tool_bar = new QToolBar (editor_widget);
17988
d62570cfbab9 reduce default icon size to 16 pixel for larger working areas in the widgets
Torsten <ttl@justmail.de>
parents: 17941
diff changeset
973 _tool_bar->setMovable (true);
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
974 _tab_widget = new QTabWidget (editor_widget);
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
975 _tab_widget->setTabsClosable (true);
18215
e54cfaae830b Make editor tabs draggable if feature is available
Richard Crozier richard dot crozier(at)yahoo.co.uk
parents: 17988
diff changeset
976 #ifdef HAVE_QTABWIDGET_SETMOVABLE
e54cfaae830b Make editor tabs draggable if feature is available
Richard Crozier richard dot crozier(at)yahoo.co.uk
parents: 17988
diff changeset
977 _tab_widget->setMovable (true);
e54cfaae830b Make editor tabs draggable if feature is available
Richard Crozier richard dot crozier(at)yahoo.co.uk
parents: 17988
diff changeset
978 #endif
13562
a89aa9e05e19 editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents: 13558
diff changeset
979
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
980 QAction *new_action = new QAction (QIcon (":/actions/icons/filenew.png"),
18345
dfc6ef6ac455 some text improvements in the gui (#bug 41201)
Torsten <ttl@justmail.de>
parents: 18343
diff changeset
981 tr ("&New Script"), _tool_bar);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
982
18261
09ef57c61b3b update some icnons of the gui
Torsten <ttl@justmail.de>
parents: 18257
diff changeset
983 QAction *open_action = new QAction (QIcon (":/actions/icons/folder_documents.png"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
984 tr ("&Open File..."), _tool_bar);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
985
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
986 _save_action = new QAction (QIcon (":/actions/icons/filesave.png"),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
987 tr ("&Save File"), _tool_bar);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
988
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
989 _save_as_action = new QAction (QIcon (":/actions/icons/filesaveas.png"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
990 tr ("Save File &As..."), _tool_bar);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
991
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
992 _print_action = new QAction ( QIcon (":/actions/icons/fileprint.png"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
993 tr ("Print..."), _tool_bar);
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
994
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
995 _undo_action = new QAction (QIcon (":/actions/icons/undo.png"),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
996 tr ("&Undo"), _tool_bar);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
997
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
998 _redo_action = new QAction (QIcon (":/actions/icons/redo.png"),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
999 tr ("&Redo"), _tool_bar);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1000
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1001 _copy_action = new QAction (QIcon (":/actions/icons/editcopy.png"),
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14874
diff changeset
1002 tr ("&Copy"), _tool_bar);
17636
230ffaf80ac9 fix enabling copy, cut and run selection actions depending on selected text
Torsten <ttl@justmail.de>
parents: 17635
diff changeset
1003 _copy_action->setEnabled (false);
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14874
diff changeset
1004
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1005 _cut_action = new QAction (QIcon (":/actions/icons/editcut.png"),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1006 tr ("Cu&t"), _tool_bar);
17636
230ffaf80ac9 fix enabling copy, cut and run selection actions depending on selected text
Torsten <ttl@justmail.de>
parents: 17635
diff changeset
1007 _cut_action->setEnabled (false);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1008
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1009 _paste_action
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
1010 = new QAction (QIcon (":/actions/icons/editpaste.png"),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1011 tr ("Paste"), _tool_bar);
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1012
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1013 _next_bookmark_action = new QAction (tr ("&Next Bookmark"), _tool_bar);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1014
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1015 _previous_bookmark_action = new QAction (tr ("Pre&vious Bookmark"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1016 _tool_bar);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1017
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1018 _toggle_bookmark_action = new QAction (tr ("Toggle &Bookmark"), _tool_bar);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1019
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1020 _remove_bookmark_action
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1021 = new QAction (tr ("&Remove All Bookmarks"), _tool_bar);
14825
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
1022
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
1023 QAction *next_breakpoint_action
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
1024 = new QAction (QIcon (":/actions/icons/bp_next.png"),
17935
752f6b358754 Tweak GUI strings for conformity.
Rik <rik@octave.org>
parents: 17926
diff changeset
1025 tr ("&Next Breakpoint"), _tool_bar);
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
1026 QAction *previous_breakpoint_action
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
1027 = new QAction (QIcon (":/actions/icons/bp_prev.png"),
17935
752f6b358754 Tweak GUI strings for conformity.
Rik <rik@octave.org>
parents: 17926
diff changeset
1028 tr ("Pre&vious Breakpoint"), _tool_bar);
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
1029 QAction *toggle_breakpoint_action
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
1030 = new QAction (QIcon (":/actions/icons/bp_toggle.png"),
17935
752f6b358754 Tweak GUI strings for conformity.
Rik <rik@octave.org>
parents: 17926
diff changeset
1031 tr ("Toggle &Breakpoint"), _tool_bar);
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
1032 QAction *remove_all_breakpoints_action
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
1033 = new QAction (QIcon (":/actions/icons/bp_rm_all.png"),
17935
752f6b358754 Tweak GUI strings for conformity.
Rik <rik@octave.org>
parents: 17926
diff changeset
1034 tr ("&Remove All Breakpoints"), _tool_bar);
14825
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
1035
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1036 _selectall_action
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1037 = new QAction (tr ("Select All"), _tool_bar);
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1038
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1039 _comment_selection_action
16737
e81084a745a9 GUI: change (un)comment handling of selection, allow (un)comment of current line
Thorsten Liebig <thorsten.liebig@gmx.de>
parents: 16731
diff changeset
1040 = new QAction (tr ("&Comment"), _tool_bar);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1041 _uncomment_selection_action
16737
e81084a745a9 GUI: change (un)comment handling of selection, allow (un)comment of current line
Thorsten Liebig <thorsten.liebig@gmx.de>
parents: 16731
diff changeset
1042 = new QAction (tr ("&Uncomment"), _tool_bar);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1043
18303
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1044 _indent_selection_action
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1045 = new QAction (tr ("&Indent"), _tool_bar);
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1046 _unindent_selection_action
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1047 = new QAction (tr ("&Unindent"), _tool_bar);
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1048
18261
09ef57c61b3b update some icnons of the gui
Torsten <ttl@justmail.de>
parents: 18257
diff changeset
1049 _find_action = new QAction (QIcon (":/actions/icons/find.png"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
1050 tr ("&Find and Replace..."), _tool_bar);
15080
4c4f2fb07a50 Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15045
diff changeset
1051
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1052 _run_action = new QAction (QIcon (":/actions/icons/artsbuilderexecute.png"),
17935
752f6b358754 Tweak GUI strings for conformity.
Rik <rik@octave.org>
parents: 17926
diff changeset
1053 tr ("Save File and Run"), _tool_bar);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1054
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
1055 _goto_line_action = new QAction (tr ("Go &to Line..."), _tool_bar);
16375
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
1056
18482
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1057 _completion_action = new QAction (tr ("&Show Completion List"), _tool_bar);
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1058
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1059 // the mru-list and an empty array of actions
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1060 QSettings *settings = resource_manager::get_settings ();
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1061 _mru_files = settings->value ("editor/mru_file_list").toStringList ();
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1062 for (int i = 0; i < MaxMRUFiles; ++i)
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1063 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1064 _mru_file_actions[i] = new QAction (this);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1065 _mru_file_actions[i]->setVisible (false);
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1066 }
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1067
13584
e76a22bfe406 editor: added bookmark feature
ttl <ttl@justmail.de>
parents: 13566
diff changeset
1068 // some actions are disabled from the beginning
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1069 _copy_action->setEnabled (false);
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1070 _cut_action->setEnabled (false);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1071
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1072 _run_action->setShortcutContext (Qt::WindowShortcut);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1073 _save_action->setShortcutContext (Qt::WindowShortcut);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1074 _save_as_action->setShortcutContext (Qt::WindowShortcut);
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
1075
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1076 _print_action->setShortcutContext (Qt::WindowShortcut);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1077
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1078 _next_bookmark_action->setShortcutContext (Qt::WindowShortcut);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1079 _previous_bookmark_action->setShortcutContext (Qt::WindowShortcut);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1080 _toggle_bookmark_action->setShortcutContext (Qt::WindowShortcut);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1081 _comment_selection_action->setShortcutContext (Qt::WindowShortcut);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1082 _uncomment_selection_action->setShortcutContext (Qt::WindowShortcut);
18303
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1083 _indent_selection_action->setShortcutContext (Qt::WindowShortcut);
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1084 _unindent_selection_action->setShortcutContext (Qt::WindowShortcut);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1085 _find_action->setShortcutContext (Qt::WindowShortcut);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1086 _goto_line_action->setShortcutContext (Qt::WindowShortcut);
18482
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1087 _completion_action->setShortcutContext (Qt::WindowShortcut);
13556
0d18b0e168ae editor: shortcuts for toolbar actions, window icon
ttl <ttl@justmail.de>
parents: 13555
diff changeset
1088
13562
a89aa9e05e19 editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents: 13558
diff changeset
1089 // toolbar
14718
3df7ef0080c7 Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14715
diff changeset
1090 _tool_bar->addAction (new_action);
3df7ef0080c7 Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14715
diff changeset
1091 _tool_bar->addAction (open_action);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1092 _tool_bar->addAction (_save_action);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1093 _tool_bar->addAction (_save_as_action);
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
1094 _tool_bar->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1095 _tool_bar->addAction (_print_action);
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
1096 _tool_bar->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1097 _tool_bar->addAction (_undo_action);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1098 _tool_bar->addAction (_redo_action);
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
1099 _tool_bar->addAction (_copy_action);
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
1100 _tool_bar->addAction (_cut_action);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1101 _tool_bar->addAction (_paste_action);
15080
4c4f2fb07a50 Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15045
diff changeset
1102 _tool_bar->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1103 _tool_bar->addAction (_find_action);
14830
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
1104 _tool_bar->addAction (_run_action);
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
1105 _tool_bar->addSeparator ();
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
1106 _tool_bar->addAction (toggle_breakpoint_action);
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
1107 _tool_bar->addAction (next_breakpoint_action);
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
1108 _tool_bar->addAction (previous_breakpoint_action);
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
1109 _tool_bar->addAction (remove_all_breakpoints_action);
13562
a89aa9e05e19 editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents: 13558
diff changeset
1110
14669
7605e7136b50 Discarded initFileEditor, instead put that in the constructor. Speedup for updating the symbol table by lowering complexity from n² to n. Fixed problem with hangup on quit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14602
diff changeset
1111 // menu bar
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
1112 QMenu *fileMenu = new QMenu (tr ("&File"), _menu_bar);
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
1113
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
1114 _mru_file_menu = new QMenu (tr ("&Recent Editor Files"), fileMenu);
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1115 for (int i = 0; i < MaxMRUFiles; ++i)
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1116 _mru_file_menu->addAction (_mru_file_actions[i]);
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1117
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
1118 fileMenu->addAction (new_action);
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
1119 fileMenu->addAction (QIcon (), tr ("New &Function..."),
17901
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
1120 this, SLOT (request_new_function (bool)));
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
1121 fileMenu->addAction (open_action);
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
1122 fileMenu->addMenu (_mru_file_menu);
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1123 fileMenu->addSeparator ();
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1124 _context_edit_action =
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1125 fileMenu->addAction (QIcon (), tr ("&Edit Function"),
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1126 this, SLOT (request_context_edit (bool)));
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
1127 fileMenu->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1128 fileMenu->addAction (_save_action);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1129 fileMenu->addAction (_save_as_action);
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
1130
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
1131 fileMenu->addSeparator ();
16981
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
1132 _close_action =
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1133 fileMenu->addAction (QIcon::fromTheme("window-close",
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1134 QIcon (":/actions/icons/fileclose.png")),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1135 tr ("&Close"), this, SLOT (request_close_file (bool)));
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1136 _close_all_action =
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1137 fileMenu->addAction (QIcon::fromTheme("window-close",
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1138 QIcon (":/actions/icons/fileclose.png")),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1139 tr ("Close All"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1140 this, SLOT (request_close_all_files (bool)));
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1141 _close_others_action =
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1142 fileMenu->addAction (QIcon::fromTheme("window-close",
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1143 QIcon (":/actions/icons/fileclose.png")),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1144 tr ("Close Other Files"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1145 this, SLOT (request_close_other_files (bool)));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1146
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
1147 fileMenu->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1148 fileMenu->addAction (_print_action);
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
1149
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
1150 _menu_bar->addMenu (fileMenu);
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
1151
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
1152
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
1153 QMenu *editMenu = new QMenu (tr ("&Edit"), _menu_bar);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1154 editMenu->addAction (_undo_action);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1155 editMenu->addAction (_redo_action);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1156 editMenu->addSeparator ();
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
1157 editMenu->addAction (_copy_action);
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
1158 editMenu->addAction (_cut_action);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1159 editMenu->addAction (_paste_action);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1160 editMenu->addSeparator ();
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1161 editMenu->addAction (_selectall_action);
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1162 editMenu->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1163 editMenu->addAction (_find_action);
15080
4c4f2fb07a50 Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15045
diff changeset
1164 editMenu->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1165 editMenu->addAction (_comment_selection_action);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1166 editMenu->addAction (_uncomment_selection_action);
18303
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1167 editMenu->addAction (_indent_selection_action);
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1168 editMenu->addAction (_unindent_selection_action);
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1169 editMenu->addSeparator ();
18482
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1170 editMenu->addAction (_completion_action);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1171 editMenu->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1172 editMenu->addAction (_toggle_bookmark_action);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1173 editMenu->addAction (_next_bookmark_action);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1174 editMenu->addAction (_previous_bookmark_action);
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1175 editMenu->addAction (_remove_bookmark_action);
16375
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
1176 editMenu->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1177 editMenu->addAction (_goto_line_action);
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
1178 editMenu->addSeparator ();
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
1179 _preferences_action =
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1180 editMenu->addAction (QIcon (":/actions/icons/configure.png"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
1181 tr ("&Preferences..."),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1182 this, SLOT (request_preferences (bool)));
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
1183 _styles_preferences_action =
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
1184 editMenu->addAction (QIcon (":/actions/icons/configure.png"),
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
1185 tr ("&Styles Preferences..."),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1186 this, SLOT (request_styles_preferences (bool)));
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
1187 _menu_bar->addMenu (editMenu);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1188
18573
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1189 QMenu *view_menu = new QMenu (tr ("&View"), _menu_bar);
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1190 _zoom_in_action = view_menu->addAction (QIcon (), tr ("Zoom &In"),
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1191 this, SLOT (zoom_in (bool)));
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1192 _zoom_out_action = view_menu->addAction (QIcon (), tr ("Zoom &Out"),
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1193 this, SLOT (zoom_out (bool)));
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1194 _zoom_normal_action = view_menu->addAction (QIcon (), tr ("&Normal Size"),
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1195 this, SLOT (zoom_normal (bool)));
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1196 _menu_bar->addMenu (view_menu);
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1197
14778
f43916137064 Added debug menu to file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
1198 _debug_menu = new QMenu (tr ("&Debug"), _menu_bar);
14825
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
1199 _debug_menu->addAction (toggle_breakpoint_action);
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
1200 _debug_menu->addAction (next_breakpoint_action);
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
1201 _debug_menu->addAction (previous_breakpoint_action);
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
1202 _debug_menu->addAction (remove_all_breakpoints_action);
14825
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
1203 _debug_menu->addSeparator ();
eae0e9f2a8c6 Added menus, markers and methods to visualize debugging in the editor and add, remove and navigate breakpoints* .
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14812
diff changeset
1204 // The other debug actions will be added by the main window.
14778
f43916137064 Added debug menu to file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
1205 _menu_bar->addMenu (_debug_menu);
f43916137064 Added debug menu to file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
1206
14830
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
1207 QMenu *_run_menu = new QMenu (tr ("&Run"), _menu_bar);
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
1208 _run_menu->addAction (_run_action);
17635
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
1209 _context_run_action =
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
1210 _run_menu->addAction (QIcon (), tr ("Run &Selection"),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1211 this, SLOT (request_context_run (bool)));
17636
230ffaf80ac9 fix enabling copy, cut and run selection actions depending on selected text
Torsten <ttl@justmail.de>
parents: 17635
diff changeset
1212 _context_run_action->setEnabled (false);
14830
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
1213 _menu_bar->addMenu (_run_menu);
13566
d22b9973120f Renamed language files to match convention.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13562
diff changeset
1214
17627
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1215 QMenu *_help_menu = new QMenu (tr ("&Help"), _menu_bar);
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1216 _context_help_action =
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1217 _help_menu->addAction (QIcon (), tr ("&Help on Keyword"),
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1218 this, SLOT (request_context_help (bool)));
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1219 _context_doc_action =
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1220 _help_menu->addAction (QIcon (), tr ("&Documentation on Keyword"),
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1221 this, SLOT (request_context_doc (bool)));
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1222 _menu_bar->addMenu (_help_menu);
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1223
16981
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
1224 // shortcuts
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
1225 set_shortcuts (true);
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
1226
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
1227 // layout
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
1228 QVBoxLayout *vbox_layout = new QVBoxLayout ();
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
1229 vbox_layout->addWidget (_menu_bar);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
1230 vbox_layout->addWidget (_tool_bar);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
1231 vbox_layout->addWidget (_tab_widget);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
1232 vbox_layout->setMargin (0);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
1233 editor_widget->setLayout (vbox_layout);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
1234 setWidget (editor_widget);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1235
16981
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
1236 // signals
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
1237 connect (this, SIGNAL (request_settings_dialog (const QString&)),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1238 main_win (),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1239 SLOT (process_settings_dialog_request (const QString&)));
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
1240
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16740
diff changeset
1241 connect (main_win (), SIGNAL (new_file_signal (const QString&)),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1242 this, SLOT (request_new_file (const QString&)));
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1243
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16740
diff changeset
1244 connect (main_win (), SIGNAL (open_file_signal (const QString&)),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1245 this, SLOT (request_open_file (const QString&)));
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1246
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1247 connect (new_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1248 this, SLOT (request_new_file ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1249
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1250 connect (open_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1251 this, SLOT (request_open_file ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1252
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1253 connect (_undo_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1254 this, SLOT (request_undo ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1255
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1256 connect (_redo_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1257 this, SLOT (request_redo ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1258
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1259 connect (_copy_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1260 this, SLOT (request_copy ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1261
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1262 connect (_cut_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1263 this, SLOT (request_cut ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1264
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1265 connect (_paste_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1266 this, SLOT (request_paste ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1267
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1268 connect (_selectall_action, SIGNAL (triggered ()),
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1269 this, SLOT (request_selectall ()));
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1270
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1271 connect (_save_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1272 this, SLOT (request_save_file ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1273
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1274 connect (_save_as_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1275 this, SLOT (request_save_file_as ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1276
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1277 connect (_print_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1278 this, SLOT (request_print_file ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1279
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1280 connect (_run_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1281 this, SLOT (request_run_file ()));
16375
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
1282
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1283 connect (_toggle_bookmark_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1284 this, SLOT (request_toggle_bookmark ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1285
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1286 connect (_next_bookmark_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1287 this, SLOT (request_next_bookmark ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1288
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1289 connect (_previous_bookmark_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1290 this, SLOT (request_previous_bookmark ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1291
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1292 connect (_remove_bookmark_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1293 this, SLOT (request_remove_bookmark ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1294
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1295 connect (toggle_breakpoint_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1296 this, SLOT (request_toggle_breakpoint ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1297
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1298 connect (next_breakpoint_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1299 this, SLOT (request_next_breakpoint ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1300
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1301 connect (previous_breakpoint_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1302 this, SLOT (request_previous_breakpoint ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1303
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1304 connect (remove_all_breakpoints_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1305 this, SLOT (request_remove_breakpoint ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1306
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1307 connect (_comment_selection_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1308 this, SLOT (request_comment_selected_text ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1309
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1310 connect (_uncomment_selection_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1311 this, SLOT (request_uncomment_selected_text ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1312
18303
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1313 connect (_indent_selection_action, SIGNAL (triggered ()),
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1314 this, SLOT (request_indent_selected_text ()));
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1315
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1316 connect (_unindent_selection_action, SIGNAL (triggered ()),
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1317 this, SLOT (request_unindent_selected_text ()));
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1318
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1319 connect (_find_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1320 this, SLOT (request_find ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1321
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1322 connect (_goto_line_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1323 this, SLOT (request_goto_line ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1324
18482
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1325 connect (_completion_action, SIGNAL (triggered ()),
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1326 this, SLOT (request_completion ()));
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1327
16614
49653ed9561b Use menu triggered signal instead of action triggered signal to rid cast.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16611
diff changeset
1328 connect (_mru_file_menu, SIGNAL (triggered (QAction *)),
49653ed9561b Use menu triggered signal instead of action triggered signal to rid cast.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16611
diff changeset
1329 this, SLOT (request_mru_open_file (QAction *)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1330
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1331 mru_menu_update ();
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1332
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1333 connect (_tab_widget, SIGNAL (tabCloseRequested (int)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1334 this, SLOT (handle_tab_close_request (int)));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1335
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1336 connect (_tab_widget, SIGNAL (currentChanged (int)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1337 this, SLOT (active_tab_changed (int)));
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1338
17901
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
1339 connect (this, SIGNAL (execute_command_in_terminal_signal (const QString&)),
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
1340 main_win (), SLOT (execute_command_in_terminal (const QString&)));
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17790
diff changeset
1341
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1342 resize (500, 400);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1343 setWindowIcon (QIcon (":/actions/icons/logo.png"));
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16740
diff changeset
1344 set_title ("Editor");
15356
842ab161c10a GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents: 15321
diff changeset
1345
842ab161c10a GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents: 15321
diff changeset
1346 //restore previous session
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1347 if (settings->value ("editor/restoreSession", true).toBool ())
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
1348 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1349 QStringList sessionFileNames
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1350 = settings->value ("editor/savedSessionTabs",
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1351 QStringList ()).toStringList ();
15356
842ab161c10a GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents: 15321
diff changeset
1352
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1353 for (int n = 0; n < sessionFileNames.count (); ++n)
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1354 request_open_file (sessionFileNames.at (n));
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
1355 }
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1356
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1357 check_actions ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1358 }
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1359
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1360 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1361 file_editor::add_file_editor_tab (file_editor_tab *f, const QString& fn)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1362 {
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
1363 _tab_widget->addTab (f, fn);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1364
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1365 // Signals from the file editor_tab
15984
1eb3c67139f6 Add full-length-name tool tip to editor file tab when name is not full length.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15982
diff changeset
1366 connect (f, SIGNAL (file_name_changed (const QString&, const QString&)),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1367 this, SLOT (handle_file_name_changed (const QString&,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1368 const QString&)));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1369
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
1370 connect (f, SIGNAL (editor_state_changed (bool, const QString&)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1371 this, SLOT (handle_editor_state_changed (bool, const QString&)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1372
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
1373 connect (f, SIGNAL (tab_remove_request ()),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1374 this, SLOT (handle_tab_remove_request ()));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1375
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1376 connect (f, SIGNAL (add_filename_to_list (const QString&, QWidget*)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1377 this, SLOT (handle_add_filename_to_list (const QString&, QWidget*)));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1378
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
1379 connect (f, SIGNAL (editor_check_conflict_save (const QString&, bool)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1380 this, SLOT (check_conflict_save (const QString&, bool)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1381
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1382 connect (f, SIGNAL (mru_add_file (const QString&)),
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1383 this, SLOT (handle_mru_add_file (const QString&)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1384
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16615
diff changeset
1385 connect (f, SIGNAL (run_file_signal (const QFileInfo&)),
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16740
diff changeset
1386 main_win (), SLOT (run_file_in_terminal (const QFileInfo&)));
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1387
16731
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents: 16686
diff changeset
1388 connect (f, SIGNAL (execute_command_in_terminal_signal (const QString&)),
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16740
diff changeset
1389 main_win (), SLOT (execute_command_in_terminal (const QString&)));
16731
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents: 16686
diff changeset
1390
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
1391 // Signals from the file_editor non-trivial operations
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16407
diff changeset
1392 connect (this, SIGNAL (fetab_settings_changed (const QSettings *)),
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16407
diff changeset
1393 f, SLOT (notice_settings (const QSettings *)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1394
16638
3c2e457eeb72 ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents: 16637
diff changeset
1395 connect (this, SIGNAL (fetab_close_request (const QWidget*,bool)),
3c2e457eeb72 ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents: 16637
diff changeset
1396 f, SLOT (conditional_close (const QWidget*,bool)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1397
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
1398 connect (this, SIGNAL (fetab_change_request (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1399 f, SLOT (change_editor_state (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1400
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
1401 connect (this, SIGNAL (fetab_file_name_query (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1402 f, SLOT (file_name_query (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1403
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1404 connect (this, SIGNAL (fetab_save_file (const QWidget*, const QString&,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1405 bool)),
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1406 f, SLOT (save_file (const QWidget*, const QString&, bool)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1407
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
1408 // Signals from the file_editor trivial operations
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1409 connect (this, SIGNAL (fetab_undo (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1410 f, SLOT (undo (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1411
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
1412 connect (this, SIGNAL (fetab_redo (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1413 f, SLOT (redo (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1414
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
1415 connect (this, SIGNAL (fetab_copy (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1416 f, SLOT (copy (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1417
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
1418 connect (this, SIGNAL (fetab_cut (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1419 f, SLOT (cut (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1420
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
1421 connect (this, SIGNAL (fetab_paste (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1422 f, SLOT (paste (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1423
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1424 connect (this, SIGNAL (fetab_selectall (const QWidget*)),
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1425 f, SLOT (select_all (const QWidget*)));
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1426
18573
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1427 connect (this, SIGNAL (fetab_zoom_in (const QWidget*)),
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1428 f, SLOT (zoom_in (const QWidget*)));
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1429 connect (this, SIGNAL (fetab_zoom_out (const QWidget*)),
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1430 f, SLOT (zoom_out (const QWidget*)));
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1431 connect (this, SIGNAL (fetab_zoom_normal (const QWidget*)),
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1432 f, SLOT (zoom_normal (const QWidget*)));
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1433
17627
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1434 connect (this, SIGNAL (fetab_context_help (const QWidget*, bool)),
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1435 f, SLOT (context_help (const QWidget*, bool)));
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1436
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1437 connect (this, SIGNAL (fetab_context_edit (const QWidget*)),
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1438 f, SLOT (context_edit (const QWidget*)));
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1439
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
1440 connect (this, SIGNAL (fetab_save_file (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1441 f, SLOT (save_file (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1442
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
1443 connect (this, SIGNAL (fetab_save_file_as (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1444 f, SLOT (save_file_as (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1445
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
1446 connect (this, SIGNAL (fetab_print_file (const QWidget*)),
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
1447 f, SLOT (print_file (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1448
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
1449 connect (this, SIGNAL (fetab_run_file (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1450 f, SLOT (run_file (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1451
17635
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
1452 connect (this, SIGNAL (fetab_context_run (const QWidget*)),
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
1453 f, SLOT (context_run (const QWidget*)));
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
1454
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
1455 connect (this, SIGNAL (fetab_toggle_bookmark (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1456 f, SLOT (toggle_bookmark (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1457
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
1458 connect (this, SIGNAL (fetab_next_bookmark (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1459 f, SLOT (next_bookmark (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1460
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
1461 connect (this, SIGNAL (fetab_previous_bookmark (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1462 f, SLOT (previous_bookmark (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1463
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
1464 connect (this, SIGNAL (fetab_remove_bookmark (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1465 f, SLOT (remove_bookmark (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1466
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
1467 connect (this, SIGNAL (fetab_toggle_breakpoint (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1468 f, SLOT (toggle_breakpoint (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1469
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
1470 connect (this, SIGNAL (fetab_next_breakpoint (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1471 f, SLOT (next_breakpoint (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1472
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
1473 connect (this, SIGNAL (fetab_previous_breakpoint (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1474 f, SLOT (previous_breakpoint (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1475
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
1476 connect (this, SIGNAL (fetab_remove_all_breakpoints (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1477 f, SLOT (remove_all_breakpoints (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1478
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
1479 connect (this, SIGNAL (fetab_comment_selected_text (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1480 f, SLOT (comment_selected_text (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1481
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
1482 connect (this, SIGNAL (fetab_uncomment_selected_text (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1483 f, SLOT (uncomment_selected_text (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1484
18303
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1485 connect (this, SIGNAL (fetab_indent_selected_text (const QWidget*)),
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1486 f, SLOT (indent_selected_text (const QWidget*)));
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1487
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1488 connect (this, SIGNAL (fetab_unindent_selected_text (const QWidget*)),
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1489 f, SLOT (unindent_selected_text (const QWidget*)));
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1490
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
1491 connect (this, SIGNAL (fetab_find (const QWidget*)),
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1492 f, SLOT (find (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1493
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1494 connect (this, SIGNAL (fetab_goto_line (const QWidget*, int)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1495 f, SLOT (goto_line (const QWidget*, int)));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1496
18482
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1497 connect (this, SIGNAL (fetab_completion (const QWidget*)),
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1498 f, SLOT (show_auto_completion (const QWidget*)));
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1499
15980
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
1500 connect (this, SIGNAL (fetab_set_focus (const QWidget*)),
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
1501 f, SLOT (set_focus (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1502
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1503 connect (this, SIGNAL (fetab_insert_debugger_pointer (const QWidget*, int)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1504 f, SLOT (insert_debugger_pointer (const QWidget*, int)));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1505
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1506 connect (this, SIGNAL (fetab_delete_debugger_pointer (const QWidget*, int)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1507 f, SLOT (delete_debugger_pointer (const QWidget*, int)));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1508
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1509 connect (this, SIGNAL (fetab_do_breakpoint_marker (bool, const QWidget*,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1510 int)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1511 f, SLOT (do_breakpoint_marker (bool, const QWidget*, int)));
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1512
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
1513 _tab_widget->setCurrentWidget (f);
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1514
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1515 check_actions ();
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1516 }
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15861
diff changeset
1517
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1518 void
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1519 file_editor::copyClipboard ()
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1520 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1521 QWidget * foc_w = focusWidget ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1522
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1523 if (foc_w && foc_w->inherits ("octave_qscintilla"))
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1524 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1525 request_copy ();
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1526 }
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1527 }
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1528 void
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1529 file_editor::pasteClipboard ()
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1530 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1531 QWidget * foc_w = focusWidget ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1532
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1533 if (foc_w && foc_w->inherits ("octave_qscintilla"))
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1534 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1535 request_paste ();
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1536 }
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1537 }
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1538 void
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1539 file_editor::selectAll ()
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1540 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1541 QWidget * foc_w = focusWidget ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1542
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1543 if (foc_w && foc_w->inherits ("octave_qscintilla"))
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1544 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1545 request_selectall ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1546 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1547 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1548
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1549
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1550 void
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1551 file_editor::set_shortcuts (bool set)
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1552 {
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1553 if (set)
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1554 {
17637
b30bb9bb05c8 change some editor shortcuts
Torsten <ttl@justmail.de>
parents: 17636
diff changeset
1555 _comment_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_R);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1556 _uncomment_selection_action->setShortcut (Qt::SHIFT
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1557 + Qt::ControlModifier
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
1558 + Qt::Key_R);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1559
18303
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1560 _indent_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_Tab);
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1561 _unindent_selection_action->setShortcut (Qt::SHIFT
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1562 + Qt::ControlModifier
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1563 + Qt::Key_Tab);
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1564
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1565 _copy_action->setShortcut (QKeySequence::Copy);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1566 _cut_action->setShortcut (QKeySequence::Cut);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1567 _paste_action->setShortcut (QKeySequence::Paste);
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1568 _selectall_action->setShortcut (QKeySequence::SelectAll);
17627
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1569 _context_help_action->setShortcut (QKeySequence::HelpContents);
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1570 _context_doc_action->setShortcut (Qt::SHIFT + Qt::Key_F1);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1571
18573
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1572 _zoom_in_action->setShortcuts (QKeySequence::ZoomIn);
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1573 _zoom_out_action->setShortcuts (QKeySequence::ZoomOut);
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1574 _zoom_normal_action->setShortcut (Qt::ControlModifier + Qt::Key_Slash);
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1575
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1576 _find_action->setShortcut (QKeySequence::Find);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1577 _goto_line_action->setShortcut (Qt::ControlModifier+ Qt::Key_G);
18482
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1578 _completion_action->setShortcut (Qt::ControlModifier + Qt::Key_Space);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1579
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1580 _next_bookmark_action->setShortcut (Qt::Key_F2);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1581 _previous_bookmark_action->setShortcut (Qt::SHIFT + Qt::Key_F2);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1582 _toggle_bookmark_action->setShortcut (Qt::Key_F7);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1583
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1584 _print_action->setShortcut (QKeySequence::Print);
17637
b30bb9bb05c8 change some editor shortcuts
Torsten <ttl@justmail.de>
parents: 17636
diff changeset
1585 _run_action->setShortcut (Qt::Key_F5);
17635
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
1586 _context_run_action->setShortcut (Qt::Key_F9);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1587
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1588 _context_edit_action->setShortcut (Qt::ControlModifier + Qt::Key_E);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1589 _save_action->setShortcut (QKeySequence::Save);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1590 _save_as_action->setShortcut (QKeySequence::SaveAs);
16981
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
1591 _close_action->setShortcut (QKeySequence::Close);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1592
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1593 _redo_action->setShortcut (QKeySequence::Redo);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1594 _undo_action->setShortcut (QKeySequence::Undo);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1595 }
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1596 else
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1597 {
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1598 QKeySequence no_key = QKeySequence ();
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1599
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1600 _comment_selection_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1601 _uncomment_selection_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1602
18303
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1603 _indent_selection_action->setShortcut (no_key);
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1604 _unindent_selection_action->setShortcut (no_key);
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1605
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1606 _copy_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1607 _cut_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1608 _paste_action->setShortcut (no_key);
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18551
diff changeset
1609 _selectall_action->setShortcut (no_key);
17627
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1610 _context_help_action->setShortcut (no_key);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1611
18573
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1612 _zoom_in_action->setShortcut (no_key);
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1613 _zoom_out_action->setShortcut (no_key);
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1614 _zoom_normal_action->setShortcut (no_key);
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1615
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1616 _find_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1617 _goto_line_action->setShortcut (no_key);
18482
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1618 _completion_action->setShortcut (no_key);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1619
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1620 _next_bookmark_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1621 _previous_bookmark_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1622 _toggle_bookmark_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1623
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1624 _print_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1625 _run_action->setShortcut (no_key);
17635
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
1626 _context_run_action->setShortcut (no_key);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1627
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1628 _context_edit_action->setShortcut (no_key);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1629 _save_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1630 _save_as_action->setShortcut (no_key);
16981
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
1631 _close_action->setShortcut (no_key);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1632
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1633 _redo_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1634 _undo_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1635 }
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1636 }
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1637
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1638 void
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1639 file_editor::check_actions ()
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1640 {
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1641 bool have_tabs = _tab_widget->count () > 0;
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1642
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1643 _comment_selection_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1644 _uncomment_selection_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1645
18303
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1646 _indent_selection_action->setEnabled (have_tabs);
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1647 _unindent_selection_action->setEnabled (have_tabs);
106da7544504 gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents: 18294
diff changeset
1648
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1649 _paste_action->setEnabled (have_tabs);
17627
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1650 _context_help_action->setEnabled (have_tabs);
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1651 _context_doc_action->setEnabled (have_tabs);
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1652
18573
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1653 _zoom_in_action->setEnabled (have_tabs);
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1654 _zoom_out_action->setEnabled (have_tabs);
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1655 _zoom_normal_action->setEnabled (have_tabs);
26d15a57f45b add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents: 18568
diff changeset
1656
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1657 _find_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1658 _goto_line_action->setEnabled (have_tabs);
18482
3a509de8e791 automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents: 18460
diff changeset
1659 _completion_action->setEnabled (have_tabs);
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1660
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1661 _next_bookmark_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1662 _previous_bookmark_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1663 _toggle_bookmark_action->setEnabled (have_tabs);
17636
230ffaf80ac9 fix enabling copy, cut and run selection actions depending on selected text
Torsten <ttl@justmail.de>
parents: 17635
diff changeset
1664 _remove_bookmark_action->setEnabled (have_tabs);
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1665
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1666 _print_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1667 _run_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1668
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1669 _context_edit_action->setEnabled (have_tabs);
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1670 _save_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1671 _save_as_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1672 _close_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1673 _close_all_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1674 _close_others_action->setEnabled (have_tabs && _tab_widget->count () > 1);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1675
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1676 _undo_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1677 _redo_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1678 }
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1679
18399
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1680 // empty_script determines whether we have to create an empty script
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1681 // 1. At startup, when the editor has to be (really) visible
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1682 // (Here we can not use the visibility changed signal)
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1683 // 2. When the editor becomes visible when octave is running
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1684 void
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1685 file_editor::empty_script (bool startup, bool visible)
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1686 {
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1687 bool real_visible;
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1688
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1689 if (startup)
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1690 real_visible = isVisible ();
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1691 else
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1692 real_visible = visible;
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1693
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1694 if (! real_visible || _tab_widget->count () > 0)
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1695 return;
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1696
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1697 if (startup && ! isFloating ())
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1698 {
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1699 // check is editor is really visible or hidden between tabbed widgets
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1700 QList<QTabBar *> tab_list = main_win ()->findChildren<QTabBar *>();
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1701
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1702 bool in_tab = false;
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1703 int i = 0;
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1704 while ((i < tab_list.count ()) && (! in_tab))
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1705 {
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1706 QTabBar *tab = tab_list.at (i);
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1707 i++;
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1708
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1709 int j = 0;
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1710 while ((j < tab->count ()) && (! in_tab))
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1711 {
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1712 // check all tabs for the editor
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1713 if (tab->tabText (j) == windowTitle ())
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1714 {
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1715 // editor is in this tab widget
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1716 in_tab = true;
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1717 int top = tab->currentIndex ();
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1718 if (top > -1 && tab->tabText (top) == windowTitle ())
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1719 real_visible = true; // and is the current tab
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1720 else
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1721 return; // not current tab -> not visible
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1722 }
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1723 j++;
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1724 }
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1725 }
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1726 }
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1727
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1728 request_new_file ("");
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1729 }
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1730
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1731 // This slot is a reimplementation of the virtual slot in octave_dock_widget.
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1732 // We need this for creating an empty script when the editor has no open files
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1733 // and is made visible
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1734 void
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1735 file_editor::handle_visibility (bool visible)
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1736 {
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1737 empty_script (false, visible);
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1738
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1739 if (visible && ! isFloating ())
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1740 focus ();
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1741 }
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1742
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15861
diff changeset
1743 #endif