Mercurial > octave
annotate libgui/src/main-window.cc @ 16455:38ed6bdd1f7f
move signal/slot connections from main window to sub window where possible
* main-window.cc (main_window::construct): Move the following
signal/slot connections to their respective sub-windows.
main_window::settings_changed to _file_editor::notice_settings.
main_window::settings_changed to command_window::notice_settings.
main_window::settings_changed to
file_browser_window::notice_settings.
file_browser_window::open_file to main_window::open_file.
file_browser_window::displayed_directory_changed to
main_window::set_current_working_directory.
main_window::relay_command_signal to command_window::relay_command.
history_window::command_create_script to main_window::new_file.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 07 Apr 2013 04:29:10 -0400 |
parents | 246d25c8761b |
children | 203efbbcea63 |
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 |
16447
e3b33a7530bc
improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents:
16446
diff
changeset
|
3 Copyright (C) 2013 John W. Eaton |
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
4 Copyright (C) 2011-2012 Jacob Dawid |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
5 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
6 This file is part of Octave. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
7 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
8 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
|
9 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
|
10 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
|
11 option) any later version. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
12 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
13 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
|
14 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
|
15 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
|
16 for more details. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
17 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
18 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
|
19 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
|
20 <http://www.gnu.org/licenses/>. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
21 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
22 */ |
13501 | 23 |
15286
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15274
diff
changeset
|
24 #ifdef HAVE_CONFIG_H |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15274
diff
changeset
|
25 #include <config.h> |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15274
diff
changeset
|
26 #endif |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15274
diff
changeset
|
27 |
15257
7ee62f559a73
Fix compilation under Windows with GUI and LLVM enabled.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15204
diff
changeset
|
28 #include <QApplication> |
7ee62f559a73
Fix compilation under Windows with GUI and LLVM enabled.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15204
diff
changeset
|
29 #include <QLabel> |
13501 | 30 #include <QMenuBar> |
31 #include <QMenu> | |
32 #include <QAction> | |
33 #include <QSettings> | |
14670
7fbea449737d
Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14669
diff
changeset
|
34 #include <QStyle> |
7fbea449737d
Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14669
diff
changeset
|
35 #include <QToolBar> |
13501 | 36 #include <QDesktopServices> |
16391
a695ee2dc17e
* main-window.cc: Include <QDesktopWidget>
John W. Eaton <jwe@octave.org>
parents:
16386
diff
changeset
|
37 #include <QDesktopWidget> |
13501 | 38 #include <QFileDialog> |
13626
cc90c62ada21
Removed terminal, instead now using QPlainTextEdit, which looks much nicer and is not that error-prone...
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13620
diff
changeset
|
39 #include <QMessageBox> |
14670
7fbea449737d
Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14669
diff
changeset
|
40 #include <QIcon> |
7fbea449737d
Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14669
diff
changeset
|
41 |
16290
d07aeecb2d22
build: Add more #ifdefs to build GUI when Qscintilla is not present.
Rik <rik@octave.org>
parents:
16176
diff
changeset
|
42 #ifdef HAVE_QSCINTILLA |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
43 #include "file-editor.h" |
16290
d07aeecb2d22
build: Add more #ifdefs to build GUI when Qscintilla is not present.
Rik <rik@octave.org>
parents:
16176
diff
changeset
|
44 #endif |
14707
674740c44c09
Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14703
diff
changeset
|
45 #include "main-window.h" |
674740c44c09
Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14703
diff
changeset
|
46 #include "settings-dialog.h" |
13501 | 47 |
15420
1249a615c91b
call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents:
15404
diff
changeset
|
48 #include "builtins.h" |
15404
f52a62a6db3a
eliminate copy and paste copyright info in GUI about info box
John W. Eaton <jwe@octave.org>
parents:
15402
diff
changeset
|
49 #include "defaults.h" |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
50 #include "load-save.h" |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
51 #include "toplev.h" |
15404
f52a62a6db3a
eliminate copy and paste copyright info in GUI about info box
John W. Eaton <jwe@octave.org>
parents:
15402
diff
changeset
|
52 #include "version.h" |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
53 |
16382
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
54 #include "cmd-edit.h" |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
55 #include "cmd-hist.h" |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
56 #include "oct-env.h" |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
57 |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
58 main_window::main_window (QWidget *p) |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
59 : QMainWindow (p), |
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
60 _workspace_model (new workspace_model ()), |
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
61 status_bar (new QStatusBar ()), |
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
62 command_window (new terminal_dock_widget (this)), |
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
63 history_window (new history_dock_widget (this)), |
16453
2e3c652c89d1
improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
64 file_browser_window (new files_dock_widget (this)), |
2e3c652c89d1
improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
65 doc_browser_window (new documentation_dock_widget (this)) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
66 { |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14588
diff
changeset
|
67 // We have to set up all our windows, before we finally launch octave. |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
68 construct (); |
13501 | 69 } |
70 | |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
71 main_window::~main_window () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
72 { |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
73 delete _workspace_model; |
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
74 delete status_bar; |
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
75 delete command_window; |
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
76 delete history_window; |
16450
3207f1d62e74
improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents:
16449
diff
changeset
|
77 delete file_browser_window; |
16453
2e3c652c89d1
improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
78 delete doc_browser_window; |
16450
3207f1d62e74
improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents:
16449
diff
changeset
|
79 |
15607
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
80 // Clean up all dynamically created objects to ensure they are |
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
81 // deleted before this main_window is. Otherwise, some will be |
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
82 // attached to a non-existent parent. |
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
83 |
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
84 if (_octave_qt_event_listener) |
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
85 delete _octave_qt_event_listener; |
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
86 |
16421
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
87 octave_link::connect_link (0); |
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
88 delete _octave_qt_link; |
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
89 |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
90 #ifdef HAVE_QSCINTILLA |
15607
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
91 if (_file_editor) |
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
92 delete _file_editor; |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
93 #endif |
15607
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
94 |
16445
3f8d3fc907af
store workspace model in main_window, not in workspace view
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
95 delete _workspace_view; |
13501 | 96 } |
97 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
98 void |
16449
c129a8b73d25
avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents:
16448
diff
changeset
|
99 main_window::focus_command_window (void) |
c129a8b73d25
avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents:
16448
diff
changeset
|
100 { |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
101 command_window->focus (); |
16449
c129a8b73d25
avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents:
16448
diff
changeset
|
102 } |
c129a8b73d25
avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents:
16448
diff
changeset
|
103 |
c129a8b73d25
avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents:
16448
diff
changeset
|
104 void |
16452
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16451
diff
changeset
|
105 main_window::new_file (const QString& commands) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
106 { |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
107 #ifdef HAVE_QSCINTILLA |
16452
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16451
diff
changeset
|
108 _file_editor->request_new_file (commands); |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
109 #endif |
13501 | 110 } |
111 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
112 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
113 main_window::open_file () |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13550
diff
changeset
|
114 { |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
115 #ifdef HAVE_QSCINTILLA |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
116 _file_editor->request_open_file (); |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
117 #endif |
14875
3fd857c284fe
Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14831
diff
changeset
|
118 } |
3fd857c284fe
Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14831
diff
changeset
|
119 |
3fd857c284fe
Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14831
diff
changeset
|
120 void |
15300
fd27e10b9b05
pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents:
15286
diff
changeset
|
121 main_window::open_file (const QString& file_name) |
14875
3fd857c284fe
Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14831
diff
changeset
|
122 { |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
123 #ifdef HAVE_QSCINTILLA |
14875
3fd857c284fe
Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14831
diff
changeset
|
124 _file_editor->request_open_file (file_name); |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
125 #endif |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13550
diff
changeset
|
126 } |
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13550
diff
changeset
|
127 |
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13550
diff
changeset
|
128 void |
15300
fd27e10b9b05
pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents:
15286
diff
changeset
|
129 main_window::report_status_message (const QString& statusMessage) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
130 { |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
131 status_bar->showMessage (statusMessage, 1000); |
13501 | 132 } |
133 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
134 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
135 main_window::handle_save_workspace_request () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
136 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
137 QString selectedFile = |
16176
74ba79f79fcc
gui: improve shortcuts for the editor (bug #38383) and for widget navigation
Torsten <ttl@justmail.de>
parents:
15993
diff
changeset
|
138 QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
139 resource_manager::get_home_path ()); |
14824
9c0959a1dc7b
Not attempint to save workspace when no filename provided.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14814
diff
changeset
|
140 if (!selectedFile.isEmpty ()) |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
141 octave_link::post_event (this, &main_window::save_workspace_callback, |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
142 selectedFile.toStdString ()); |
13501 | 143 } |
144 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
145 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
146 main_window::handle_load_workspace_request () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
147 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
148 QString selectedFile = |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
149 QFileDialog::getOpenFileName (this, tr ("Load Workspace"), |
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
150 resource_manager::get_home_path ()); |
14682
9ea75ea686b5
Allowing nested dock widgets and fixed small bug in loading a workspace.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14681
diff
changeset
|
151 if (!selectedFile.isEmpty ()) |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
152 octave_link::post_event (this, &main_window::load_workspace_callback, |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
153 selectedFile.toStdString ()); |
13501 | 154 } |
155 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
156 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
157 main_window::handle_clear_workspace_request () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
158 { |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
159 octave_link::post_event (this, &main_window::clear_workspace_callback); |
13501 | 160 } |
161 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
162 void |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
163 main_window::handle_clear_history_request (void) |
14814
61c80e9326a8
Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14813
diff
changeset
|
164 { |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
165 octave_link::post_event (this, &main_window::clear_history_callback); |
14814
61c80e9326a8
Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14813
diff
changeset
|
166 } |
61c80e9326a8
Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14813
diff
changeset
|
167 |
61c80e9326a8
Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14813
diff
changeset
|
168 void |
16446
4b3a4bf8569b
improve encapsulation of command window object
John W. Eaton <jwe@octave.org>
parents:
16445
diff
changeset
|
169 main_window::handle_command_double_clicked (const QString& command) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
170 { |
16446
4b3a4bf8569b
improve encapsulation of command window object
John W. Eaton <jwe@octave.org>
parents:
16445
diff
changeset
|
171 emit relay_command_signal (command); |
16449
c129a8b73d25
avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents:
16448
diff
changeset
|
172 |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
173 command_window->focus (); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
174 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
175 |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
176 void |
15989
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
177 main_window::open_online_documentation_page () |
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
178 { |
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
179 QDesktopServices::openUrl (QUrl ("http://gnu.org/software/octave/doc/interpreter")); |
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
180 } |
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
181 |
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
182 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
183 main_window::open_bug_tracker_page () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
184 { |
15044
b7b1ffc88086
Update urls to Agora and bug tracker
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15041
diff
changeset
|
185 QDesktopServices::openUrl (QUrl ("http://bugs.octave.org")); |
13501 | 186 } |
187 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
188 void |
15989
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
189 main_window::open_octave_forge_page () |
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
190 { |
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
191 QDesktopServices::openUrl (QUrl ("http://octave.sourceforge.net/")); |
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
192 } |
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
193 |
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
194 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
195 main_window::open_agora_page () |
13533
edaf8e72070e
Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13532
diff
changeset
|
196 { |
15044
b7b1ffc88086
Update urls to Agora and bug tracker
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15041
diff
changeset
|
197 QDesktopServices::openUrl (QUrl ("http://agora.octave.org/")); |
13533
edaf8e72070e
Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13532
diff
changeset
|
198 } |
edaf8e72070e
Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13532
diff
changeset
|
199 |
edaf8e72070e
Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13532
diff
changeset
|
200 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
201 main_window::process_settings_dialog_request () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
202 { |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
203 settings_dialog *settingsDialog = new settings_dialog (this); |
15274
c5d09a57ceb2
provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents:
15257
diff
changeset
|
204 int change_settings = settingsDialog->exec (); |
c5d09a57ceb2
provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents:
15257
diff
changeset
|
205 if (change_settings == QDialog::Accepted) |
c5d09a57ceb2
provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents:
15257
diff
changeset
|
206 { |
c5d09a57ceb2
provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents:
15257
diff
changeset
|
207 settingsDialog->write_changed_settings (); |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
208 QSettings *settings = resource_manager::get_settings (); |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
209 if (settings) |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
210 emit settings_changed (settings); |
15274
c5d09a57ceb2
provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents:
15257
diff
changeset
|
211 } |
14586
8e9823066dad
Fixed bug with not correctly syncing settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14308
diff
changeset
|
212 delete settingsDialog; |
14588
fa52c6e84ae0
Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents:
14586
diff
changeset
|
213 } |
fa52c6e84ae0
Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents:
14586
diff
changeset
|
214 |
15914
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
215 |
14588
fa52c6e84ae0
Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents:
14586
diff
changeset
|
216 void |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
217 main_window::notice_settings (const QSettings *settings) |
14588
fa52c6e84ae0
Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents:
14586
diff
changeset
|
218 { |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
219 // QSettings pointer is checked before emitting. |
14998
de3a318128f2
Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14996
diff
changeset
|
220 |
15787
b081fbe80174
provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents:
15758
diff
changeset
|
221 // the widget's icons (when floating) |
15914
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
222 QString icon_set = settings->value ("DockWidgets/widget_icon_set","NONE"). |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
223 toString (); |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
224 static struct |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
225 { |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
226 QString name; |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
227 QString path; |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
228 } |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
229 widget_icon_data[] = |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
230 { // array of possible icon sets (name, path (complete for NONE)) |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
231 // the first entry here is the default! |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
232 {"NONE", ":/actions/icons/logo.png"}, |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
233 {"GRAPHIC", ":/actions/icons/graphic_logo_"}, |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
234 {"LETTER", ":/actions/icons/letter_logo_"}, |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
235 {"", ""} // end marker has empty name |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
236 }; |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
237 int count = 0; |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
238 int icon_set_found = 0; // default |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
239 while (!widget_icon_data[count].name.isEmpty ()) |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
240 { // while not end of data |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
241 if (widget_icon_data[count].name == icon_set) |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
242 { // data of desired icon set found |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
243 icon_set_found = count; |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
244 break; |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
245 } |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
246 count++; |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
247 } |
15787
b081fbe80174
provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents:
15758
diff
changeset
|
248 QString icon; |
b081fbe80174
provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents:
15758
diff
changeset
|
249 foreach (QObject *obj, children ()) |
b081fbe80174
provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents:
15758
diff
changeset
|
250 { |
b081fbe80174
provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents:
15758
diff
changeset
|
251 QString name = obj->objectName (); |
b081fbe80174
provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents:
15758
diff
changeset
|
252 if (obj->inherits("QDockWidget") && ! name.isEmpty ()) |
b081fbe80174
provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents:
15758
diff
changeset
|
253 { // if children is a dockwidget with a name |
b081fbe80174
provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents:
15758
diff
changeset
|
254 QDockWidget *widget = qobject_cast<QDockWidget *> (obj); |
15914
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
255 icon = widget_icon_data[icon_set_found].path; // prefix or octave-logo |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
256 if (widget_icon_data[icon_set_found].name != "NONE") |
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
257 icon = icon + name + ".png"; // add widget name and ext. |
15787
b081fbe80174
provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents:
15758
diff
changeset
|
258 widget->setWindowIcon (QIcon (icon)); |
b081fbe80174
provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents:
15758
diff
changeset
|
259 } |
b081fbe80174
provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents:
15758
diff
changeset
|
260 } |
b081fbe80174
provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents:
15758
diff
changeset
|
261 |
15164
bc801a44bb1f
follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents:
15106
diff
changeset
|
262 resource_manager::update_network_settings (); |
13501 | 263 } |
264 | |
15914
85f9aca30c76
gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents:
15900
diff
changeset
|
265 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
266 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
267 main_window::prepare_for_quit () |
14693
c952f1e35e50
Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14692
diff
changeset
|
268 { |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
269 write_settings (); |
14693
c952f1e35e50
Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14692
diff
changeset
|
270 } |
c952f1e35e50
Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14692
diff
changeset
|
271 |
c952f1e35e50
Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14692
diff
changeset
|
272 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
273 main_window::reset_windows () |
14700
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
274 { |
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
275 // TODO: Implement. |
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
276 } |
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
277 |
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
278 void |
16350
d4b6ad43bc87
use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents:
16290
diff
changeset
|
279 main_window::update_workspace (void) |
d4b6ad43bc87
use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents:
16290
diff
changeset
|
280 { |
d4b6ad43bc87
use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents:
16290
diff
changeset
|
281 _workspace_view->model_changed (); |
d4b6ad43bc87
use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents:
16290
diff
changeset
|
282 } |
d4b6ad43bc87
use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents:
16290
diff
changeset
|
283 |
d4b6ad43bc87
use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents:
16290
diff
changeset
|
284 void |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
285 main_window::change_directory (const QString& dir) |
14700
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
286 { |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
287 // Remove existing entry, if any, then add new directory at top and |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
288 // mark it as the current directory. Finally, update the file list |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
289 // widget. |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
290 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
291 int index = _current_directory_combo_box->findText (dir); |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
292 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
293 if (index >= 0) |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
294 _current_directory_combo_box->removeItem (index); |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
295 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
296 _current_directory_combo_box->insertItem (0, dir); |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
297 _current_directory_combo_box->setCurrentIndex (0); |
14700
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
298 |
16450
3207f1d62e74
improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents:
16449
diff
changeset
|
299 file_browser_window->display_directory (dir); |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
300 } |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
301 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
302 void |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
303 main_window::browse_for_directory (void) |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
304 { |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
305 QString dir = |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
306 QFileDialog::getExistingDirectory (this, tr ("Set working directory")); |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
307 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
308 if (! dir.isEmpty ()) |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
309 octave_link::post_event (this, |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
310 &main_window::change_directory_callback, |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
311 dir.toStdString ()); |
14700
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
312 } |
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
313 |
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
314 void |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
315 main_window::set_current_working_directory (const QString& dir) |
14700
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
316 { |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
317 // Change to dir if it is an existing directory. |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
318 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
319 QString xdir = dir.isEmpty () ? "." : dir; |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
320 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
321 QFileInfo fileInfo (xdir); |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
322 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
323 if (fileInfo.exists () && fileInfo.isDir ()) |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
324 octave_link::post_event (this, &main_window::change_directory_callback, |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
325 xdir.toStdString ()); |
14700
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
326 } |
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
327 |
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
328 void |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
329 main_window::change_directory_up (void) |
14700
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
330 { |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
331 QDir dir (".."); |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
332 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
333 set_current_working_directory (dir.absolutePath ()); |
14700
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
334 } |
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
335 |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
336 // Slot that is called if return is pressed in the line edit of the |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
337 // combobox to change to a new directory or a directory that is already |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
338 // in the drop down list. |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
339 |
15626
1cc10ce368ea
enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents:
15607
diff
changeset
|
340 void |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
341 main_window::accept_directory_line_edit (void) |
15626
1cc10ce368ea
enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents:
15607
diff
changeset
|
342 { |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
343 // Get new directory name, and change to it if it is new. Otherwise, |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
344 // the combo box will triggers the "activated" signal to change to the |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
345 // directory. |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
346 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
347 QString dir = _current_directory_line_edit->text (); |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
348 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
349 int index = _current_directory_combo_box->findText (dir); |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
350 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
351 if (index < 0) |
15626
1cc10ce368ea
enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents:
15607
diff
changeset
|
352 set_current_working_directory (dir); |
1cc10ce368ea
enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents:
15607
diff
changeset
|
353 } |
1cc10ce368ea
enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents:
15607
diff
changeset
|
354 |
14726
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
355 void |
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:
14804
diff
changeset
|
356 main_window::focus_workspace () |
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:
14804
diff
changeset
|
357 { |
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:
14804
diff
changeset
|
358 if (!_workspace_view->isVisible ()) |
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:
14804
diff
changeset
|
359 { |
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:
14804
diff
changeset
|
360 _workspace_view->setVisible (true); |
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:
14804
diff
changeset
|
361 } |
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:
14804
diff
changeset
|
362 |
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:
14804
diff
changeset
|
363 _workspace_view->setFocus (); |
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:
14804
diff
changeset
|
364 _workspace_view->activateWindow (); |
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:
14804
diff
changeset
|
365 _workspace_view->raise (); |
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:
14804
diff
changeset
|
366 } |
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:
14804
diff
changeset
|
367 |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
368 |
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:
14804
diff
changeset
|
369 void |
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:
14804
diff
changeset
|
370 main_window::focus_editor () |
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:
14804
diff
changeset
|
371 { |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
372 #ifdef HAVE_QSCINTILLA |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
373 // call own function of editor in order to set focus to the current editor tab |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
374 _file_editor->set_focus (); |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
375 #endif |
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:
14804
diff
changeset
|
376 } |
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:
14804
diff
changeset
|
377 |
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:
14804
diff
changeset
|
378 void |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
379 main_window::handle_workspace_visible (bool visible) |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
380 { |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
381 // if changed to visible and widget is not floating |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
382 if (visible && !_workspace_view->isFloating ()) |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
383 focus_workspace (); |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
384 } |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
385 |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
386 void |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
387 main_window::handle_editor_visible (bool visible) |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
388 { |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
389 // if changed to visible and widget is not floating |
15983
200dab2eecd4
gui: complete changeset 6c0fce0632a4 with #ifdef HAVE_QSCINTILLA for editor
Torsten <ttl@justmail.de>
parents:
15980
diff
changeset
|
390 #ifdef HAVE_QSCINTILLA |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
391 if (visible && !_file_editor->isFloating ()) |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
392 focus_editor (); |
15983
200dab2eecd4
gui: complete changeset 6c0fce0632a4 with #ifdef HAVE_QSCINTILLA for editor
Torsten <ttl@justmail.de>
parents:
15980
diff
changeset
|
393 #endif |
15980
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
394 } |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
395 |
6c0fce0632a4
gui: set keyboard focus when switching between dock widgets (bug #36957)
Torsten <ttl@justmail.de>
parents:
15914
diff
changeset
|
396 void |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
397 main_window::handle_enter_debugger (void) |
14726
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
398 { |
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
399 setWindowTitle ("Octave (Debugging)"); |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
400 |
14795
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14784
diff
changeset
|
401 _debug_continue->setEnabled (true); |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14784
diff
changeset
|
402 _debug_step_into->setEnabled (true); |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14784
diff
changeset
|
403 _debug_step_over->setEnabled (true); |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14784
diff
changeset
|
404 _debug_step_out->setEnabled (true); |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14784
diff
changeset
|
405 _debug_quit->setEnabled (true); |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
406 |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
407 #ifdef HAVE_QSCINTILLA |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
408 _file_editor->handle_enter_debug_mode (); |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
409 #endif |
14726
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
410 } |
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
411 |
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
412 void |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
413 main_window::handle_exit_debugger (void) |
14726
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
414 { |
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
415 setWindowTitle ("Octave"); |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
416 |
14795
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14784
diff
changeset
|
417 _debug_continue->setEnabled (false); |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14784
diff
changeset
|
418 _debug_step_into->setEnabled (false); |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14784
diff
changeset
|
419 _debug_step_over->setEnabled (false); |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14784
diff
changeset
|
420 _debug_step_out->setEnabled (false); |
e3ae0850b105
Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14784
diff
changeset
|
421 _debug_quit->setEnabled (false); |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
422 |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
423 #ifdef HAVE_QSCINTILLA |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
424 _file_editor->handle_exit_debug_mode (); |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
425 #endif |
14752
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
426 } |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
427 |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
428 void |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
429 main_window::debug_continue () |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
430 { |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
431 octave_link::post_event (this, &main_window::debug_continue_callback); |
14752
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
432 } |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
433 |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
434 void |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
435 main_window::debug_step_into () |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
436 { |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
437 octave_link::post_event (this, &main_window::debug_step_into_callback); |
14752
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
438 } |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
439 |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
440 void |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
441 main_window::debug_step_over () |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
442 { |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
443 octave_link::post_event (this, &main_window::debug_step_over_callback); |
14752
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
444 } |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
445 |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
446 void |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
447 main_window::debug_step_out () |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
448 { |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
449 octave_link::post_event (this, &main_window::debug_step_out_callback); |
14752
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
450 } |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
451 |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
452 void |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
453 main_window::debug_quit () |
564cc673bcc5
Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14727
diff
changeset
|
454 { |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
455 octave_link::post_event (this, &main_window::debug_quit_callback); |
14726
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
456 } |
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
457 |
14700
7623bece76df
Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14698
diff
changeset
|
458 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
459 main_window::show_about_octave () |
13548
5c2ea445e100
Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13546
diff
changeset
|
460 { |
15404
f52a62a6db3a
eliminate copy and paste copyright info in GUI about info box
John W. Eaton <jwe@octave.org>
parents:
15402
diff
changeset
|
461 QString message = OCTAVE_STARTUP_MESSAGE; |
13548
5c2ea445e100
Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13546
diff
changeset
|
462 |
5c2ea445e100
Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13546
diff
changeset
|
463 QMessageBox::about (this, tr ("About Octave"), message); |
5c2ea445e100
Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13546
diff
changeset
|
464 } |
5c2ea445e100
Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13546
diff
changeset
|
465 |
5c2ea445e100
Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13546
diff
changeset
|
466 void |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
467 main_window::closeEvent (QCloseEvent *e) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
468 { |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
469 e->ignore (); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
470 octave_link::post_event (this, &main_window::exit_callback); |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
471 } |
13501 | 472 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
473 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
474 main_window::read_settings () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
475 { |
15164
bc801a44bb1f
follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents:
15106
diff
changeset
|
476 QSettings *settings = resource_manager::get_settings (); |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
477 if (!settings) |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
478 { |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
479 qDebug("Error: QSettings pointer from resource manager is NULL."); |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
480 return; |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
481 } |
15164
bc801a44bb1f
follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents:
15106
diff
changeset
|
482 |
15348
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
483 restoreState (settings->value ("MainWindow/windowState").toByteArray ()); |
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
484 settings->beginGroup ("DockWidgets"); |
15552
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
485 // restoring the geometry of all dock-widgets |
15348
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
486 foreach (QObject *obj, children ()) |
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
487 { |
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
488 QString name = obj->objectName (); |
15552
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
489 if (obj->inherits("QDockWidget") && ! name.isEmpty ()) |
15348
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
490 { |
15552
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
491 QDockWidget *widget = qobject_cast<QDockWidget *> (obj); |
15348
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
492 QVariant val = settings->value (name); |
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
493 widget->restoreGeometry (val.toByteArray ()); |
15552
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
494 bool floating = settings->value (name+"Floating",false).toBool (); |
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
495 bool visible = settings->value (name+"Visible",true).toBool (); |
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
496 if (floating) |
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
497 widget->setWindowFlags (Qt::Window); // if floating, make window from widget |
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
498 widget->setVisible (visible); // make widget visible if desired (setWindowFlags hides widget) |
15348
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
499 } |
15367
501a9cc2c68f
maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15365
diff
changeset
|
500 } |
15348
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
501 settings->endGroup(); |
13537
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
502 restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ()); |
15465
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
503 // restore the list of the last directories |
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
504 QStringList curr_dirs = settings->value ("MainWindow/current_directory_list").toStringList (); |
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
505 for (int i=0; i < curr_dirs.size (); i++) |
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
506 { |
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
507 _current_directory_combo_box->addItem (curr_dirs.at (i)); |
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
508 } |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
509 emit settings_changed (settings); |
13501 | 510 } |
511 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
512 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
513 main_window::write_settings () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
514 { |
15164
bc801a44bb1f
follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents:
15106
diff
changeset
|
515 QSettings *settings = resource_manager::get_settings (); |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
516 if (!settings) |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
517 { |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
518 qDebug("Error: QSettings pointer from resource manager is NULL."); |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
519 return; |
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16399
diff
changeset
|
520 } |
15164
bc801a44bb1f
follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents:
15106
diff
changeset
|
521 |
13537
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
522 settings->setValue ("MainWindow/geometry", saveGeometry ()); |
15348
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
523 settings->beginGroup ("DockWidgets"); |
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
524 // saving the geometry of all widgets |
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
525 foreach (QObject *obj, children()) |
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
526 { |
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
527 QString name = obj->objectName (); |
15552
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
528 if (obj->inherits ("QDockWidget") && ! name.isEmpty ()) |
15348
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
529 { |
15552
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
530 QDockWidget *widget = qobject_cast<QDockWidget *> (obj); |
15348
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
531 settings->setValue (name, widget->saveGeometry ()); |
15552
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
532 bool floating = widget->isFloating (); |
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
533 bool visible = widget->isVisible (); |
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
534 settings->setValue (name+"Floating",floating); // store floating state |
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
535 settings->setValue (name+"Visible",visible); // store visibility |
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
536 if (floating) |
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
537 widget->setWindowFlags(Qt::Widget); // if floating, recover the widget state such that the widget's |
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
538 } // state is correctly saved by the saveSate () below |
15348
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
539 } |
450fedd44176
correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents:
15300
diff
changeset
|
540 settings->endGroup(); |
15552
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15465
diff
changeset
|
541 settings->setValue ("MainWindow/windowState", saveState ()); |
15465
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
542 // write the list of recent used directories |
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
543 QStringList curr_dirs; |
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
544 for (int i=0; i<_current_directory_combo_box->count (); i++) |
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
545 { |
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
546 curr_dirs.append (_current_directory_combo_box->itemText (i)); |
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
547 } |
ded4ce76ee7a
save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents:
15426
diff
changeset
|
548 settings->setValue ("MainWindow/current_directory_list",curr_dirs); |
14694
ea11c9d8aa47
Calling qApp->quit () via QMetaObject::invoke caused a segfault, now exits cleanly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14693
diff
changeset
|
549 settings->sync (); |
13501 | 550 } |
551 | |
15987
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
552 |
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
553 // Connecting the signals emitted when the visibility of a widget changes. |
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
554 // This has to be done after the window is shown (see octave-gui.cc) |
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
555 void |
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
556 main_window::connect_visibility_changed () |
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
557 { |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
558 command_window->connect_visibility_changed (); |
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
559 history_window->connect_visibility_changed (); |
16450
3207f1d62e74
improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents:
16449
diff
changeset
|
560 file_browser_window->connect_visibility_changed (); |
16453
2e3c652c89d1
improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
561 doc_browser_window->connect_visibility_changed (); |
16446
4b3a4bf8569b
improve encapsulation of command window object
John W. Eaton <jwe@octave.org>
parents:
16445
diff
changeset
|
562 |
15987
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
563 connect (_workspace_view, SIGNAL (visibilityChanged (bool)), |
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
564 this, SLOT (handle_workspace_visible (bool))); |
16450
3207f1d62e74
improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents:
16449
diff
changeset
|
565 |
15987
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
566 #ifdef HAVE_QSCINTILLA |
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
567 connect (_file_editor, SIGNAL (visibilityChanged (bool)), |
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
568 this, SLOT (handle_editor_visible (bool))); |
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
569 #endif |
16450
3207f1d62e74
improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents:
16449
diff
changeset
|
570 |
15987
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
571 } |
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
572 |
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
573 |
47a4c92924a7
gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents:
15983
diff
changeset
|
574 // Main subroutine of the constructor |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
575 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
|
576 main_window::construct () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
577 { |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
578 _closing = false; // flag for editor files when closed |
15081
d02b229ce693
Cleaned up icon positions. Removed icon loading from resource manager.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
15055
diff
changeset
|
579 setWindowIcon (QIcon(":/actions/icons/logo.png")); |
13501 | 580 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
581 // Setup dockable widgets and the status bar. |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
582 _workspace_view = new workspace_view (this); |
16445
3f8d3fc907af
store workspace model in main_window, not in workspace view
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
583 |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
584 _workspace_view->setModel (_workspace_model); |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
585 _workspace_view->setStatusTip (tr ("View the variables in the active workspace.")); |
16445
3f8d3fc907af
store workspace model in main_window, not in workspace view
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
586 |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
587 connect (_workspace_model, SIGNAL (model_changed ()), |
16445
3f8d3fc907af
store workspace model in main_window, not in workspace view
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
588 _workspace_view, SLOT (model_changed ())); |
3f8d3fc907af
store workspace model in main_window, not in workspace view
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
589 |
15607
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
590 // Create and set the central widget. QMainWindow takes ownership of |
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
591 // the widget (pointer) so there is no need to delete the object upon |
c9c79d4a0a00
Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15591
diff
changeset
|
592 // destroying this main_window. |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
593 |
14693
c952f1e35e50
Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14692
diff
changeset
|
594 QWidget *dummyWidget = new QWidget (); |
14698
79c9a6d06590
Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14695
diff
changeset
|
595 dummyWidget->setObjectName ("CentralDummyWidget"); |
79c9a6d06590
Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14695
diff
changeset
|
596 dummyWidget->resize (10, 10); |
14693
c952f1e35e50
Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14692
diff
changeset
|
597 dummyWidget->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum); |
14698
79c9a6d06590
Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14695
diff
changeset
|
598 dummyWidget->hide (); |
79c9a6d06590
Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14695
diff
changeset
|
599 setCentralWidget (dummyWidget); |
14692
d6d250812c01
Made the terminal window dockable, too. Now the whole interface is fully dockable.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14690
diff
changeset
|
600 |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
601 #ifdef HAVE_QSCINTILLA |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15787
diff
changeset
|
602 _file_editor = new file_editor (this); |
15873
7d300b85ee25
allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents:
15848
diff
changeset
|
603 #endif |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13550
diff
changeset
|
604 |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
605 construct_menu_bar (); |
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:
14804
diff
changeset
|
606 |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
607 construct_tool_bar (); |
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:
14804
diff
changeset
|
608 |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
609 connect (qApp, SIGNAL (aboutToQuit ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
610 this, SLOT (prepare_for_quit ())); |
15993
41471c02d51c
gui: show menu with recently used editor files also in file menu of main window
Torsten <ttl@justmail.de>
parents:
15992
diff
changeset
|
611 |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
612 connect (this, SIGNAL (settings_changed (const QSettings *)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
613 this, SLOT (notice_settings (const QSettings *))); |
15989
afc4e08f2143
Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15987
diff
changeset
|
614 |
14601
772ce0204b3f
Removed version number and "Octave GUI"-labelling.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14599
diff
changeset
|
615 setWindowTitle ("Octave"); |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
616 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
617 setDockOptions (QMainWindow::AnimatedDocks |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
618 | QMainWindow::AllowNestedDocks |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
619 | QMainWindow::AllowTabbedDocks); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
620 |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
621 addDockWidget (Qt::RightDockWidgetArea, command_window); |
16453
2e3c652c89d1
improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
622 addDockWidget (Qt::RightDockWidgetArea, doc_browser_window); |
2e3c652c89d1
improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
623 tabifyDockWidget (command_window, doc_browser_window); |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
624 |
16379
4bb1b82076e5
gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents:
16377
diff
changeset
|
625 #ifdef HAVE_QSCINTILLA |
4bb1b82076e5
gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents:
16377
diff
changeset
|
626 addDockWidget (Qt::RightDockWidgetArea, _file_editor); |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
627 tabifyDockWidget (command_window, _file_editor); |
16379
4bb1b82076e5
gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents:
16377
diff
changeset
|
628 #endif |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
629 |
16450
3207f1d62e74
improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents:
16449
diff
changeset
|
630 addDockWidget (Qt::LeftDockWidgetArea, file_browser_window); |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
631 addDockWidget (Qt::LeftDockWidgetArea, _workspace_view); |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
632 addDockWidget (Qt::LeftDockWidgetArea, history_window); |
16379
4bb1b82076e5
gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents:
16377
diff
changeset
|
633 |
4bb1b82076e5
gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents:
16377
diff
changeset
|
634 int win_x = QApplication::desktop()->width(); |
4bb1b82076e5
gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents:
16377
diff
changeset
|
635 int win_y = QApplication::desktop()->height(); |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
636 |
16379
4bb1b82076e5
gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents:
16377
diff
changeset
|
637 if (win_x > 960) |
4bb1b82076e5
gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents:
16377
diff
changeset
|
638 win_x = 960; |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
639 |
16379
4bb1b82076e5
gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents:
16377
diff
changeset
|
640 if (win_y > 720) |
4bb1b82076e5
gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents:
16377
diff
changeset
|
641 win_y = 720; |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
642 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
643 setGeometry (0, 0, win_x, win_y); |
16379
4bb1b82076e5
gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents:
16377
diff
changeset
|
644 |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
645 setStatusBar (status_bar); |
14726
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
646 |
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
647 _octave_qt_event_listener = new octave_qt_event_listener (); |
e94a54ee0f46
Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14721
diff
changeset
|
648 |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
649 connect (_octave_qt_event_listener, SIGNAL (update_workspace_signal ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
650 this, SLOT (update_workspace ())); |
16350
d4b6ad43bc87
use direct callbacks instead to handle history and workspace list updates
John W. Eaton <jwe@octave.org>
parents:
16290
diff
changeset
|
651 |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
652 // FIXME -- is it possible to eliminate the event_listenter? |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
653 |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
654 construct_octave_qt_link (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
655 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
656 QDir curr_dir; |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
657 set_current_working_directory (curr_dir.absolutePath ()); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
658 } |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
659 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
660 void |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
661 main_window::construct_octave_qt_link (void) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
662 { |
16421
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
663 _octave_qt_link = new octave_qt_link (); |
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
664 |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
665 connect (_octave_qt_link, SIGNAL (change_directory_signal (QString)), |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
666 this, SLOT (change_directory (QString))); |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
667 |
16423
04c4dd7fd3ce
use signal for octave_link::update_dbstop_marker
John W. Eaton <jwe@octave.org>
parents:
16421
diff
changeset
|
668 connect (_octave_qt_link, |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
669 SIGNAL (set_history_signal (const QStringList&)), |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
670 history_window, SLOT (set_history (const QStringList&))); |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
671 |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
672 connect (_octave_qt_link, |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
673 SIGNAL (append_history_signal (const QString&)), |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
674 history_window, SLOT (append_history (const QString&))); |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
675 |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
676 connect (_octave_qt_link, |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
677 SIGNAL (clear_history_signal (void)), |
16451
d4c3736e1e28
dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents:
16450
diff
changeset
|
678 history_window, SLOT (clear_history (void))); |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
679 |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
680 connect (_octave_qt_link, SIGNAL (enter_debugger_signal ()), |
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
681 this, SLOT (handle_enter_debugger ())); |
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
682 |
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
683 connect (_octave_qt_link, SIGNAL (exit_debugger_signal ()), |
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
684 this, SLOT (handle_exit_debugger ())); |
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
685 |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
686 connect (_octave_qt_link, |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16438
diff
changeset
|
687 SIGNAL (update_breakpoint_marker_signal (bool, const QString&, int)), |
16423
04c4dd7fd3ce
use signal for octave_link::update_dbstop_marker
John W. Eaton <jwe@octave.org>
parents:
16421
diff
changeset
|
688 _file_editor, |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16438
diff
changeset
|
689 SLOT (handle_update_breakpoint_marker_request (bool, const QString&, int))); |
16423
04c4dd7fd3ce
use signal for octave_link::update_dbstop_marker
John W. Eaton <jwe@octave.org>
parents:
16421
diff
changeset
|
690 |
16424
ad052cdc89ad
use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents:
16423
diff
changeset
|
691 connect (_octave_qt_link, |
ad052cdc89ad
use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents:
16423
diff
changeset
|
692 SIGNAL (edit_file_signal (const QString&)), |
ad052cdc89ad
use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents:
16423
diff
changeset
|
693 _file_editor, |
ad052cdc89ad
use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents:
16423
diff
changeset
|
694 SLOT (handle_edit_file_request (const QString&))); |
ad052cdc89ad
use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents:
16423
diff
changeset
|
695 |
16426
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16425
diff
changeset
|
696 connect (_octave_qt_link, |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16425
diff
changeset
|
697 SIGNAL (insert_debugger_pointer_signal (const QString&, int)), |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16425
diff
changeset
|
698 _file_editor, |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16425
diff
changeset
|
699 SLOT (handle_insert_debugger_pointer_request (const QString&, int))); |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16425
diff
changeset
|
700 |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16425
diff
changeset
|
701 connect (_octave_qt_link, |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16425
diff
changeset
|
702 SIGNAL (delete_debugger_pointer_signal (const QString&, int)), |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16425
diff
changeset
|
703 _file_editor, |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16425
diff
changeset
|
704 SLOT (handle_delete_debugger_pointer_request (const QString&, int))); |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16425
diff
changeset
|
705 |
16432
fe4cd846c3e7
separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents:
16431
diff
changeset
|
706 _octave_qt_link->execute_interpreter (); |
fe4cd846c3e7
separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents:
16431
diff
changeset
|
707 |
16421
40d1ddca4db5
improve use of octave_link
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
708 octave_link::connect_link (_octave_qt_link); |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
709 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
16413
diff
changeset
|
710 octave_link::register_event_listener (_octave_qt_event_listener); |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
711 } |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
712 |
16454
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
713 void |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
714 main_window::construct_menu_bar (void) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
715 { |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
716 QMenuBar *menu_bar = menuBar (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
717 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
718 construct_file_menu (menu_bar); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
719 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
720 construct_edit_menu (menu_bar); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
721 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
722 construct_debug_menu (menu_bar); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
723 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
724 construct_desktop_menu (menu_bar); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
725 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
726 construct_window_menu (menu_bar); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
727 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
728 construct_help_menu (menu_bar); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
729 } |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
730 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
731 void |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
732 main_window::construct_file_menu (QMenuBar *p) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
733 { |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
734 QMenu *file_menu = p->addMenu (tr ("&File")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
735 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
736 construct_new_menu (file_menu); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
737 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
738 _open_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
739 = file_menu->addAction (QIcon(":/actions/icons/fileopen.png"), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
740 tr ("Open...")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
741 _open_action->setShortcut (QKeySequence::Open); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
742 _open_action->setShortcutContext (Qt::ApplicationShortcut); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
743 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
744 #ifdef HAVE_QSCINTILLA |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
745 file_menu->addMenu (_file_editor->get_mru_menu ()); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
746 #endif |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
747 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
748 QAction *close_command_window_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
749 = file_menu->addAction (tr ("Close Command Window")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
750 close_command_window_action->setShortcut (QKeySequence::Close); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
751 close_command_window_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
752 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
753 file_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
754 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
755 QAction *import_data_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
756 = file_menu->addAction (tr ("Import Data")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
757 import_data_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
758 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
759 QAction *save_workspace_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
760 = file_menu->addAction (tr ("Save Workspace As")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
761 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
762 file_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
763 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
764 QAction *preferences_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
765 = file_menu->addAction (QIcon(":/actions/icons/configure.png"), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
766 tr ("Preferences...")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
767 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
768 file_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
769 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
770 QAction *page_setup_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
771 = file_menu->addAction (tr ("Page Setup...")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
772 page_setup_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
773 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
774 QAction *print_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
775 = file_menu->addAction (tr ("Print")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
776 print_action->setShortcut (QKeySequence::Print); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
777 print_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
778 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
779 QAction *print_selection_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
780 = file_menu->addAction (tr ("Print Selection...")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
781 print_selection_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
782 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
783 file_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
784 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
785 QAction *exit_action = file_menu->addAction (tr ("Exit")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
786 exit_action->setShortcut (QKeySequence::Quit); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
787 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
788 connect (preferences_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
789 this, SLOT (process_settings_dialog_request ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
790 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
791 connect (_open_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
792 this, SLOT (open_file ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
793 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
794 connect (save_workspace_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
795 this, SLOT (handle_save_workspace_request ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
796 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
797 connect (exit_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
798 this, SLOT (close ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
799 } |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
800 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
801 void |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
802 main_window::construct_new_menu (QMenu *p) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
803 { |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
804 QMenu *new_menu = p->addMenu (tr ("New")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
805 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
806 _new_script_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
807 = new_menu->addAction (QIcon(":/actions/icons/filenew.png"), tr ("Script")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
808 _new_script_action->setShortcut (QKeySequence::New); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
809 _new_script_action->setShortcutContext (Qt::ApplicationShortcut); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
810 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
811 QAction *new_function_action = new_menu->addAction (tr ("Function")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
812 new_function_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
813 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
814 QAction *new_class_action = new_menu->addAction (tr ("Class")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
815 new_class_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
816 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
817 QAction *new_enumeration_action = new_menu->addAction (tr ("Enumeration")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
818 new_enumeration_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
819 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
820 QAction *new_figure_action = new_menu->addAction (tr ("Figure")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
821 new_figure_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
822 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
823 QAction *new_variable_action = new_menu->addAction (tr ("Variable")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
824 new_variable_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
825 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
826 QAction *new_model_action = new_menu->addAction (tr ("Model")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
827 new_model_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
828 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
829 QAction *new_gui_action = new_menu->addAction (tr ("GUI")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
830 new_gui_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
831 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
832 connect (_new_script_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
833 this, SLOT (new_file ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
834 } |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
835 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
836 void |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
837 main_window::construct_edit_menu (QMenuBar *p) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
838 { |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
839 QMenu *edit_menu = p->addMenu (tr ("&Edit")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
840 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
841 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier; |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
842 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
843 _undo_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
844 = edit_menu->addAction (QIcon(":/actions/icons/undo.png"), tr ("Undo")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
845 _undo_action->setShortcut (QKeySequence::Undo); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
846 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
847 _redo_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
848 = edit_menu->addAction (QIcon(":/actions/icons/redo.png"), tr ("Redo")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
849 _redo_action->setShortcut (QKeySequence::Redo); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
850 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
851 edit_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
852 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
853 _cut_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
854 = edit_menu->addAction (QIcon(":/actions/icons/editcut.png"), tr ("Cut")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
855 _cut_action->setShortcut (ctrl_shift + Qt::Key_X); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
856 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
857 _copy_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
858 = edit_menu->addAction (QIcon(":/actions/icons/editcopy.png"), tr ("Copy")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
859 _copy_action->setShortcut (ctrl_shift + Qt::Key_C); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
860 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
861 _paste_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
862 = edit_menu->addAction (QIcon(":/actions/icons/editpaste.png"), tr ("Paste")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
863 _paste_action->setShortcut (ctrl_shift + Qt::Key_V); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
864 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
865 QAction *paste_to_workspace_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
866 = edit_menu->addAction (tr ("Paste To Workspace...")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
867 paste_to_workspace_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
868 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
869 edit_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
870 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
871 QAction *select_all_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
872 = edit_menu->addAction (tr ("Select All")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
873 select_all_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
874 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
875 QAction *delete_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
876 = edit_menu->addAction (tr ("Delete")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
877 delete_action->setShortcut (Qt::Key_Delete); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
878 delete_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
879 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
880 edit_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
881 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
882 QAction *find_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
883 = edit_menu->addAction (tr ("Find...")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
884 find_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
885 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
886 QAction *find_files_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
887 = edit_menu->addAction (tr ("Find Files...")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
888 find_files_action->setShortcut (ctrl_shift + Qt::Key_F); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
889 find_files_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
890 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
891 edit_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
892 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
893 QAction *clear_command_window_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
894 = edit_menu->addAction (tr ("Clear Command Window")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
895 clear_command_window_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
896 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
897 QAction *clear_command_history |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
898 = edit_menu->addAction(tr ("Clear Command History")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
899 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
900 QAction *clear_workspace_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
901 = edit_menu->addAction (tr ("Clear Workspace")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
902 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
903 connect (_copy_action, SIGNAL (triggered()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
904 command_window, SLOT (copyClipboard ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
905 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
906 connect (_paste_action, SIGNAL (triggered()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
907 command_window, SLOT (pasteClipboard ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
908 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
909 connect (clear_command_history, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
910 this, SLOT (handle_clear_history_request ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
911 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
912 connect (clear_workspace_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
913 this, SLOT (handle_clear_workspace_request ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
914 } |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
915 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
916 QAction * |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
917 main_window::construct_debug_menu_item (const char *icon_file, |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
918 const QString& item, |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
919 const QKeySequence& key) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
920 { |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
921 QAction *action = _debug_menu->addAction (QIcon (icon_file), item); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
922 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
923 action->setEnabled (false); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
924 action->setShortcut (Qt::Key_F10); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
925 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
926 #ifdef HAVE_QSCINTILLA |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
927 _file_editor->debug_menu ()->addAction (action); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
928 _file_editor->toolbar ()->addAction (action); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
929 #endif |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
930 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
931 return action; |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
932 } |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
933 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
934 void |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
935 main_window::construct_debug_menu (QMenuBar *p) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
936 { |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
937 _debug_menu = p->addMenu (tr ("De&bug")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
938 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
939 _debug_step_over = construct_debug_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
940 (":/actions/icons/db_step.png", tr ("Step"), Qt::Key_F10); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
941 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
942 _debug_step_into = construct_debug_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
943 (":/actions/icons/db_step_in.png", tr ("Step in"), Qt::Key_F11); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
944 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
945 _debug_step_out = construct_debug_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
946 (":/actions/icons/db_step_out.png", tr ("Step out"), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
947 Qt::ShiftModifier + Qt::Key_F11); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
948 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
949 _debug_continue = construct_debug_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
950 (":/actions/icons/db_cont.png", tr ("Continue"), Qt::Key_F5); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
951 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
952 _debug_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
953 #ifdef HAVE_QSCINTILLA |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
954 _file_editor->debug_menu ()->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
955 #endif |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
956 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
957 _debug_quit = construct_debug_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
958 (":/actions/icons/db_stop.png", tr ("Exit Debug Mode"), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
959 Qt::ShiftModifier + Qt::Key_F5); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
960 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
961 connect (_debug_step_over, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
962 this, SLOT (debug_step_over ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
963 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
964 connect (_debug_step_into, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
965 this, SLOT (debug_step_into ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
966 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
967 connect (_debug_step_out, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
968 this, SLOT (debug_step_out ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
969 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
970 connect (_debug_continue, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
971 this, SLOT (debug_continue ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
972 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
973 connect (_debug_quit, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
974 this, SLOT (debug_quit ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
975 } |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
976 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
977 void |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
978 main_window::construct_desktop_menu (QMenuBar *p) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
979 { |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
980 QMenu *desktop_menu = p->addMenu (tr ("&Desktop")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
981 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
982 QAction *load_workspace_action = desktop_menu->addAction (tr ("Load workspace")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
983 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
984 connect (load_workspace_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
985 this, SLOT (handle_load_workspace_request ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
986 } |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
987 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
988 QAction * |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
989 main_window::construct_window_menu_item (QMenu *p, const QString& item, |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
990 bool checkable, |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
991 const QKeySequence& key) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
992 { |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
993 QAction *action = p->addAction (item); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
994 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
995 action->setCheckable (checkable); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
996 action->setShortcut (key); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
997 action->setShortcutContext (Qt::ApplicationShortcut); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
998 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
999 return action; |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1000 } |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1001 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1002 void |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1003 main_window::construct_window_menu (QMenuBar *p) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1004 { |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1005 QMenu *window_menu = p->addMenu (tr ("&Window")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1006 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1007 QKeySequence ctrl = Qt::ControlModifier; |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1008 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier; |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1009 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1010 QAction *show_command_window_action = construct_window_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1011 (window_menu, tr ("Show Command Window"), true, ctrl_shift + Qt::Key_0); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1012 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1013 QAction *show_history_action = construct_window_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1014 (window_menu, tr ("Show Command History"), true, ctrl_shift + Qt::Key_1); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1015 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1016 QAction *show_file_browser_action = construct_window_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1017 (window_menu, tr ("Show Current Directory"), true, ctrl_shift + Qt::Key_2); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1018 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1019 QAction *show_workspace_action = construct_window_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1020 (window_menu, tr ("Show Workspace"), true, ctrl_shift + Qt::Key_3); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1021 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1022 QAction *show_editor_action = construct_window_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1023 (window_menu, tr ("Show Editor"), true, ctrl_shift + Qt::Key_4); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1024 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1025 QAction *show_documentation_action = construct_window_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1026 (window_menu, tr ("Show Documentation"), true, ctrl_shift + Qt::Key_5); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1027 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1028 window_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1029 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1030 QAction *command_window_action = construct_window_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1031 (window_menu, tr ("Command Window"), false, ctrl + Qt::Key_0); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1032 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1033 QAction *history_action = construct_window_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1034 (window_menu, tr ("Command History"), false, ctrl + Qt::Key_1); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1035 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1036 QAction *file_browser_action = construct_window_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1037 (window_menu, tr ("Current Directory"), false, ctrl + Qt::Key_2); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1038 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1039 QAction *workspace_action = construct_window_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1040 (window_menu, tr ("Workspace"), false, ctrl + Qt::Key_3); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1041 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1042 QAction *editor_action = construct_window_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1043 (window_menu, tr ("Editor"), false, ctrl + Qt::Key_4); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1044 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1045 QAction *documentation_action = construct_window_menu_item |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1046 (window_menu, tr ("Documentation"), false, ctrl + Qt::Key_5); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1047 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1048 window_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1049 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1050 QAction *reset_windows_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1051 = window_menu->addAction (tr ("Reset Windows")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1052 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1053 reset_windows_action->setEnabled (false); // TODO: Make this work. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1054 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1055 connect (show_command_window_action, SIGNAL (toggled (bool)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1056 command_window, SLOT (setVisible (bool))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1057 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1058 connect (command_window, SIGNAL (active_changed (bool)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1059 show_command_window_action, SLOT (setChecked (bool))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1060 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1061 connect (show_workspace_action, SIGNAL (toggled (bool)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1062 _workspace_view, SLOT (setVisible (bool))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1063 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1064 connect (_workspace_view, SIGNAL (active_changed (bool)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1065 show_workspace_action, SLOT (setChecked (bool))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1066 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1067 connect (show_history_action, SIGNAL (toggled (bool)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1068 history_window, SLOT (setVisible (bool))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1069 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1070 connect (history_window, SIGNAL (active_changed (bool)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1071 show_history_action, SLOT (setChecked (bool))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1072 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1073 connect (show_file_browser_action, SIGNAL (toggled (bool)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1074 file_browser_window, SLOT (setVisible (bool))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1075 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1076 connect (file_browser_window, SIGNAL (active_changed (bool)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1077 show_file_browser_action, SLOT (setChecked (bool))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1078 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1079 #ifdef HAVE_QSCINTILLA |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1080 connect (show_editor_action, SIGNAL (toggled (bool)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1081 _file_editor, SLOT (setVisible (bool))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1082 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1083 connect (_file_editor, SIGNAL (active_changed (bool)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1084 show_editor_action, SLOT (setChecked (bool))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1085 #endif |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1086 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1087 connect (show_documentation_action, SIGNAL (toggled (bool)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1088 doc_browser_window, SLOT (setVisible (bool))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1089 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1090 connect (doc_browser_window, SIGNAL (active_changed (bool)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1091 show_documentation_action, SLOT (setChecked (bool))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1092 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1093 connect (command_window_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1094 command_window, SLOT (focus ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1095 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1096 connect (workspace_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1097 this, SLOT (focus_workspace ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1098 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1099 connect (history_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1100 history_window, SLOT (focus ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1101 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1102 connect (file_browser_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1103 file_browser_window, SLOT (focus ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1104 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1105 connect (editor_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1106 this, SLOT (focus_editor ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1107 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1108 connect (documentation_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1109 doc_browser_window, SLOT (focus ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1110 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1111 connect (reset_windows_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1112 this, SLOT (reset_windows ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1113 } |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1114 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1115 void |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1116 main_window::construct_help_menu (QMenuBar *p) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1117 { |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1118 QMenu *help_menu = p->addMenu (tr ("&Help")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1119 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1120 construct_documentation_menu (help_menu); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1121 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1122 help_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1123 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1124 QAction *report_bug_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1125 = help_menu->addAction (tr ("Report Bug")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1126 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1127 QAction *octave_forge_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1128 = help_menu->addAction (tr ("Visit Octave Forge")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1129 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1130 QAction *agora_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1131 = help_menu->addAction (tr ("Visit Agora")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1132 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1133 help_menu->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1134 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1135 QAction *about_octave_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1136 = help_menu->addAction (tr ("About Octave")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1137 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1138 connect (report_bug_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1139 this, SLOT (open_bug_tracker_page ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1140 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1141 connect (octave_forge_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1142 this, SLOT (open_octave_forge_page ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1143 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1144 connect (agora_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1145 this, SLOT (open_agora_page ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1146 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1147 connect (about_octave_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1148 this, SLOT (show_about_octave ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1149 } |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1150 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1151 void |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1152 main_window::construct_documentation_menu (QMenu *p) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1153 { |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1154 QMenu *documentation_menu = p->addMenu (tr ("Documentation")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1155 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1156 QAction *ondisk_documentation_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1157 = documentation_menu->addAction (tr ("On Disk")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1158 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1159 QAction *online_documentation_action |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1160 = documentation_menu->addAction (tr ("Online")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1161 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1162 connect (ondisk_documentation_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1163 doc_browser_window, SLOT (focus ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1164 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1165 connect (online_documentation_action, SIGNAL (triggered ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1166 this, SLOT (open_online_documentation_page ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1167 } |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1168 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1169 void |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1170 main_window::construct_tool_bar (void) |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1171 { |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1172 QToolBar *main_tool_bar = addToolBar ("Main"); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1173 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1174 main_tool_bar->setObjectName ("MainToolBar"); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1175 main_tool_bar->addAction (_new_script_action); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1176 main_tool_bar->addAction (_open_action); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1177 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1178 main_tool_bar->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1179 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1180 main_tool_bar->addAction (_cut_action); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1181 main_tool_bar->addAction (_copy_action); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1182 main_tool_bar->addAction (_paste_action); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1183 main_tool_bar->addAction (_undo_action); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1184 main_tool_bar->addAction (_redo_action); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1185 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1186 main_tool_bar->addSeparator (); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1187 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1188 _current_directory_line_edit = new QLineEdit (this); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1189 _current_directory_combo_box = new QComboBox (this); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1190 _current_directory_combo_box->setFixedWidth (current_directory_width); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1191 _current_directory_combo_box->setEditable (true); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1192 // setLineEdit takes ownership -> no need to delete line_edit in ~main_window |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1193 _current_directory_combo_box->setLineEdit (_current_directory_line_edit); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1194 _current_directory_combo_box->setInsertPolicy (QComboBox::InsertAtTop); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1195 _current_directory_combo_box->setMaxVisibleItems (current_directory_max_visible); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1196 _current_directory_combo_box->setMaxCount (current_directory_max_count); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1197 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1198 QToolButton *current_directory_tool_button = new QToolButton (this); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1199 current_directory_tool_button->setIcon (QIcon(":/actions/icons/search.png")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1200 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1201 QToolButton *current_directory_up_tool_button = new QToolButton (this); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1202 current_directory_up_tool_button->setIcon (QIcon(":/actions/icons/up.png")); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1203 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1204 // addWidget takes ownership of the objects so there is no |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1205 // need to delete these upon destroying this main_window. |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1206 main_tool_bar->addWidget (new QLabel (tr ("Current Directory:"))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1207 main_tool_bar->addWidget (_current_directory_combo_box); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1208 main_tool_bar->addWidget (current_directory_tool_button); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1209 main_tool_bar->addWidget (current_directory_up_tool_button); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1210 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1211 connect (_current_directory_combo_box, SIGNAL (activated (QString)), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1212 this, SLOT (set_current_working_directory (QString))); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1213 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1214 connect (_current_directory_line_edit, SIGNAL (returnPressed ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1215 this, SLOT (accept_directory_line_edit ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1216 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1217 connect (current_directory_tool_button, SIGNAL (clicked ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1218 this, SLOT (browse_for_directory ())); |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1219 |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1220 connect (current_directory_up_tool_button, SIGNAL (clicked ()), |
246d25c8761b
split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents:
16453
diff
changeset
|
1221 this, SLOT (change_directory_up ())); |
13501 | 1222 } |
1223 | |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1224 void |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1225 main_window::save_workspace_callback (const std::string& file) |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1226 { |
15420
1249a615c91b
call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents:
15404
diff
changeset
|
1227 Fsave (ovl (file)); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1228 } |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1229 |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1230 void |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1231 main_window::load_workspace_callback (const std::string& file) |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1232 { |
15420
1249a615c91b
call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents:
15404
diff
changeset
|
1233 Fload (ovl (file)); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1234 } |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1235 |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1236 void |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1237 main_window::clear_workspace_callback (void) |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1238 { |
15420
1249a615c91b
call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents:
15404
diff
changeset
|
1239 Fclear (); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1240 } |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1241 |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1242 void |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1243 main_window::clear_history_callback (void) |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1244 { |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
1245 Fhistory (ovl ("-c")); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1246 } |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1247 |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1248 void |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1249 main_window::change_directory_callback (const std::string& directory) |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1250 { |
15420
1249a615c91b
call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents:
15404
diff
changeset
|
1251 Fcd (ovl (directory)); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1252 } |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1253 |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1254 void |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1255 main_window::debug_continue_callback (void) |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1256 { |
15420
1249a615c91b
call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents:
15404
diff
changeset
|
1257 Fdbcont (); |
16397
649d0b75ec06
allow continue and quit debug buttons to work
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
1258 |
649d0b75ec06
allow continue and quit debug buttons to work
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
1259 command_editor::interrupt (true); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1260 } |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1261 |
16382
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1262 // The next three callbacks are invoked by GUI buttons. Those buttons |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1263 // should only be active when we are doing debugging, which means that |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1264 // Octave is waiting for input in get_debug_input. Calling |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1265 // command_editor::interrupt will force readline to return even if it |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1266 // has not read any input, and then get_debug_input will return, |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1267 // allowing the evaluator to continue and execute the next statement. |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1268 |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1269 void |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1270 main_window::debug_step_into_callback (void) |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1271 { |
15420
1249a615c91b
call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents:
15404
diff
changeset
|
1272 Fdbstep (ovl ("in")); |
16382
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1273 |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1274 command_editor::interrupt (true); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1275 } |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1276 |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1277 void |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1278 main_window::debug_step_over_callback (void) |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1279 { |
15420
1249a615c91b
call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents:
15404
diff
changeset
|
1280 Fdbstep (); |
16382
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1281 |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1282 command_editor::interrupt (true); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1283 } |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1284 |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1285 void |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1286 main_window::debug_step_out_callback (void) |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1287 { |
15420
1249a615c91b
call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents:
15404
diff
changeset
|
1288 Fdbstep (ovl ("out")); |
16382
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1289 |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
16380
diff
changeset
|
1290 command_editor::interrupt (true); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1291 } |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1292 |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1293 void |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1294 main_window::debug_quit_callback (void) |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1295 { |
15420
1249a615c91b
call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents:
15404
diff
changeset
|
1296 Fdbquit (); |
16397
649d0b75ec06
allow continue and quit debug buttons to work
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
1297 |
649d0b75ec06
allow continue and quit debug buttons to work
John W. Eaton <jwe@octave.org>
parents:
16395
diff
changeset
|
1298 command_editor::interrupt (true); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1299 } |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1300 |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1301 void |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1302 main_window::exit_callback (void) |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1303 { |
15420
1249a615c91b
call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents:
15404
diff
changeset
|
1304 Fquit (); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
1305 } |