annotate libgui/src/octave-qobject.h @ 29754:4c569e386e9b

improve behavior of dockable widgets (bug #60750) * main-window.h, main-window.cc (main_window::set_window_layout): Don't reset geometry of adopted dock_widgets. (main_window::construct): Don't connect qt_link edit_variable_signal to main_window edit_variable slot. (main_window::reset_windows): Force reset of all windows. (main_window::do_reset_windows): New argument, FORCE_ALL. Skip adoped dock_widgets unless force_all is true. * octave-dock-widget.h, octave-dock-widget.cc (octave_dock_widget::make_widget): If m_main_window is nonnull, set m_adopted to false. Disconnect any existing m_dock_action signals that are connected to the octave_dock_widget object before connecting the m_dock_action triggered signal to the octave_dock_widget make_window slot. (octave_dock_widget::m_adopted): New data member. (octave_dock_widget::set_adopted, (octave_dock_widget::adopted): New functions. * octave-qobject.h, octave-qobject.cc (base_qobject::documentation_widget, base_qobject::file_browser_widget, base_qobject::history_widget, base_qobject::workspace_widget, base_qobject::variable_editor_widget): Call set_main_window and set_adopted for widget if it already exists and main_window argument is nonnull. Otherwise, create widget if it doesn't already exist. (base_qobject::show_variable_editor_window): Rename slot from edit_variable. Change all uses. Acquire pointer to widget and forward to the widget's edit_variable method. * variable-editor.cc (variable_editor::variable_editor): Call make_window if parent is nullptr. (variable_editor::edit_variable): Don't call make_window.
author John W. Eaton <jwe@octave.org>
date Mon, 14 Jun 2021 12:39:51 -0400
parents 9367cba2a6d5
children 84d7e1ace446
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 28347
diff changeset
3 // Copyright (C) 2011-2021 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #if ! defined (octave_octave_qobject_h)
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #define octave_octave_qobject_h 1
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
29 #include <memory>
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
30
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 #include <QApplication>
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 #include <QList>
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 #include <QObject>
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 #include <QString>
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 #include <QStringList>
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
37 #include "interpreter-qobject.h"
27620
45bb5bbaf291 don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27619
diff changeset
38 #include "resource-manager.h"
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
39 #include "shortcut-manager.h"
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
40
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 namespace octave
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 {
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 class main_window;
27217
de0762d72d52 eliminate unnecessary inclusion of qt-application.h
John W. Eaton <jwe@octave.org>
parents: 27197
diff changeset
44 class qt_application;
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
45 class qt_interpreter_events;
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 //! This class is a simple wrapper around QApplication so that we can
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 //! reimplement QApplication::notify. The octave_qapplication object
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 //! should behave identically to a QApplication object except that it
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 //! overrides the notify method so we can handle forward Octave
28857
43ad651cf5a0 eliminate unnecessary uses of octave:: namespace qualifier
John W. Eaton <jwe@octave.org>
parents: 28795
diff changeset
51 //! execution_exception exceptions from the GUI thread to the
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 //! interpreter thread.
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 class octave_qapplication : public QApplication
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
56 Q_OBJECT
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
57
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58 public:
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 octave_qapplication (int& argc, char **argv)
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 : QApplication (argc, argv)
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 { }
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64 virtual bool notify (QObject *receiver, QEvent *e) override;
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 ~octave_qapplication (void) { };
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
67
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
68 signals:
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
69
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
70 void interpreter_event (const fcn_callback& fcn);
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
71 void interpreter_event (const meth_callback& meth);
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 };
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
74 //! Container for windows that may be created from the command line or
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
75 //! docked with the main GUI window. Any of these windows that are
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
76 //! created in command line mode will be adopted by the main window if
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
77 //! it is opened from the command line. Any that are undocked from
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
78 //! the main window will remain open if control returns to the command
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
79 //! line.
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
80
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
81 class base_qobject;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
82 class documentation_dock_widget;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
83 class file_editor_interface;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
84 class files_dock_widget;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
85 class history_dock_widget;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
86 class variable_editor;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
87 class workspace_model;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
88 class workspace_view;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
89
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90 //! Base class for Octave interfaces that use Qt. There are two
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91 //! classes derived from this one. One provides a command-line
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92 //! interface that may use Qt graphics and another provides the
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
93 //! full GUI experience.
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
95 class base_qobject : public QObject
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
96 {
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
97 Q_OBJECT
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
98
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99 public:
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
101 // Note: the GUI_APP argument is not needed with the new
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
102 // experimental terminal widget.
29153
02ee34a30351 eliminate separate cli_qobject and gui_qobject classes
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
103 base_qobject (qt_application& app_context, bool gui_app = false);
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
104
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
105 ~base_qobject (void);
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
106
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
107 void config_translators (void);
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
108
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109 void start_main_thread (void);
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
110
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
111 int exec (void);
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
112
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
113 // The Octave application context.
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
114 qt_application& app_context (void) { return m_app_context; }
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
115
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
116 // The Qt QApplication.
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
117 QApplication * qapplication (void) { return m_qapplication; };
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
118
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
119 // Provided for convenience. Will be removed once we eliminate the
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
120 // old terminal widget.
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
121 bool experimental_terminal_widget (void) const;
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
122
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
123 // Provided for convenience.
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
124 bool gui_running (void) const;
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
125
27620
45bb5bbaf291 don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27619
diff changeset
126 resource_manager& get_resource_manager (void)
45bb5bbaf291 don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27619
diff changeset
127 {
45bb5bbaf291 don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27619
diff changeset
128 return m_resource_manager;
45bb5bbaf291 don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27619
diff changeset
129 }
45bb5bbaf291 don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27619
diff changeset
130
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
131 shortcut_manager& get_shortcut_manager (void)
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
132 {
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
133 return m_shortcut_manager;
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
134 }
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
135
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
136 std::shared_ptr<qt_interpreter_events> get_qt_interpreter_events (void)
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
137 {
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
138 return m_qt_interpreter_events;
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
139 }
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
140
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
141 qt_interpreter_events * qt_link (void)
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
142 {
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
143 return m_qt_interpreter_events.get ();
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
144 }
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
145
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
146 interpreter_qobject * interpreter_qobj (void)
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
147 {
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
148 return m_interpreter_qobj;
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
149 }
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
150
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
151 workspace_model * get_workspace_model (void)
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
152 {
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
153 return m_workspace_model;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
154 }
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
155
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
156 QPointer<documentation_dock_widget>
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
157 documentation_widget (main_window *mw = nullptr);
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
158
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
159 QPointer<files_dock_widget>
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
160 file_browser_widget (main_window *mw = nullptr);
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
161
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
162 QPointer<history_dock_widget>
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
163 history_widget (main_window *mw = nullptr);
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
164
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
165 QPointer<workspace_view>
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
166 workspace_widget (main_window *mw = nullptr);
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
167
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
168 // FIXME: The file_editor_interface needs to be a proper generic
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
169 // interface for all editors (internal and external) for this to
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
170 // work properly.
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
171 QPointer<file_editor_interface>
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
172 editor_widget (main_window *mw = nullptr);
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
173
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
174 QPointer<variable_editor>
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
175 variable_editor_widget (main_window *mw = nullptr);
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
176
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
177 QThread *main_thread (void) { return m_main_thread; }
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
178
29153
02ee34a30351 eliminate separate cli_qobject and gui_qobject classes
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
179 // Declared virtual so that a derived class may redefine this
02ee34a30351 eliminate separate cli_qobject and gui_qobject classes
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
180 // method.
02ee34a30351 eliminate separate cli_qobject and gui_qobject classes
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
181
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
182 virtual bool confirm_shutdown (void);
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
183
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
184 public slots:
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
185
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
186 // Note: START_GUI and CLOSE_GUI don't currently perform any work
29548
f6ad83cbe3c4 simplify interpreter shutdown in the GUI
John W. Eaton <jwe@octave.org>
parents: 29503
diff changeset
187 // with the old terminal widget.
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
188 void start_gui (bool gui_app);
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
189 void close_gui (void);
29219
c2f3a0832cf0 fix possible glitch when interpreter is ready when main window is created
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29153
diff changeset
190
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
191 void show_documentation_window (const QString& file);
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
192
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
193 void show_file_browser_window (void);
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
194
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
195 void show_command_history_window (void);
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
196
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
197 void show_workspace_window (void);
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
198
29754
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29613
diff changeset
199 void show_variable_editor_window (const QString& name,
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29613
diff changeset
200 const octave_value& value);
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
201
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
202 void handle_variable_editor_update (void);
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
203
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
204 void interpreter_ready (void);
28347
00a9a49c7670 improve interpreter shutdown process (bug #56952)
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
205
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
206 void interpreter_event (const fcn_callback& fcn);
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
207
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
208 void interpreter_event (const meth_callback& meth);
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
209
29292
eb1e10abe9d5 use method in interpreter class to interrupt interpreter execution in GUI
John W. Eaton <jwe@octave.org>
parents: 29219
diff changeset
210 void interpreter_interrupt (void);
eb1e10abe9d5 use method in interpreter class to interrupt interpreter execution in GUI
John W. Eaton <jwe@octave.org>
parents: 29219
diff changeset
211
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
212 // Note: these currently only work with the new experimental
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
213 // terminal widget.
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
214 void interpreter_pause (void);
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
215 void interpreter_stop (void);
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
216 void interpreter_resume (void);
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
217
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
218 void copy_image_to_clipboard (const QString& file, bool remove_file);
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
219
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
220 protected:
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
221
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
222 qt_application& m_app_context;
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
223
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
224 // Use these to ensure that argc and argv exist for as long as the
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
225 // QApplication object.
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
226
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
227 int m_argc;
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
228 char **m_argv;
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
229
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27218
diff changeset
230 octave_qapplication *m_qapplication;
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
231
27620
45bb5bbaf291 don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27619
diff changeset
232 resource_manager m_resource_manager;
45bb5bbaf291 don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27619
diff changeset
233
27630
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
234 shortcut_manager m_shortcut_manager;
262cdd0f7619 don't use singleton pattern for shortcut manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
235
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
236 QTranslator *m_qt_tr;
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
237 QTranslator *m_gui_tr;
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
238 QTranslator *m_qsci_tr;
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
239
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
240 bool m_translators_installed;
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
241
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
242 std::shared_ptr<qt_interpreter_events> m_qt_interpreter_events;
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27582
diff changeset
243
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27217
diff changeset
244 interpreter_qobject *m_interpreter_qobj;
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
245
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
246 QThread *m_main_thread;
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
247
29153
02ee34a30351 eliminate separate cli_qobject and gui_qobject classes
John W. Eaton <jwe@octave.org>
parents: 28857
diff changeset
248 bool m_gui_app;
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
249
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
250 bool m_interpreter_ready;
29219
c2f3a0832cf0 fix possible glitch when interpreter is ready when main window is created
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29153
diff changeset
251
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
252 workspace_model *m_workspace_model;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
253
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
254 // Dock widgets that may be used from the command line. They are
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
255 // adopted by the desktop (main window) if it is also started from
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
256 // the command line.
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
257
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
258 QPointer<documentation_dock_widget> m_documentation_widget;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
259
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
260 QPointer<files_dock_widget> m_file_browser_widget;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
261
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
262 QPointer<history_dock_widget> m_history_widget;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
263
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
264 QPointer<workspace_view> m_workspace_widget;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
265
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
266 QPointer<file_editor_interface> m_editor_widget;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
267
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
268 QPointer<variable_editor> m_variable_editor_widget;
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29548
diff changeset
269
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
270 main_window *m_main_window;
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
271 };
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
272 }
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
273
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents:
diff changeset
274 #endif