annotate libgui/src/m-editor/file-editor.cc @ 17676:c060ad097056

add menu entries to the editor for directly accessing the editor's settings * settings-dialog.ui: tabs with self explaining names * settings-dialog.cc(constructor): name of desired tab as new parameter, open the last or desired tab depending on this parameter; (destructor, write_lexer_settings): update to new tab names * settings-dialog.h: new parameter in constructor * main-window.cc(process_settings_dialog_request): name of desired tab as new parameter, settings-dialog is created with this parameter * main-window.h: new parameter for process_settings_dialog_request * file-editor.cc(request_preferences,request_styles_preferences): new slots emtting a new signal for opening the settings dialog via the main window; (construct): new actions for opening the editor and editor styles settings * file-editor.h: new actions, related slots and signal for main window
author Torsten <ttl@justmail.de>
date Thu, 17 Oct 2013 20:29:17 +0200
parents e693b2622f72
children 97ed9dd479ab
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
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
3 Copyright (C) 2011-2012 Jacob Dawid
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>
16407
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
39 #include <QProcess>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
40
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
41 #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
42 #include "utils.h"
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
43
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
44 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
45 : file_editor_interface (p)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
46 {
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
47 // 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
48 // 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
49 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
50
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
51 construct ();
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
52
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
53 setVisible (false);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
54 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
55
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
56 file_editor::~file_editor (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
57 {
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
58 QSettings *settings = resource_manager::get_settings ();
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
59
16740
cfefcc2a4dae do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents: 16739
diff changeset
60 // 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
61 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
62 emit fetab_file_name_query (0);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
63
16740
cfefcc2a4dae do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents: 16739
diff changeset
64 // 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
65 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
66 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
67 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
68 {
cfefcc2a4dae do not save unnamed files for restoring the editor session at next start up
Torsten <ttl@justmail.de>
parents: 16739
diff changeset
69 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
70 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
71 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
72 }
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
73
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
74 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
75 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
76
16638
3c2e457eeb72 ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents: 16637
diff changeset
77 for (int index = _tab_widget->count ()-1; index >= 0; index--)
3c2e457eeb72 ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents: 16637
diff changeset
78 emit fetab_close_request (_tab_widget->widget (index),true); // true: app closing
3c2e457eeb72 ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents: 16637
diff changeset
79
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
80 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
81 delete _mru_file_menu;
13524
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
82 }
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
83
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
84 void
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
85 file_editor::focus (void)
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
86 {
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
87 set_focus ();
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
88 }
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
89
15980
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
90 // 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
91 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
92 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
93 {
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
94 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
95 setVisible (true);
15980
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
96 setFocus ();
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
97 activateWindow ();
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
98 raise ();
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
99 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
100 if (fileEditorTab)
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
101 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
102 }
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
103
14795
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14788
diff changeset
104 QMenu *
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
105 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
106 {
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14788
diff changeset
107 return _debug_menu;
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14788
diff changeset
108 }
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14788
diff changeset
109
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
110 QToolBar *
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
111 file_editor::toolbar (void)
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
112 {
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
113 return _tool_bar;
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
114 }
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
115
13524
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
116 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16413
diff changeset
117 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
118 {
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
119 _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
120 }
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
diff changeset
121
41b86dc61306 Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14829
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_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
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 (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
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
16452
744ff2fe11ce add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents: 16443
diff changeset
129 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
130 {
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
131 // 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
132 // 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
133 // 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
134
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
135 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
136 if (fileEditorTab)
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
137 {
15982
131d40cd805b gui: cleanup some string constants for translations
Torsten <ttl@justmail.de>
parents: 15980
diff changeset
138 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
139 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
140 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
141 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
142 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
143
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
144 void
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
145 file_editor::request_new_script (const QString& commands)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
146 {
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
147 request_new_file (commands);
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
148 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
149
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
150 void
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
151 file_editor::request_new_function (const QString& commands)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
152 {
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
153 QString text = commands;
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
154
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
155 if (text.isEmpty ())
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
156 text = "## Copyright (C)\n"
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
157 "\n"
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
158 "## -*- texinfo -*-\n"
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
159 "## @deftypefn {Function File} {[outputs] =} unamed_function (inputs)\n"
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
160 "## @end deftypefn\n"
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
161 "\n"
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
162 "function [outputs] = unnamed_function (inputs)\n"
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
163 "\n"
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
164 "endfunction\n";
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
165
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
166 request_new_file (text);
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
167 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
168
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16560
diff changeset
169 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
170 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
171 {
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
172 // 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
173 // 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
174 // 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
175
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
176 // Create a NonModal message.
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
177 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
178 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
179
6bd74153c3ae no native dialogs to prevent hangs in KDE (patch #7948 by Andre da Costa Barros)
Torsten <ttl@justmail.de>
parents: 16881
diff changeset
180 // 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
181 // 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
182 // 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
183 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
184
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
185 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
186 fileDialog->setViewMode (QFileDialog::Detail);
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
187 fileDialog->setDirectory (ced);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
188
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
189 connect (fileDialog, SIGNAL (fileSelected (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
190 this, SLOT (request_open_file (const QString&)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
191
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
192 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
193 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
194 fileDialog->show ();
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
195 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
196
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
197 // 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
198 QWidget *
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
199 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
200 {
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
201 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
202
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
203 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
204 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
205 {
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
206 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
207
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
208 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
209 {
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
210 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
211 break;
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
212 }
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
213 }
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
214
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
215 return retval;
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
216 }
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
217
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
218 void
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
219 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
220 bool debug_pointer,
16443
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16440
diff changeset
221 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
222 {
16407
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
223 // Check if the user wants to use a custom file editor.
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
224 QSettings *settings = resource_manager::get_settings ();
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
225 if (settings->value ("useCustomFileEditor").toBool ())
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
226 {
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
227 QString editor = settings->value ("customFileEditor").toString ();
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
228 editor.replace ("%f", openFileName);
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
229 editor.replace ("%l", QString::number (line));
16407
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
230 QProcess::startDetached (editor);
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
231 if (line < 0)
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
232 handle_mru_add_file (QDir::cleanPath (openFileName));
16407
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
233 return;
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
234 }
4d438dffbfac gui: call external editor when opening a file and custom editor is selected
Torsten <ttl@justmail.de>
parents: 16399
diff changeset
235
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
236 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
237 {
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
238 // ?? Not sure this will happen. This routine isn't even called
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
239 // if the user hasn't selected a 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
240 }
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
241 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
242 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
243 // 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
244 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
245 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
246
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
247 // 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
248 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
249
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
250 if (tab)
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
251 {
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
252 _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
253
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
254 if (line > 0)
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
255 {
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
256 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
257
16386
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
258 if (debug_pointer)
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
259 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
260
16443
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16440
diff changeset
261 if (breakpoint_marker)
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
262 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
263 }
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
264
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
265 emit fetab_set_focus (tab);
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
266 }
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
267 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
268 {
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
269 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
270 if (fileEditorTab)
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
271 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
272 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
273 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
274 {
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
275 // 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
276 // 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
277 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
278 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
279 // file already loaded, add file to mru list here
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
280 handle_mru_add_file (QDir::cleanPath (openFileName));
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
281
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
282 if (line > 0)
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
283 {
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
284 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
285
16386
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
286 if (debug_pointer)
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
287 emit fetab_insert_debugger_pointer (fileEditorTab,
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
288 line);
16443
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16440
diff changeset
289 if (breakpoint_marker)
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
290 emit fetab_do_breakpoint_marker (insert, fileEditorTab,
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
291 line);
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
292 }
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
293 }
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
294 else
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
295 {
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
296 delete fileEditorTab;
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
297 // Create a NonModal message about error.
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
298 QMessageBox *msgBox
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
299 = new QMessageBox (QMessageBox::Critical,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
300 tr ("Octave Editor"),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
301 tr ("Could not open file %1 for read:\n%2.").
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
302 arg (openFileName).arg (result),
16686
c6c4847aaf67 Make open file "file not found" message box open in front of editor window.
John Donoghue <john.donoghue@ieee.org>
parents: 16638
diff changeset
303 QMessageBox::Ok, this);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
304
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
305 msgBox->setWindowModality (Qt::NonModal);
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
306 msgBox->setAttribute (Qt::WA_DeleteOnClose);
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
307 msgBox->show ();
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 }
424edeca3c66 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 }
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
310
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
311 // really show editor and the current editor tab
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
312 set_focus ();
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
313 }
13524
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
314 }
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
315 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
316
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
317 // 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
318 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
319 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
320 {
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
321 if (action)
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
322 {
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
323 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
324 }
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
325 }
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
326
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
327
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
328 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
329 file_editor::check_conflict_save (const QString& saveFileName, bool 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
330 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
331 // 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
332 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
333 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
334
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
335 // 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
336 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
337
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
338 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
339 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
340 // 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
341 // 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
342 // 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
343 // 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
344 // 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
345 // 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
346
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
347 // Create a NonModal message about error.
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
348 QMessageBox *msgBox
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
349 = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
350 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
351 "is already open in the editor").
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
352 arg (saveFileName),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
353 QMessageBox::Ok, 0);
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
354
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
355 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
356 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
357 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
358
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
359 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
360 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
361
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
362 QObject *saveFileObject = sender ();
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
363 QWidget *saveFileWidget = 0;
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
364
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
365 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
366 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
367 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
368 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
369 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
370 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
371 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
372 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
373 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
374 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
375 // Create a NonModal message about error.
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
376 QMessageBox *msgBox
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
377 = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
378 tr ("The associated file editor tab has disappeared. It was likely closed by some means."),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
379 QMessageBox::Ok, 0);
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
380
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
381 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
382 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
383 msgBox->show ();
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
384
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
385 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
386 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
387
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
388 // 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
389 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
390 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
391
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
392 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
393 file_editor::handle_insert_debugger_pointer_request (const QString& file,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
394 int line)
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
395 {
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
396 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
397 }
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
398
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
399 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
400 file_editor::handle_delete_debugger_pointer_request (const QString& file,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
401 int line)
16395
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
402 {
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
403 if (! file.isEmpty ())
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
404 {
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
405 // 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
406 editor_tab_map.clear ();
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
407 emit fetab_file_name_query (0);
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
408
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
409 // 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
410 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
411
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
412 if (tab)
16395
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
413 {
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
414 _tab_widget->setCurrentWidget (tab);
16395
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
415
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
416 if (line > 0)
16547
3cd80afc3509 improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents: 16546
diff changeset
417 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
418
16546
c1e90c7cfd30 try harder to find editor tab widgets for files with multiple names
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
419 emit fetab_set_focus (tab);
16395
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
420 }
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
421 }
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
422 }
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
423
fc491da603f6 also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents: 16389
diff changeset
424 void
16443
7a2ee6ea7800 rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents: 16440
diff changeset
425 file_editor::handle_update_breakpoint_marker_request (bool insert,
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
426 const QString& file,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
427 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
428 {
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
429 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
430 }
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
431
4902484f9181 callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents: 16383
diff changeset
432 void
16399
f9a737fd8829 allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
433 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
434 {
f9a737fd8829 allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
435 request_open_file (file);
16739
6960ac6ed127 * file-editor.cc(handle_edit_file_request): set focus to the editor widget
Torsten <ttl@justmail.de>
parents: 16737
diff changeset
436 set_focus ();
16399
f9a737fd8829 allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
437 }
f9a737fd8829 allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
438
f9a737fd8829 allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
439 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
440 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
441 {
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
442 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
443 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
444
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
445 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
446 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
447 {
15848
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
448 emit fetab_redo (_tab_widget->currentWidget ());
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
449 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
450
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
451 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
452 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
453 {
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
454 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
455 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
456
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
457 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
458 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
459 {
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
460 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
461 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
462
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
463 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
464 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
465 {
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
466 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
467 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
468
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
469 void
17627
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
470 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
471 {
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
472 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
473 }
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
474 void
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
475 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
476 {
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
477 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
478 }
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
479
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
480 void
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
481 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
482 {
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
483 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
484 }
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
485
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
486 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
487 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
488 {
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
489 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
490 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
491
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
492 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
493 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
494 {
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 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
496 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
497
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
498 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
499 file_editor::request_print_file (void)
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
500 {
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
501 emit fetab_print_file (_tab_widget->currentWidget ());
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
502 }
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
503
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
504
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
505 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
506 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
507 {
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
508 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
509 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
510
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
511 void
17635
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
512 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
513 {
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
514 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
515 }
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
516
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
517 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
518 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
519 {
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
520 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
521 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
522
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
523 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
524 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
525 {
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
526 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
527 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
528
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
529 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
530 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
531 {
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
532 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
533 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
534
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
535 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
536 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
537 {
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
538 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
539 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
540
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
541 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
542 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
543 {
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
544 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
545 }
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
546
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
547 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
548 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
549 {
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
550 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
551 }
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
552
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
553 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
554 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
555 {
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
556 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
557 }
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
558
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
559 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
560 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
561 {
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
562 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
563 }
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
564
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
565 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
566 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
567 {
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
568 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
569 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
570
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
571 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
572 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
573 {
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
574 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
575 }
4c4f2fb07a50 Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15045
diff changeset
576
4c4f2fb07a50 Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15045
diff changeset
577 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
578 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
579 {
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
580 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
581 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
582
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
583 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
584 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
585 {
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
586 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
587 }
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
588
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
589
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
590 void
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
591 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
592 {
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
593 _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
594 _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
595 mru_menu_update ();
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
596 }
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
597
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
598 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
599 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
600 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
601 int num_files = qMin (_mru_files.size (), int (MaxMRUFiles));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
602
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
603 // 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
604 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
605 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
606 QString text = tr ("&%1 %2").
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
607 arg ((i+1) % int (MaxMRUFiles)).arg (_mru_files.at (i));
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
608 _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
609 _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
610 _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
611 }
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
612
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
613 // hide unused mru-menu entries
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
614 for (int j = num_files; j < MaxMRUFiles; ++j)
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
615 _mru_file_actions[j]->setVisible (false);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
616
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
617 // delete entries in string-list beyond MaxMRUFiles
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
618 while (_mru_files.size () > MaxMRUFiles)
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
619 _mru_files.removeLast ();
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
620
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
621 // save actual mru-list in settings
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
622 QSettings *settings = resource_manager::get_settings ();
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
623
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
624 // FIXME -- what should happen if settings is 0?
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
625 settings->setValue ("editor/mru_file_list", _mru_files);
16175
6f83158c714c gui: make sure settings are really written into the settings file
Torsten <ttl@justmail.de>
parents: 16057
diff changeset
626 settings->sync ();
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
627 }
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
628
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
629 void
16307
f299079ed03a avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents: 16176
diff changeset
630 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
631 const QString& tip)
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
632 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
633 QObject *fileEditorTab = sender ();
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
634 if (fileEditorTab)
13524
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
635 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
636 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
637 {
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
638 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
639 {
16307
f299079ed03a avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents: 16176
diff changeset
640 _tab_widget->setTabText (i, fname);
f299079ed03a avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents: 16176
diff changeset
641 _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
642 }
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
643 }
13524
8c143d6d0330 gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents: 13506
diff changeset
644 }
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
645 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
646
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
647 void
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
648 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
649 {
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
650 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
651 }
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
652
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
653 void
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
654 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
655 {
16637
b3f4bdd7e5f4 fix endless loop when closing all files in the editor and files are modified
Torsten <ttl@justmail.de>
parents: 16635
diff changeset
656 // 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
657 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
658 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
659 }
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
660
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
661 void
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
662 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
663 {
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
664 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
665 // 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
666 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
667 {
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
668 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
669 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
670 }
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
671 }
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
672
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
673
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
674 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
675 file_editor::handle_tab_close_request (int index)
13529
8e87f3ba3beb gui-editor: enabled 'Save File As'
ttl <ttl@justmail.de>
parents: 13524
diff changeset
676 {
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
677 // 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
678 // 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
679 // 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
680 // 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
681 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
682 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
683 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
684
424edeca3c66 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 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
686 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
687 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
688 QObject *fileEditorTab = sender ();
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
689 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
690 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
691 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
692 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
693 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
694 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
695 _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
696 delete 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
697 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
698 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
699 }
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
700 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
701 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
702
424edeca3c66 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 void
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
704 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
705 {
16377
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
706 // 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
707
8430ea8c1594 open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents: 16375
diff changeset
708 editor_tab_map[fileName] = ID;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
709 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
710
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
711 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
712 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
713 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
714 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
715 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
716
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
717 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
718 file_editor::handle_editor_state_changed (bool copy_available,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
719 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
720 {
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
721 // 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
722 // 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
723 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
724 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
725 _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
726 _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
727 _context_run_action->setEnabled (copy_available);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
728
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
729 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
730 {
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
731 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
732 int lastslash = ced.lastIndexOf ('/');
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
733
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
734 // 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
735 // 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
736 if (lastslash > 0 && lastslash != ced.count ())
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
737 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
738 }
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
739
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
740 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
741 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
742 }
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
743
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
744 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
745 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
746 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
747 int icon_size = settings->value ("toolbar_icon_size", 24).toInt ();
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
748 _tool_bar->setIconSize (QSize (icon_size, icon_size));
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
749 // 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
750 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
751 }
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
752
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
753 void
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
754 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
755 {
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
756 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
757 }
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
758
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
759 void
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
760 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
761 {
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
762 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
763 }
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
764
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
765 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
766 file_editor::construct (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
767 {
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
768 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
769
9cd14e53e906 eliminate some compiler warnings for GUI code
John W. Eaton <jwe@octave.org>
parents: 15873
diff changeset
770 // FIXME -- what was the intended purpose of this unused variable?
9cd14e53e906 eliminate some compiler warnings for GUI code
John W. Eaton <jwe@octave.org>
parents: 15873
diff changeset
771 // QStyle *editor_style = QApplication::style ();
13566
d22b9973120f Renamed language files to match convention.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13562
diff changeset
772
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
773 _menu_bar = new QMenuBar (editor_widget);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
774 _tool_bar = new QToolBar (editor_widget);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
775 _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
776 _tab_widget->setTabsClosable (true);
13562
a89aa9e05e19 editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents: 13558
diff changeset
777
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
778 QAction *new_action = new QAction (QIcon (":/actions/icons/filenew.png"),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
779 tr ("&New File"), _tool_bar);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
780
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
781 QAction *open_action = new QAction (QIcon (":/actions/icons/fileopen.png"),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
782 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
783
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
784 _save_action = new QAction (QIcon (":/actions/icons/filesave.png"),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
785 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
786
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
787 _save_as_action = new QAction (QIcon (":/actions/icons/filesaveas.png"),
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
788 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
789
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
790 _print_action = new QAction ( QIcon (":/actions/icons/fileprint.png"),
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
791 tr ("Print"), _tool_bar);
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
792
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
793 _undo_action = new QAction (QIcon (":/actions/icons/undo.png"),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
794 tr ("&Undo"), _tool_bar);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
795
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
796 _redo_action = new QAction (QIcon (":/actions/icons/redo.png"),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
797 tr ("&Redo"), _tool_bar);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
798
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
799 _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
800 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
801 _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
802
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
803 _cut_action = new QAction (QIcon (":/actions/icons/editcut.png"),
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14874
diff changeset
804 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
805 _cut_action->setEnabled (false);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
806
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
807 _paste_action
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
808 = new QAction (QIcon (":/actions/icons/editpaste.png"),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
809 tr ("Paste"), _tool_bar);
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
810
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
811 _next_bookmark_action = new QAction (tr ("&Next Bookmark"), _tool_bar);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
812
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
813 _previous_bookmark_action = new QAction (tr ("Pre&vious Bookmark"), _tool_bar);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
814
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
815 _toggle_bookmark_action = new QAction (tr ("Toggle &Bookmark"), _tool_bar);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
816
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
817 _remove_bookmark_action
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
818 = 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
819
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
820 QAction *next_breakpoint_action
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
821 = new QAction (QIcon (":/actions/icons/bp_next.png"),
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
822 tr ("&Next breakpoint"), _tool_bar);
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
823 QAction *previous_breakpoint_action
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
824 = new QAction (QIcon (":/actions/icons/bp_prev.png"),
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
825 tr ("Pre&vious breakpoint"), _tool_bar);
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
826 QAction *toggle_breakpoint_action
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
827 = new QAction (QIcon (":/actions/icons/bp_toggle.png"),
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
828 tr ("Toggle &breakpoint"), _tool_bar);
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
829 QAction *remove_all_breakpoints_action
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
830 = new QAction (QIcon (":/actions/icons/bp_rm_all.png"),
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
831 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
832
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
833 _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
834 = 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
835 _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
836 = new QAction (tr ("&Uncomment"), _tool_bar);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
837
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
838 _find_action = new QAction (QIcon (":/actions/icons/search.png"),
15105
f4ea22ef2beb Incorporated patch that adds replace from Torsten and modified it.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15080
diff changeset
839 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
840
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
841 _run_action = new QAction (QIcon (":/actions/icons/artsbuilderexecute.png"),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
842 tr ("Save File And Run"), _tool_bar);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
843
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
844 _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
845
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
846 // 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
847 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
848 // FIXME -- what should happen if settings is 0?
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
849 _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
850 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
851 {
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
852 _mru_file_actions[i] = new QAction (this);
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
853 _mru_file_actions[i]->setVisible (false);
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
854 }
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
855
13584
e76a22bfe406 editor: added bookmark feature
ttl <ttl@justmail.de>
parents: 13566
diff changeset
856 // some actions are disabled from the beginning
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
857 _copy_action->setEnabled (false);
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
858 _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
859
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
860 _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
861 _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
862 _save_as_action->setShortcutContext (Qt::WindowShortcut);
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
863
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
864 _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
865
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
866 _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
867 _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
868 _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
869 _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
870 _uncomment_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
871 _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
872 _goto_line_action->setShortcutContext (Qt::WindowShortcut);
13556
0d18b0e168ae editor: shortcuts for toolbar actions, window icon
ttl <ttl@justmail.de>
parents: 13555
diff changeset
873
13562
a89aa9e05e19 editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents: 13558
diff changeset
874 // toolbar
14718
3df7ef0080c7 Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14715
diff changeset
875 _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
876 _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
877 _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
878 _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
879 _tool_bar->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
880 _tool_bar->addAction (_print_action);
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
881 _tool_bar->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
882 _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
883 _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
884 _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
885 _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
886 _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
887 _tool_bar->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
888 _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
889 _tool_bar->addAction (_run_action);
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
890 _tool_bar->addSeparator ();
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
891 _tool_bar->addAction (toggle_breakpoint_action);
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
892 _tool_bar->addAction (next_breakpoint_action);
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
893 _tool_bar->addAction (previous_breakpoint_action);
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
894 _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
895
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
896 // 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
897 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
898
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
899 _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
900 for (int i = 0; i < MaxMRUFiles; ++i)
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
901 _mru_file_menu->addAction (_mru_file_actions[i]);
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
902
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
903 fileMenu->addAction (new_action);
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
904 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
905 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
906 fileMenu->addSeparator ();
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
907 _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
908 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
909 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
910 fileMenu->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
911 fileMenu->addAction (_save_action);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
912 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
913
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
914 fileMenu->addSeparator ();
16981
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
915 _close_action =
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
916 fileMenu->addAction (QIcon::fromTheme("window-close",
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
917 QIcon (":/actions/icons/fileclose.png")),
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
918 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
919 _close_all_action =
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
920 fileMenu->addAction (QIcon::fromTheme("window-close",
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
921 QIcon (":/actions/icons/fileclose.png")),
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
922 tr ("Close All"),
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
923 this, SLOT (request_close_all_files (bool)));
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
924 _close_others_action =
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
925 fileMenu->addAction (QIcon::fromTheme("window-close",
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
926 QIcon (":/actions/icons/fileclose.png")),
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
927 tr ("Close Other Files"),
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
928 this, SLOT (request_close_other_files (bool)));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
929
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
930 fileMenu->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
931 fileMenu->addAction (_print_action);
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
932
16615
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
933 _menu_bar->addMenu (fileMenu);
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
934
cb09eecbd84e add close actions to the file menu of the editor
Torsten <ttl@justmail.de>
parents: 16614
diff changeset
935
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
936 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
937 editMenu->addAction (_undo_action);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
938 editMenu->addAction (_redo_action);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
939 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
940 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
941 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
942 editMenu->addAction (_paste_action);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
943 editMenu->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
944 editMenu->addAction (_find_action);
15080
4c4f2fb07a50 Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15045
diff changeset
945 editMenu->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
946 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
947 editMenu->addAction (_uncomment_selection_action);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
948 editMenu->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
949 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
950 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
951 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
952 editMenu->addAction (_remove_bookmark_action);
16375
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
953 editMenu->addSeparator ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
954 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
955 editMenu->addSeparator ();
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
956 _preferences_action =
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
957 editMenu->addAction (QIcon (":/actions/icons/configure.png"),
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
958 tr ("&Preferences"), this, SLOT (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
959 _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
960 editMenu->addAction (QIcon (":/actions/icons/configure.png"),
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
961 tr ("&Styles Preferences"), 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
962 _menu_bar->addMenu (editMenu);
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
963
14778
f43916137064 Added debug menu to file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
964 _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
965 _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
966 _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
967 _debug_menu->addAction (previous_breakpoint_action);
15106
59175df7dcf6 Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15105
diff changeset
968 _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
969 _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
970 // 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
971 _menu_bar->addMenu (_debug_menu);
f43916137064 Added debug menu to file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
972
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
973 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
974 _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
975 _context_run_action =
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
976 _run_menu->addAction (QIcon (), tr ("Run &Selection"),
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
977 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
978 _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
979 _menu_bar->addMenu (_run_menu);
13566
d22b9973120f Renamed language files to match convention.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13562
diff changeset
980
17627
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
981 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
982 _context_help_action =
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
983 _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
984 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
985 _context_doc_action =
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
986 _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
987 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
988 _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
989
16981
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
990 // shortcuts
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
991 set_shortcuts (true);
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
992
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
993 // layout
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
994 QVBoxLayout *vbox_layout = new QVBoxLayout ();
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
995 vbox_layout->addWidget (_menu_bar);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
996 vbox_layout->addWidget (_tool_bar);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
997 vbox_layout->addWidget (_tab_widget);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
998 vbox_layout->setMargin (0);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
999 editor_widget->setLayout (vbox_layout);
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
1000 setWidget (editor_widget);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1001
16981
e86df0d43309 make ctrl-w available for readline in the gui terminal
Torsten <ttl@justmail.de>
parents: 16970
diff changeset
1002 // signals
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
1003 connect (this, SIGNAL (request_settings_dialog (const QString&)),
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
1004 main_win (), SLOT (process_settings_dialog_request (const QString&)));
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17639
diff changeset
1005
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16740
diff changeset
1006 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
1007 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
1008
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16740
diff changeset
1009 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
1010 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
1011
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1012 connect (new_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1013 this, SLOT (request_new_file ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1014
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1015 connect (open_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1016 this, SLOT (request_open_file ()));
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 connect (_undo_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1019 this, SLOT (request_undo ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1020
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1021 connect (_redo_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1022 this, SLOT (request_redo ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1023
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1024 connect (_copy_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1025 this, SLOT (request_copy ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1026
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1027 connect (_cut_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1028 this, SLOT (request_cut ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1029
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1030 connect (_paste_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1031 this, SLOT (request_paste ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1032
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1033 connect (_save_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1034 this, SLOT (request_save_file ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1035
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1036 connect (_save_as_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1037 this, SLOT (request_save_file_as ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
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 connect (_print_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1040 this, SLOT (request_print_file ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1041
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1042 connect (_run_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1043 this, SLOT (request_run_file ()));
16375
f482302d81c9 editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents: 16307
diff changeset
1044
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1045 connect (_toggle_bookmark_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1046 this, SLOT (request_toggle_bookmark ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1047
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1048 connect (_next_bookmark_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1049 this, SLOT (request_next_bookmark ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1050
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1051 connect (_previous_bookmark_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1052 this, SLOT (request_previous_bookmark ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1053
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1054 connect (_remove_bookmark_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1055 this, SLOT (request_remove_bookmark ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1056
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1057 connect (toggle_breakpoint_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1058 this, SLOT (request_toggle_breakpoint ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1059
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1060 connect (next_breakpoint_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1061 this, SLOT (request_next_breakpoint ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1062
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1063 connect (previous_breakpoint_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1064 this, SLOT (request_previous_breakpoint ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1065
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1066 connect (remove_all_breakpoints_action, SIGNAL (triggered ()),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1067 this, SLOT (request_remove_breakpoint ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1068
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1069 connect (_comment_selection_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1070 this, SLOT (request_comment_selected_text ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1071
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1072 connect (_uncomment_selection_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1073 this, SLOT (request_uncomment_selected_text ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1074
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1075 connect (_find_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1076 this, SLOT (request_find ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1077
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1078 connect (_goto_line_action, SIGNAL (triggered ()),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1079 this, SLOT (request_goto_line ()));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1080
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
1081 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
1082 this, SLOT (request_mru_open_file (QAction *)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1083
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1084 mru_menu_update ();
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1085
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1086 connect (_tab_widget, SIGNAL (tabCloseRequested (int)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1087 this, SLOT (handle_tab_close_request (int)));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1088
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1089 connect (_tab_widget, SIGNAL (currentChanged (int)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1090 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
1091
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1092 resize (500, 400);
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1093 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
1094 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
1095
842ab161c10a GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents: 15321
diff changeset
1096 //restore previous session
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1097 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
1098 {
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1099 QStringList sessionFileNames
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1100 = settings->value ("editor/savedSessionTabs", 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
1101
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1102 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
1103 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
1104 }
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1105
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1106 check_actions ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1107 }
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1108
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1109 void
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1110 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
1111 {
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
1112 _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
1113
424edeca3c66 Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15552
diff changeset
1114 // 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
1115 connect (f, SIGNAL (file_name_changed (const QString&, const QString&)),
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1116 this, SLOT (handle_file_name_changed (const QString&,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1117 const QString&)));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1118
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
1119 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
1120 this, SLOT (handle_editor_state_changed (bool, const QString&)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1121
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
1122 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
1123 this, SLOT (handle_tab_remove_request ()));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1124
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1125 connect (f, SIGNAL (add_filename_to_list (const QString&, QWidget*)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1126 this, SLOT (handle_add_filename_to_list (const QString&, QWidget*)));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1127
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
1128 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
1129 this, SLOT (check_conflict_save (const QString&, bool)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1130
15860
feba9ff6e6a8 editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents: 15848
diff changeset
1131 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
1132 this, SLOT (handle_mru_add_file (const QString&)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1133
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16615
diff changeset
1134 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
1135 main_win (), SLOT (run_file_in_terminal (const QFileInfo&)));
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
1136
16731
01d523d5f796 add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents: 16686
diff changeset
1137 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
1138 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
1139
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
1140 // 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
1141 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
1142 f, SLOT (notice_settings (const QSettings *)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1143
16638
3c2e457eeb72 ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents: 16637
diff changeset
1144 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
1145 f, SLOT (conditional_close (const QWidget*,bool)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1146
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
1147 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
1148 f, SLOT (change_editor_state (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1149
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
1150 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
1151 f, SLOT (file_name_query (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1152
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1153 connect (this, SIGNAL (fetab_save_file (const QWidget*, const QString&,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1154 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
1155 f, SLOT (save_file (const QWidget*, const QString&, bool)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1156
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
1157 // 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
1158 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
1159 f, SLOT (undo (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1160
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
1161 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
1162 f, SLOT (redo (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1163
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
1164 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
1165 f, SLOT (copy (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1166
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
1167 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
1168 f, SLOT (cut (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1169
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
1170 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
1171 f, SLOT (paste (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1172
17627
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1173 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
1174 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
1175
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1176 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
1177 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
1178
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
1179 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
1180 f, SLOT (save_file (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1181
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
1182 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
1183 f, SLOT (save_file_as (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1184
16440
aaf024ac8015 Add editor print menu/toolbutton implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16438
diff changeset
1185 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
1186 f, SLOT (print_file (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1187
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
1188 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
1189 f, SLOT (run_file (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1190
17635
7945344506ae Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents: 17628
diff changeset
1191 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
1192 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
1193
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
1194 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
1195 f, SLOT (toggle_bookmark (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1196
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
1197 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
1198 f, SLOT (next_bookmark (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1199
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
1200 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
1201 f, SLOT (previous_bookmark (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1202
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
1203 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
1204 f, SLOT (remove_bookmark (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1205
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
1206 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
1207 f, SLOT (toggle_breakpoint (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1208
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
1209 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
1210 f, SLOT (next_breakpoint (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1211
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
1212 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
1213 f, SLOT (previous_breakpoint (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1214
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
1215 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
1216 f, SLOT (remove_all_breakpoints (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1217
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
1218 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
1219 f, SLOT (comment_selected_text (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1220
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
1221 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
1222 f, SLOT (uncomment_selected_text (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1223
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
1224 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
1225 f, SLOT (find (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1226
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1227 connect (this, SIGNAL (fetab_goto_line (const QWidget*, int)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1228 f, SLOT (goto_line (const QWidget*, int)));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1229
15980
6c0fce0632a4 gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents: 15901
diff changeset
1230 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
1231 f, SLOT (set_focus (const QWidget*)));
16558
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1232
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1233 connect (this, SIGNAL (fetab_insert_debugger_pointer (const QWidget*, int)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1234 f, SLOT (insert_debugger_pointer (const QWidget*, int)));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1235
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1236 connect (this, SIGNAL (fetab_delete_debugger_pointer (const QWidget*, int)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1237 f, SLOT (delete_debugger_pointer (const QWidget*, int)));
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1238
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1239 connect (this, SIGNAL (fetab_do_breakpoint_marker (bool, const QWidget*,
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1240 int)),
5fc1ce2947bd style fixes
John W. Eaton <jwe@octave.org>
parents: 16547
diff changeset
1241 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
1242
14715
b4db843b1f26 Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
1243 _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
1244
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1245 check_actions ();
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14674
diff changeset
1246 }
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15861
diff changeset
1247
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1248 void
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1249 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
1250 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1251 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
1252
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1253 if(foc_w && foc_w->inherits ("octave_qscintilla"))
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1254 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1255 request_copy ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1256 }
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1257 }
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1258 void
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1259 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
1260 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1261 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
1262
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1263 if(foc_w && foc_w->inherits ("octave_qscintilla"))
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1264 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1265 request_paste ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1266 }
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1267 }
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16809
diff changeset
1268
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1269 void
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1270 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
1271 {
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1272 if (set)
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1273 {
17637
b30bb9bb05c8 change some editor shortcuts
Torsten <ttl@justmail.de>
parents: 17636
diff changeset
1274 _comment_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_R);
17639
e693b2622f72 fix ambigous editor shortcut for uncommenting
Torsten <ttl@justmail.de>
parents: 17637
diff changeset
1275 _uncomment_selection_action->setShortcut (Qt::SHIFT + Qt::ControlModifier + Qt::Key_R);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1276
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1277 _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
1278 _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
1279 _paste_action->setShortcut (QKeySequence::Paste);
17627
811019b9ef57 Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents: 17009
diff changeset
1280 _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
1281 _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
1282
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1283 _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
1284 _goto_line_action->setShortcut (Qt::ControlModifier+ Qt::Key_G);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1285
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1286 _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
1287 _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
1288 _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
1289
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1290 _print_action->setShortcut (QKeySequence::Print);
17637
b30bb9bb05c8 change some editor shortcuts
Torsten <ttl@justmail.de>
parents: 17636
diff changeset
1291 _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
1292 _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
1293
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1294 _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
1295 _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
1296 _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
1297 _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
1298
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1299 _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
1300 _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
1301 }
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1302 else
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1303 {
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1304 QKeySequence no_key = QKeySequence ();
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1305
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1306 _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
1307 _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
1308
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1309 _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
1310 _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
1311 _paste_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
1312 _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
1313
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1314 _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
1315 _goto_line_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1316
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1317 _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
1318 _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
1319 _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
1320
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1321 _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
1322 _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
1323 _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
1324
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1325 _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
1326 _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
1327 _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
1328 _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
1329
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1330 _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
1331 _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
1332 }
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1333 }
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1334
17009
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1335 void
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1336 file_editor::check_actions ()
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1337 {
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1338 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
1339
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1340 _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
1341 _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
1342
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1343 _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
1344 _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
1345 _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
1346
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1347 _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
1348 _goto_line_action->setEnabled (have_tabs);
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1349
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1350 _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
1351 _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
1352 _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
1353 _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
1354
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1355 _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
1356 _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
1357
17628
99ffa521ecec Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents: 17627
diff changeset
1358 _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
1359 _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
1360 _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
1361 _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
1362 _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
1363 _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
1364
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1365 _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
1366 _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
1367 }
adf06e03fbdd Enable/disable editor actions based on available editor windows
John Donoghue <john.donoghue@ieee.org>
parents: 16981
diff changeset
1368
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1369
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15861
diff changeset
1370 #endif