Mercurial > octave
annotate libgui/src/m-editor/file-editor.cc @ 16399:f9a737fd8829
allow command-line edit function to use GUI editor
* file-editor-interface.h
(file_editor_interface::handle_edit_file_request): New pure virtual function.
* file-editor.h, file-editor.cc
(file_editor::handle_edit_file_request): New function.
* octave-event-listener.h (octave_event_listenter::edit_file): New
pure virtual function.
* octave-qt-event-listener.h, octave-qt-event-listener.cc
(octave_qt_event_listener::edit_file): New function.
(octave_qt_event_listener::edit_file_signal): New signal.
* main-window.h, main-window.cc
(main_window::handle_edit_file_request): New function.
(main_window::construct): Connect edit_file_signal to
handle_edit_file_request.
* __execute_edit_hook__.cc: New file. Provide
Fadd_edit_hook, Fremove_edit_hook, and F__execute_edit_hook__
functions for the interpreter.
* libinterp/corefcn/module.mk (COREFCN_SRC): Include it in the list.
* octave-link.h, octave-link.cc (octave_link::edit_file,
octave_link::do_edit_file): New functions.
* octave-main-thread.cc (edit_hook_fcn): New function.
(octave_main_thread::run): Install it as an edit_hook function.
* miscellaneous/edit.m (do_edit): New subfunction. Allow edit request
to be intercepted by edit_hook function.
(edit): Use it to uniformly handle starting the editor.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 30 Mar 2013 10:57:15 -0400 |
parents | fc491da603f6 |
children | 4d438dffbfac |
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 | 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 | 31 #include <QVBoxLayout> |
32 #include <QApplication> | |
33 #include <QFile> | |
13584 | 34 #include <QFont> |
13501 | 35 #include <QFileDialog> |
36 #include <QMessageBox> | |
37 #include <QStyle> | |
38 #include <QTextStream> | |
39 | |
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
|
40 #include "octave-link.h" |
424edeca3c66
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 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
42 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
|
43 : file_editor_interface (p) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
44 { |
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
|
45 // 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
|
46 // 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
|
47 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
|
48 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
49 construct (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
50 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
51 setVisible (false); |
13501 | 52 } |
53 | |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
54 file_editor::~file_editor () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
55 { |
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
|
56 QSettings *settings = resource_manager::get_settings (); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
57 editor_tab_map.clear (); |
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 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
|
59 { |
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
|
60 // Have all file editor tabs signal what their file names are. |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
61 emit fetab_file_name_query (0); |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
62 } |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
63 QStringList fetFileNames; |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
64 for (std::map<QString, QWidget *>::const_iterator p = editor_tab_map.begin (); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
65 p != editor_tab_map.end (); p++) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
66 fetFileNames.append (p->first); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
67 |
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
|
68 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
|
69 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
|
70 |
41471c02d51c
gui: show menu with recently used editor files also in file menu of main window
Torsten <ttl@justmail.de>
parents:
15984
diff
changeset
|
71 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
|
72 delete _mru_file_menu; |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
73 } |
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
74 |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
75 // 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
|
76 void |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
77 file_editor::set_focus () |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
78 { |
15993
41471c02d51c
gui: show menu with recently used editor files also in file menu of main window
Torsten <ttl@justmail.de>
parents:
15984
diff
changeset
|
79 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
|
80 setVisible (true); |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
81 setFocus (); |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
82 activateWindow (); |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
83 raise (); |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
84 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
|
85 if (fileEditorTab) |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
86 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
|
87 } |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
88 |
14795
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
89 QMenu * |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
90 file_editor::debug_menu () |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
91 { |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
92 return _debug_menu; |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
93 } |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14788
diff
changeset
|
94 |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
95 QToolBar * |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
96 file_editor::toolbar () |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
97 { |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
98 return _tool_bar; |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
99 } |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
100 |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
101 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
|
102 file_editor::handle_entered_debug_mode () |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
103 { |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
104 _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
|
105 } |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
106 |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
107 void |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
108 file_editor::handle_quit_debug_mode () |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
109 { |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
110 _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
|
111 } |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
112 |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
113 void |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
114 file_editor::request_new_file () |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
115 { |
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
|
116 // 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
|
117 // 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
|
118 // 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
|
119 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
120 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
|
121 if (fileEditorTab) |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
122 { |
15982
131d40cd805b
gui: cleanup some string constants for translations
Torsten <ttl@justmail.de>
parents:
15980
diff
changeset
|
123 add_file_editor_tab (fileEditorTab, ""); // new tab with empty title |
131d40cd805b
gui: cleanup some string constants for translations
Torsten <ttl@justmail.de>
parents:
15980
diff
changeset
|
124 fileEditorTab->new_file (); // 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
|
125 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
|
126 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
127 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
128 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
129 void |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
130 file_editor::request_open_file () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
131 { |
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
|
132 // 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
|
133 // 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
|
134 // 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
|
135 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
136 // Create a NonModal message. |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
137 QFileDialog* fileDialog = new QFileDialog (this); |
15982
131d40cd805b
gui: cleanup some string constants for translations
Torsten <ttl@justmail.de>
parents:
15980
diff
changeset
|
138 fileDialog->setNameFilter (tr("Octave Files (*.m);;All Files (*.*)")); |
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
|
139 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
|
140 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
|
141 fileDialog->setDirectory (ced); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
142 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
|
143 this, SLOT (request_open_file (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
|
144 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
|
145 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
|
146 fileDialog->show (); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
147 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
148 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
149 void |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
150 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
|
151 bool debug_pointer, |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
152 bool dbstop_marker, bool insert) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
153 { |
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
|
154 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
|
155 { |
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
|
156 // ?? 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
|
157 // 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
|
158 } |
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
|
159 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
|
160 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
161 // 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
|
162 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
|
163 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
|
164 |
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
|
165 // Check whether this file is already open in the editor. |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
166 std::map<QString, QWidget *>::const_iterator p = editor_tab_map.find (openFileName); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
167 if (p != editor_tab_map.end ()) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
168 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
169 _tab_widget->setCurrentWidget (p->second); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
170 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
171 if (line > 0) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
172 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
173 emit fetab_goto_line (p->second, line); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
174 |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
175 if (debug_pointer) |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
176 emit fetab_insert_debugger_pointer (p->second, line-1); |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
177 |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
178 if (dbstop_marker) |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
179 emit fetab_do_dbstop_marker (insert, p->second, line-1); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
180 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
181 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
182 emit fetab_set_focus (p->second); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
183 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
184 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
|
185 { |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
186 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
|
187 if (fileEditorTab) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
188 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
189 QString result = fileEditorTab->load_file(openFileName); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
190 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
|
191 { |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
192 // 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
|
193 // 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
|
194 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
|
195 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
|
196 // file already loaded, add file to mru list here |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
197 handle_mru_add_file(QDir::cleanPath (openFileName)); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
198 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
199 if (line > 0) |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
200 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
201 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
|
202 |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
203 if (debug_pointer) |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
204 emit fetab_insert_debugger_pointer (fileEditorTab, line-1); |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
205 if (dbstop_marker) |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
206 emit fetab_do_dbstop_marker |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
207 (insert, fileEditorTab, line-1); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
208 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
209 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
210 else |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
211 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
212 delete fileEditorTab; |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
213 // Create a NonModal message about error. |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
214 QMessageBox* msgBox = new QMessageBox ( |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
215 QMessageBox::Critical, tr ("Octave Editor"), |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
216 tr ("Could not open file %1 for read:\n%2."). |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
217 arg (openFileName).arg (result), |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
218 QMessageBox::Ok, 0); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
219 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
|
220 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
|
221 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
|
222 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
223 } |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
224 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
225 // 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
|
226 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
|
227 } |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
228 } |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
229 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
230 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
231 // 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
|
232 void |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
233 file_editor::request_mru_open_file () |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
234 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
235 QAction *action = qobject_cast<QAction *>(sender ()); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
236 if (action) |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
237 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
238 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
|
239 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
240 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
241 |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
242 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
243 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
|
244 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
|
245 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
246 // 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
|
247 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
|
248 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
|
249 |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
250 std::map<QString, QWidget *>::const_iterator p = editor_tab_map.find (saveFileName); |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
251 if (p != editor_tab_map.end ()) |
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
|
252 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
253 // 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
|
254 // 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
|
255 // 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
|
256 // 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
|
257 // 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
|
258 // 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
|
259 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
260 // Create a NonModal message about error. |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
261 QMessageBox* msgBox = new QMessageBox ( |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
262 QMessageBox::Critical, tr ("Octave Editor"), |
15901
927b121ad63f
gui: new error message when saving a file as one already opened in the editor
Torsten <ttl@justmail.de>
parents:
15894
diff
changeset
|
263 tr ("File not saved! A file with the selected name\n%1\n" |
927b121ad63f
gui: new error message when saving a file as one already opened in the editor
Torsten <ttl@justmail.de>
parents:
15894
diff
changeset
|
264 "is already open in the editor"). |
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
|
265 arg (saveFileName), |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
266 QMessageBox::Ok, 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
|
267 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
|
268 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
|
269 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
|
270 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
271 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
|
272 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
273 |
424edeca3c66
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 QObject* saveFileObject = sender (); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
275 QWidget* saveFileWidget = 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
|
276 for(int i = 0; i < _tab_widget->count (); 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
|
277 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
278 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
|
279 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
280 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
|
281 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
|
282 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
283 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
284 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
|
285 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
286 // Create a NonModal message about error. |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
287 QMessageBox* msgBox = new QMessageBox ( |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
288 QMessageBox::Critical, tr ("Octave Editor"), |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
289 tr ("The associated file editor tab has disappeared. It was likely closed by some means."), |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
290 QMessageBox::Ok, 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
|
291 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
|
292 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
|
293 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
|
294 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
|
295 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
296 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
297 // 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
|
298 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
|
299 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
300 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
301 void |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
302 file_editor::handle_insert_debugger_pointer_request (const QString& file, int line) |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
303 { |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
304 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
|
305 } |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
306 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
307 void |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
308 file_editor::handle_delete_debugger_pointer_request (const QString& file, int line) |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
309 { |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
310 if (! file.isEmpty ()) |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
311 { |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
312 // 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
|
313 editor_tab_map.clear (); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
314 emit fetab_file_name_query (0); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
315 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
316 // Check whether this file is already open in the editor. |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
317 std::map<QString, QWidget *>::const_iterator p = editor_tab_map.find (file); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
318 if (p != editor_tab_map.end ()) |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
319 { |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
320 _tab_widget->setCurrentWidget (p->second); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
321 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
322 if (line > 0) |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
323 emit fetab_delete_debugger_pointer (p->second, line-1); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
324 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
325 emit fetab_set_focus (p->second); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
326 } |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
327 } |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
328 } |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
329 |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
330 void |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
331 file_editor::handle_update_dbstop_marker_request (bool insert, |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
332 const QString& file, int line) |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
333 { |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
334 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
|
335 } |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
336 |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
337 void |
16399
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
338 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
|
339 { |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
340 request_open_file (file); |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
341 } |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
342 |
f9a737fd8829
allow command-line edit function to use GUI editor
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
343 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
|
344 file_editor::request_undo () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
345 { |
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
|
346 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
|
347 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
348 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
349 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
|
350 file_editor::request_redo () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
351 { |
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
|
352 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
|
353 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
354 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
355 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
|
356 file_editor::request_copy () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
357 { |
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
|
358 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
|
359 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
360 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
361 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
|
362 file_editor::request_cut () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
363 { |
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
|
364 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
|
365 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
366 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
367 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
|
368 file_editor::request_paste () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
369 { |
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
|
370 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
|
371 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
372 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
373 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
|
374 file_editor::request_save_file () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
375 { |
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
|
376 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
|
377 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
378 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
379 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
|
380 file_editor::request_save_file_as () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
381 { |
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
|
382 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
|
383 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
384 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
385 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
|
386 file_editor::request_run_file () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
387 { |
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
|
388 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
|
389 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
390 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
391 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
|
392 file_editor::request_toggle_bookmark () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
393 { |
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
|
394 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
|
395 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
396 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
397 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
|
398 file_editor::request_next_bookmark () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
399 { |
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
|
400 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
|
401 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
402 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
403 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
|
404 file_editor::request_previous_bookmark () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
405 { |
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
|
406 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
|
407 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
408 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
409 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
|
410 file_editor::request_remove_bookmark () |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
411 { |
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
|
412 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
|
413 } |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
414 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
415 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
|
416 file_editor::request_toggle_breakpoint () |
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
|
417 { |
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
|
418 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
|
419 } |
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
|
420 |
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
|
421 void |
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
|
422 file_editor::request_next_breakpoint () |
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
|
423 { |
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
|
424 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
|
425 } |
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
|
426 |
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
|
427 void |
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
|
428 file_editor::request_previous_breakpoint () |
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
|
429 { |
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
|
430 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
|
431 } |
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
|
432 |
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
|
433 void |
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
|
434 file_editor::request_remove_breakpoint () |
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
|
435 { |
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
|
436 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
|
437 } |
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
|
438 |
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
|
439 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
|
440 file_editor::request_comment_selected_text () |
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_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
|
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 |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
446 file_editor::request_uncomment_selected_text () |
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_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
|
449 } |
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
450 |
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
451 void |
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
452 file_editor::request_find () |
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
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_find (_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 |
16375
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
458 file_editor::request_goto_line () |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
459 { |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
460 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
|
461 } |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
462 |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
463 |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
464 void |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
465 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
|
466 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
467 _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
|
468 _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
|
469 mru_menu_update (); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
470 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
471 |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
472 void |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
473 file_editor::mru_menu_update () |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
474 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
475 int num_files = qMin (_mru_files.size(), int (MaxMRUFiles)); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
476 // 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
|
477 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
|
478 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
479 QString text = tr("&%1 %2"). |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
480 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
|
481 _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
|
482 _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
|
483 _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
|
484 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
485 // 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
|
486 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
|
487 _mru_file_actions[j]->setVisible (false); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
488 // 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
|
489 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
|
490 _mru_files.removeLast (); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
491 // 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
|
492 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
|
493 // 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
|
494 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
|
495 settings->sync (); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
496 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
497 |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
498 void |
16307
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
499 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
|
500 const QString& tip) |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
501 { |
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
|
502 QObject *fileEditorTab = sender(); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
503 if (fileEditorTab) |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
504 { |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
505 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
|
506 { |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
507 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
|
508 { |
16307
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
509 _tab_widget->setTabText (i, fname); |
f299079ed03a
avoid shadowed variable warning from GCC
John W. Eaton <jwe@octave.org>
parents:
16176
diff
changeset
|
510 _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
|
511 } |
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
|
512 } |
13524
8c143d6d0330
gui-editor: improved behaviour when closing a modified file
ttl (Torsten) <ttl@justmail.de>
parents:
13506
diff
changeset
|
513 } |
13501 | 514 } |
515 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
516 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
|
517 file_editor::handle_tab_close_request (int index) |
13529 | 518 { |
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
|
519 // 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
|
520 // 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
|
521 // 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
|
522 // 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
|
523 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
|
524 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
|
525 } |
424edeca3c66
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 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
527 void |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
528 file_editor::handle_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
|
529 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
530 QObject *fileEditorTab = sender(); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
531 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
|
532 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
533 for(int i = 0; i < _tab_widget->count (); 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
|
534 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
535 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
|
536 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
537 _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
|
538 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
|
539 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
540 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
541 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
542 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
543 |
424edeca3c66
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 void |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
545 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
|
546 { |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
547 // 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
|
548 |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
549 editor_tab_map[fileName] = ID; |
13501 | 550 } |
551 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
552 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
|
553 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
|
554 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
555 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
|
556 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
557 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
558 void |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
559 file_editor::handle_editor_state_changed (bool copy_available, 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
|
560 { |
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
|
561 // 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
|
562 // all the file editor tabs, just process info from the current active 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
|
563 if (sender() == _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
|
564 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
565 _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
|
566 _cut_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
|
567 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
|
568 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
569 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
|
570 int lastslash = ced.lastIndexOf ('/'); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
571 // 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
|
572 // 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
|
573 if (lastslash > 0 && lastslash != ced.count ()) |
424edeca3c66
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 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
575 ced = ced.left (lastslash); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
576 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
577 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
578 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
|
579 } |
424edeca3c66
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 } |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
581 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
582 void |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
583 file_editor::notice_settings () |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
584 { |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
585 // Relay signal to file editor tabs. |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
586 emit fetab_settings_changed (); |
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
|
587 } |
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
|
588 |
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
|
589 void |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
590 file_editor::construct () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
591 { |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
592 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
|
593 |
9cd14e53e906
eliminate some compiler warnings for GUI code
John W. Eaton <jwe@octave.org>
parents:
15873
diff
changeset
|
594 // 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
|
595 // QStyle *editor_style = QApplication::style (); |
13566
d22b9973120f
Renamed language files to match convention.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13562
diff
changeset
|
596 |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
597 _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
|
598 _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
|
599 _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
|
600 _tab_widget->setTabsClosable (true); |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
601 |
14727
f34984656658
Added crystal project icons.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14718
diff
changeset
|
602 QAction *new_action = new QAction (QIcon(":/actions/icons/filenew.png"), |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
603 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
|
604 |
14727
f34984656658
Added crystal project icons.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14718
diff
changeset
|
605 QAction *open_action = new QAction (QIcon(":/actions/icons/fileopen.png"), |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
606 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
|
607 |
14727
f34984656658
Added crystal project icons.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14718
diff
changeset
|
608 QAction *save_action = new QAction (QIcon(":/actions/icons/filesave.png"), |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
609 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
|
610 |
15045
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
611 QAction *save_as_action |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
612 = new QAction (QIcon(":/actions/icons/filesaveas.png"), |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
613 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
|
614 |
14727
f34984656658
Added crystal project icons.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14718
diff
changeset
|
615 QAction *undo_action = new QAction (QIcon(":/actions/icons/undo.png"), |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
616 tr("&Undo"), _tool_bar); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
617 |
14727
f34984656658
Added crystal project icons.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14718
diff
changeset
|
618 QAction *redo_action = new QAction (QIcon(":/actions/icons/redo.png"), |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
619 tr("&Redo"), _tool_bar); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
620 |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
621 _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
|
622 tr ("&Copy"), _tool_bar); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
623 |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
624 _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
|
625 tr ("Cu&t"), _tool_bar); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
626 |
14727
f34984656658
Added crystal project icons.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14718
diff
changeset
|
627 QAction *paste_action |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
628 = new QAction (QIcon (":/actions/icons/editpaste.png"), |
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
629 tr("Paste"), _tool_bar); |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
630 QAction *next_bookmark_action = new QAction (tr ("&Next Bookmark"),_tool_bar); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
631 QAction *previous_bookmark_action = new QAction (tr ("Pre&vious Bookmark"),_tool_bar); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
632 QAction *toggle_bookmark_action = new QAction (tr ("Toggle &Bookmark"),_tool_bar); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
633 QAction *remove_bookmark_action = 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
|
634 |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
635 QAction *next_breakpoint_action |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
636 = 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
|
637 tr ("&Next breakpoint"), _tool_bar); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
638 QAction *previous_breakpoint_action |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
639 = 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
|
640 tr ("Pre&vious breakpoint"), _tool_bar); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
641 QAction *toggle_breakpoint_action |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
642 = 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
|
643 tr ("Toggle &breakpoint"), _tool_bar); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
644 QAction *remove_all_breakpoints_action |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
645 = 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
|
646 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
|
647 |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
648 QAction *comment_selection_action = new QAction (tr ("&Comment Selected Text"),_tool_bar); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
649 QAction *uncomment_selection_action = new QAction (tr ("&Uncomment Selected Text"),_tool_bar); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
650 |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
651 QAction *find_action = new QAction (QIcon(":/actions/icons/find.png"), |
15105
f4ea22ef2beb
Incorporated patch that adds replace from Torsten and modified it.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15080
diff
changeset
|
652 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
|
653 |
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
|
654 _run_action = new QAction (QIcon(":/actions/icons/artsbuilderexecute.png"), |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
655 tr("Save File And Run"), _tool_bar); |
13501 | 656 |
16375
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
657 QAction *goto_line_action = new QAction (tr ("Go&to Line"), _tool_bar); |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
658 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
659 // 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
|
660 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
|
661 // 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
|
662 _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
|
663 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
|
664 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
665 _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
|
666 _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
|
667 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
668 |
13584 | 669 // some actions are disabled from the beginning |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
670 _copy_action->setEnabled(false); |
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
671 _cut_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
|
672 _run_action->setShortcut (Qt::ControlModifier+ Qt::Key_R); |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
673 _run_action->setShortcutContext (Qt::WindowShortcut); |
16176
74ba79f79fcc
gui: improve shortcuts for the editor (bug #38383) and for widget navigation
Torsten <ttl@justmail.de>
parents:
16175
diff
changeset
|
674 save_action->setShortcut (QKeySequence::Save); |
74ba79f79fcc
gui: improve shortcuts for the editor (bug #38383) and for widget navigation
Torsten <ttl@justmail.de>
parents:
16175
diff
changeset
|
675 save_action->setShortcutContext (Qt::WindowShortcut); |
74ba79f79fcc
gui: improve shortcuts for the editor (bug #38383) and for widget navigation
Torsten <ttl@justmail.de>
parents:
16175
diff
changeset
|
676 save_as_action->setShortcut (QKeySequence::SaveAs); |
74ba79f79fcc
gui: improve shortcuts for the editor (bug #38383) and for widget navigation
Torsten <ttl@justmail.de>
parents:
16175
diff
changeset
|
677 save_as_action->setShortcutContext (Qt::WindowShortcut); |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
678 next_bookmark_action->setShortcut (Qt::Key_F2); |
14785
7e41fcbb23a4
Fixed shortcuts in file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14778
diff
changeset
|
679 next_bookmark_action->setShortcutContext (Qt::WindowShortcut); |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
680 previous_bookmark_action->setShortcut (Qt::SHIFT + Qt::Key_F2); |
14785
7e41fcbb23a4
Fixed shortcuts in file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14778
diff
changeset
|
681 previous_bookmark_action->setShortcutContext (Qt::WindowShortcut); |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
682 toggle_bookmark_action->setShortcut (Qt::Key_F7); |
14785
7e41fcbb23a4
Fixed shortcuts in file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14778
diff
changeset
|
683 toggle_bookmark_action->setShortcutContext (Qt::WindowShortcut); |
14812
9d9eb9bac65e
Improved menu structure of file, edit and window menu. Removed ambiguous shortcuts, improved focus handling for operating the GUI with the keyboard. Added new shortcuts to focus subwindows directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14795
diff
changeset
|
684 comment_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_7); |
14785
7e41fcbb23a4
Fixed shortcuts in file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14778
diff
changeset
|
685 comment_selection_action->setShortcutContext (Qt::WindowShortcut); |
14812
9d9eb9bac65e
Improved menu structure of file, edit and window menu. Removed ambiguous shortcuts, improved focus handling for operating the GUI with the keyboard. Added new shortcuts to focus subwindows directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14795
diff
changeset
|
686 uncomment_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_8); |
14785
7e41fcbb23a4
Fixed shortcuts in file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14778
diff
changeset
|
687 uncomment_selection_action->setShortcutContext(Qt::WindowShortcut); |
16176
74ba79f79fcc
gui: improve shortcuts for the editor (bug #38383) and for widget navigation
Torsten <ttl@justmail.de>
parents:
16175
diff
changeset
|
688 find_action->setShortcut (QKeySequence::Find); |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
689 find_action->setShortcutContext (Qt::WindowShortcut); |
16389
f5204f486a29
gui: add shortcut for goto line action in the editor and center the target line
Torsten <ttl@justmail.de>
parents:
16386
diff
changeset
|
690 goto_line_action->setShortcut (Qt::ControlModifier+ Qt::Key_G); |
f5204f486a29
gui: add shortcut for goto line action in the editor and center the target line
Torsten <ttl@justmail.de>
parents:
16386
diff
changeset
|
691 goto_line_action->setShortcutContext (Qt::WindowShortcut); |
13556
0d18b0e168ae
editor: shortcuts for toolbar actions, window icon
ttl <ttl@justmail.de>
parents:
13555
diff
changeset
|
692 |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
693 // toolbar |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
694 _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
|
695 _tool_bar->addAction (open_action); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
696 _tool_bar->addAction (save_action); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
697 _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
|
698 _tool_bar->addSeparator (); |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
699 _tool_bar->addAction (undo_action); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
700 _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
|
701 _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
|
702 _tool_bar->addAction (_cut_action); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
703 _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
|
704 _tool_bar->addSeparator (); |
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
705 _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
|
706 _tool_bar->addAction (_run_action); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
707 _tool_bar->addSeparator (); |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
708 _tool_bar->addAction (toggle_breakpoint_action); |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
709 _tool_bar->addAction (next_breakpoint_action); |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
710 _tool_bar->addAction (previous_breakpoint_action); |
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
711 _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
|
712 |
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
|
713 // 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
|
714 QMenu *fileMenu = new QMenu (tr ("&File"), _menu_bar); |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
715 fileMenu->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
|
716 fileMenu->addAction (open_action); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
717 fileMenu->addAction (save_action); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
718 fileMenu->addAction (save_as_action); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
719 fileMenu->addSeparator (); |
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
|
720 _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
|
721 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
|
722 { |
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
|
723 _mru_file_menu->addAction (_mru_file_actions[i]); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
724 } |
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
|
725 fileMenu->addMenu (_mru_file_menu); |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
726 _menu_bar->addMenu (fileMenu); |
13501 | 727 |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
728 QMenu *editMenu = new QMenu (tr ("&Edit"), _menu_bar); |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
729 editMenu->addAction (undo_action); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
730 editMenu->addAction (redo_action); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
731 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
|
732 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
|
733 editMenu->addAction (_cut_action); |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
734 editMenu->addAction (paste_action); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
735 editMenu->addSeparator (); |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
736 editMenu->addAction (find_action); |
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
737 editMenu->addSeparator (); |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
738 editMenu->addAction (comment_selection_action); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
739 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
|
740 editMenu->addSeparator (); |
14718
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
741 editMenu->addAction (toggle_bookmark_action); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
742 editMenu->addAction (next_bookmark_action); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
743 editMenu->addAction (previous_bookmark_action); |
3df7ef0080c7
Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14715
diff
changeset
|
744 editMenu->addAction (remove_bookmark_action); |
16375
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
745 editMenu->addSeparator (); |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
746 editMenu->addAction (goto_line_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
|
747 _menu_bar->addMenu (editMenu); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
748 |
14778
f43916137064
Added debug menu to file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
749 _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
|
750 _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
|
751 _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
|
752 _debug_menu->addAction (previous_breakpoint_action); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
753 _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
|
754 _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
|
755 // 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
|
756 _menu_bar->addMenu (_debug_menu); |
f43916137064
Added debug menu to file editor.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
757 |
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
|
758 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
|
759 _run_menu->addAction (_run_action); |
41b86dc61306
Removed run command, instead cding into the script directory and executing script directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14829
diff
changeset
|
760 _menu_bar->addMenu (_run_menu); |
13566
d22b9973120f
Renamed language files to match convention.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13562
diff
changeset
|
761 |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
762 QVBoxLayout *vbox_layout = new QVBoxLayout (); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
763 vbox_layout->addWidget (_menu_bar); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
764 vbox_layout->addWidget (_tool_bar); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
765 vbox_layout->addWidget (_tab_widget); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
766 vbox_layout->setMargin (0); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
767 editor_widget->setLayout (vbox_layout); |
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
768 setWidget (editor_widget); |
13501 | 769 |
15045
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
770 connect (new_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
771 SIGNAL (triggered ()), this, SLOT (request_new_file ())); |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
772 connect (open_action, |
15045
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
773 SIGNAL (triggered ()), this, SLOT (request_open_file ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
774 connect (undo_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
775 SIGNAL (triggered ()), this, SLOT (request_undo ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
776 connect (redo_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
777 SIGNAL (triggered ()), this, SLOT (request_redo ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
778 connect (_copy_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
779 SIGNAL (triggered ()), this, SLOT (request_copy ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
780 connect (_cut_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
781 SIGNAL (triggered ()), this, SLOT (request_cut ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
782 connect (paste_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
783 SIGNAL (triggered ()), this, SLOT (request_paste ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
784 connect (save_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
785 SIGNAL (triggered ()), this, SLOT (request_save_file ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
786 connect (save_as_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
787 SIGNAL (triggered ()), this, SLOT (request_save_file_as ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
788 connect (_run_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
789 SIGNAL (triggered ()), this, SLOT (request_run_file ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
790 connect (toggle_bookmark_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
791 SIGNAL (triggered ()), this, SLOT (request_toggle_bookmark ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
792 connect (next_bookmark_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
793 SIGNAL (triggered ()), this, SLOT (request_next_bookmark ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
794 connect (previous_bookmark_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
795 SIGNAL (triggered ()), this, SLOT (request_previous_bookmark ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
796 connect (remove_bookmark_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
797 SIGNAL (triggered ()), this, SLOT (request_remove_bookmark ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
798 connect (toggle_breakpoint_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
799 SIGNAL (triggered ()), this, SLOT (request_toggle_breakpoint ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
800 connect (next_breakpoint_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
801 SIGNAL (triggered ()), this, SLOT (request_next_breakpoint ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
802 connect (previous_breakpoint_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
803 SIGNAL (triggered ()), this, SLOT (request_previous_breakpoint ())); |
15106
59175df7dcf6
Created and added debug action icons.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15105
diff
changeset
|
804 connect (remove_all_breakpoints_action, |
15045
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
805 SIGNAL (triggered ()), this, SLOT (request_remove_breakpoint ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
806 connect (comment_selection_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
807 SIGNAL (triggered ()), this, SLOT (request_comment_selected_text ())); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
808 connect (uncomment_selection_action, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
809 SIGNAL (triggered ()), this, SLOT (request_uncomment_selected_text ())); |
15080
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
810 connect (find_action, |
4c4f2fb07a50
Added find functionality in editor by to.lil.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15045
diff
changeset
|
811 SIGNAL (triggered ()), this, SLOT (request_find ())); |
16375
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
812 |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
813 connect (goto_line_action, |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
814 SIGNAL (triggered ()), this, SLOT (request_goto_line ())); |
f482302d81c9
editor goto line menu item (bug #38590)
John Donoghue <john.donoghue@ieee.org>
parents:
16307
diff
changeset
|
815 |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
816 // The actions of the mru file menu |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
817 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
|
818 { |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
819 connect(_mru_file_actions[i], SIGNAL (triggered ()), this, SLOT (request_mru_open_file ())); |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
820 } |
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
821 mru_menu_update (); |
15045
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
822 connect (_tab_widget, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
823 SIGNAL (tabCloseRequested (int)), this, SLOT (handle_tab_close_request (int))); |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
824 connect (_tab_widget, |
1ffaad442161
Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14874
diff
changeset
|
825 SIGNAL (currentChanged(int)), 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
|
826 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
827 resize (500, 400); |
15552
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15425
diff
changeset
|
828 setWindowIcon (QIcon(":/actions/icons/logo.png")); |
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15425
diff
changeset
|
829 setWindowTitle ("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
|
830 |
842ab161c10a
GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents:
15321
diff
changeset
|
831 //restore previous session |
842ab161c10a
GUI: new setting to restore tabs from previous session; allow silent load file
Thorsten Liebig <Thorsten.Liebig@gmx.de>
parents:
15321
diff
changeset
|
832 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
|
833 { |
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
834 QStringList sessionFileNames = 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
|
835 |
15425
8ae34ffe5c1b
Retain QsciAPIs lexer_api as part of lexer_octave_gui object (bug #37359)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15389
diff
changeset
|
836 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
|
837 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
|
838 } |
13501 | 839 } |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
840 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
841 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
|
842 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
|
843 { |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
844 _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
|
845 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
846 // 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
|
847 connect (f, SIGNAL (file_name_changed (const QString&, const QString&)), |
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
|
848 this, SLOT (handle_file_name_changed (const QString&, const QString&))); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
849 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
|
850 this, SLOT (handle_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
|
851 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
|
852 this, SLOT (handle_tab_remove_request ())); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
853 connect (f, SIGNAL (add_filename_to_list (const QString&, QWidget *)), |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
854 this, SLOT (handle_add_filename_to_list (const QString&, QWidget *))); |
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
|
855 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
|
856 this, SLOT (check_conflict_save (const QString&, bool))); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
857 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
|
858 this, SLOT (handle_mru_add_file (const QString&))); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
859 connect (f, SIGNAL (process_octave_code (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
|
860 parent (), SLOT (handle_command_double_clicked (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
|
861 |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
862 // Signals from the file_editor non-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
|
863 connect (this, SIGNAL (fetab_settings_changed ()), |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
864 f, SLOT (notice_settings ())); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15552
diff
changeset
|
865 connect (this, SIGNAL (fetab_close_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
|
866 f, SLOT (conditional_close (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
|
867 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
|
868 f, SLOT (change_editor_state (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
|
869 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
|
870 f, SLOT (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
|
871 connect (this, SIGNAL (fetab_save_file (const QWidget*, 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
|
872 f, SLOT (save_file (const QWidget*, 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
|
873 // 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
|
874 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
|
875 f, SLOT (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
|
876 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
|
877 f, SLOT (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
|
878 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
|
879 f, SLOT (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
|
880 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
|
881 f, SLOT (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
|
882 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
|
883 f, SLOT (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
|
884 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
|
885 f, SLOT (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
|
886 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
|
887 f, SLOT (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
|
888 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
|
889 f, SLOT (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
|
890 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
|
891 f, SLOT (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
|
892 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
|
893 f, SLOT (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
|
894 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
|
895 f, SLOT (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
|
896 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
|
897 f, SLOT (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
|
898 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
|
899 f, SLOT (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
|
900 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
|
901 f, SLOT (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
|
902 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
|
903 f, SLOT (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
|
904 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
|
905 f, SLOT (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
|
906 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
|
907 f, SLOT (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
|
908 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
|
909 f, SLOT (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
|
910 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
|
911 f, SLOT (find (const QWidget*))); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
912 connect (this, SIGNAL (fetab_goto_line (const QWidget *, int)), |
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
913 f, SLOT (goto_line (const QWidget *, int))); |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15901
diff
changeset
|
914 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
|
915 f, SLOT (set_focus (const QWidget*))); |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
916 connect (this, SIGNAL (fetab_insert_debugger_pointer (const QWidget *, int)), |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
917 f, SLOT (insert_debugger_pointer (const QWidget *, int))); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
918 connect (this, SIGNAL (fetab_delete_debugger_pointer (const QWidget *, int)), |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
919 f, SLOT (delete_debugger_pointer (const QWidget *, int))); |
16386
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
920 connect (this, SIGNAL (fetab_do_dbstop_marker (bool, const QWidget *, int)), |
4902484f9181
callbacks to set markers in editor using command line dbstop function
John W. Eaton <jwe@octave.org>
parents:
16383
diff
changeset
|
921 f, SLOT (do_dbstop_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
|
922 |
14715
b4db843b1f26
Done some extra method renaming to fit the overall octave coding style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
923 _tab_widget->setCurrentWidget (f); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14674
diff
changeset
|
924 } |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15861
diff
changeset
|
925 |
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15861
diff
changeset
|
926 #endif |