Mercurial > octave
annotate libgui/src/terminal-dock-widget.cc @ 33359:689d4d069bbf
maint: Use Octave coding convention of space between function name and parentheses in libgui/.
* libgui/graphics/BaseControl.cc, libgui/graphics/Canvas.cc,
libgui/graphics/Figure.cc, libgui/graphics/FigureWindow.cc,
libgui/graphics/FigureWindow.h, libgui/graphics/QtHandlesUtils.cc,
libgui/graphics/Table.h, libgui/graphics/annotation-dialog.cc,
libgui/graphics/gl-select.cc, libgui/src/command-widget.cc,
libgui/src/dialog.cc, libgui/src/documentation-bookmarks.cc,
libgui/src/documentation.cc, libgui/src/dw-main-window.cc,
libgui/src/files-dock-widget.cc, libgui/src/gui-settings.cc,
libgui/src/gui-settings.h, libgui/src/gui-utils.cc,
libgui/src/led-indicator.cc, libgui/src/m-editor/file-editor-tab.cc,
libgui/src/m-editor/find-dialog.cc, libgui/src/m-editor/octave-qscintilla.cc,
libgui/src/main-window.cc, libgui/src/main-window.h,
libgui/src/octave-dock-widget.cc, libgui/src/set-path-dialog.cc,
libgui/src/set-path-model.cc, libgui/src/settings-dialog.cc,
libgui/src/tab-bar.cc, libgui/src/tab-bar.h,
libgui/src/terminal-dock-widget.cc, libgui/src/variable-editor-model.cc,
libgui/src/variable-editor-model.h, libgui/src/variable-editor.cc,
libgui/src/workspace-model.h, libgui/src/workspace-view.cc:
Use Octave coding convention of space between function name and parentheses.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 08 Apr 2024 14:39:40 -0700 |
parents | 775dde0cb3e5 |
children | 7f18c537e101 |
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 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31995
diff
changeset
|
3 // Copyright (C) 2011-2024 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 //////////////////////////////////////////////////////////////////////// |
14692
d6d250812c01
Made the terminal window dockable, too. Now the whole interface is fully dockable.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
27 # include "config.h" |
15286
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
28 #endif |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
29 |
31701
286306a9a393
eliminate base_qobject from octave_dock_widget and other classes
John W. Eaton <jwe@octave.org>
parents:
31698
diff
changeset
|
30 #include <QGuiApplication> |
30690
e2c8c852399e
replace use of depreciated QDesktopWidget in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30564
diff
changeset
|
31 #include <QScreen> |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
32 |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
33 // This header is only needed for the new terminal widget. |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
34 #if defined (HAVE_QSCINTILLA) |
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
35 # include "command-widget.h" |
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
36 #endif |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
37 |
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
38 // This header is only needed for the old terminal widget. |
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
39 #include "QTerminal.h" |
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
40 |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
41 #include "gui-preferences-cs.h" |
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
42 #include "gui-preferences-global.h" |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
43 #include "gui-preferences-sc.h" |
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
44 #include "gui-settings.h" |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
45 |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27281
diff
changeset
|
46 #include "terminal-dock-widget.h" |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27281
diff
changeset
|
47 |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
48 OCTAVE_BEGIN_NAMESPACE(octave) |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
49 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
50 terminal_dock_widget::terminal_dock_widget (QWidget *p, |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
51 bool experimental_terminal_widget) |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
52 : octave_dock_widget ("TerminalDockWidget", p), |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
53 m_experimental_terminal_widget (experimental_terminal_widget) |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
54 { |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
55 init_control_d_shortcut_behavior (); |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
56 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
57 // FIXME: we could do this in a better way, but improving it doesn't |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
58 // matter much if we will eventually be removing the old terminal. |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
59 if (m_experimental_terminal_widget) |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
60 { |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
61 #if defined (HAVE_QSCINTILLA) |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
62 command_widget *widget = new command_widget (this); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
63 console *con = widget->get_console (); |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
64 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
65 connect (this, &terminal_dock_widget::settings_changed, |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
66 widget, &command_widget::notice_settings); |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
67 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
68 connect (this, &terminal_dock_widget::update_prompt_signal, |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
69 widget, &command_widget::update_prompt); |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
70 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
71 connect (this, &terminal_dock_widget::interpreter_output_signal, |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
72 widget, &command_widget::insert_interpreter_output); |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
73 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
74 connect (this, &terminal_dock_widget::execute_command_signal, |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
75 con, &console::execute_command); |
31068
0b402f523f09
allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31067
diff
changeset
|
76 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
77 connect (this, &terminal_dock_widget::new_command_line_signal, |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
78 con, &console::new_command_line); |
31087
9c0099048264
exp cmd widget: fix missing promt after error
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31068
diff
changeset
|
79 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
80 m_terminal = widget; |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
81 #endif |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
82 } |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
83 else |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
84 { |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
85 QTerminal *widget = QTerminal::create (this); |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
86 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
87 connect (this, &terminal_dock_widget::settings_changed, |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
88 widget, &QTerminal::notice_settings); |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
89 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
90 // Connect the visibility signal to the terminal for |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
91 // dis-/enabling timers. |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
92 connect (this, &terminal_dock_widget::visibilityChanged, |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
93 widget, &QTerminal::handle_visibility_changed); |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
94 |
33239
775dde0cb3e5
use qOverload<T>(fptr) instead of QOverload<T>::of(fptr)
John W. Eaton <jwe@octave.org>
parents:
32633
diff
changeset
|
95 connect (widget, qOverload<const fcn_callback&> (&QTerminal::interpreter_event), |
775dde0cb3e5
use qOverload<T>(fptr) instead of QOverload<T>::of(fptr)
John W. Eaton <jwe@octave.org>
parents:
32633
diff
changeset
|
96 this, qOverload<const fcn_callback&> (&terminal_dock_widget::interpreter_event)); |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
97 |
33239
775dde0cb3e5
use qOverload<T>(fptr) instead of QOverload<T>::of(fptr)
John W. Eaton <jwe@octave.org>
parents:
32633
diff
changeset
|
98 connect (widget, qOverload<const meth_callback&> (&QTerminal::interpreter_event), |
775dde0cb3e5
use qOverload<T>(fptr) instead of QOverload<T>::of(fptr)
John W. Eaton <jwe@octave.org>
parents:
32633
diff
changeset
|
99 this, qOverload<const meth_callback&> (&terminal_dock_widget::interpreter_event)); |
17920
5c3f22dd0bbb
raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents:
17790
diff
changeset
|
100 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
101 m_terminal = widget; |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
102 } |
23808
2b1b2a795ba6
update clickable urls in terminal also when visible terminal has no focus
Torsten <mttl@mailbox.org>
parents:
23220
diff
changeset
|
103 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
104 m_terminal->setObjectName ("OctaveTerminal"); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
105 m_terminal->setFocusPolicy (Qt::StrongFocus); |
17920
5c3f22dd0bbb
raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents:
17790
diff
changeset
|
106 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
107 set_title (tr ("Command Window")); |
24733
e15d53d2de1e
move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
108 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
109 setWidget (m_terminal); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
110 setFocusProxy (m_terminal); |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
111 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
112 // Chose a reasonable size at startup in order to avoid truncated |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
113 // startup messages |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
114 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
115 gui_settings settings; |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
116 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
117 QFont font = QFont (); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
118 font.setStyleHint (QFont::TypeWriter); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
119 QString default_font = settings.string_value (global_mono_font); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
120 font.setFamily |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
121 (settings.value (cs_font.settings_key (), default_font).toString ()); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
122 font.setPointSize |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
123 (settings.int_value (cs_font_size)); |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
124 |
33359
689d4d069bbf
maint: Use Octave coding convention of space between function name and parentheses in libgui/.
Rik <rik@octave.org>
parents:
33239
diff
changeset
|
125 QFontMetrics metrics (font); |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
126 |
33359
689d4d069bbf
maint: Use Octave coding convention of space between function name and parentheses in libgui/.
Rik <rik@octave.org>
parents:
33239
diff
changeset
|
127 int win_x = metrics.maxWidth ()*80; |
689d4d069bbf
maint: Use Octave coding convention of space between function name and parentheses in libgui/.
Rik <rik@octave.org>
parents:
33239
diff
changeset
|
128 int win_y = metrics.height ()*25; |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
129 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
130 int max_x = QGuiApplication::primaryScreen ()->availableGeometry ().width (); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
131 int max_y = QGuiApplication::primaryScreen ()->availableGeometry ().height (); |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
132 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
133 if (win_x > max_x) |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
134 win_x = max_x; |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
135 if (win_y > max_y) |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
136 win_y = max_y; |
24791
9421e891294e
fix truncated startup message in terminal widget on windows (bug #53189)
Torsten <mttl@mailbox.org>
parents:
24768
diff
changeset
|
137 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
138 setGeometry (0, 0, win_x, win_y); |
29787
b4d2fa28d1d4
allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents:
29783
diff
changeset
|
139 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
140 if (! p) |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
141 make_window (); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
142 } |
24011
9107bae20480
style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents:
23808
diff
changeset
|
143 |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
144 bool |
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
145 terminal_dock_widget::has_focus () const |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
146 { |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
147 QWidget *w = widget (); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
148 return w->hasFocus (); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
149 } |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
150 |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
151 QTerminal * |
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
152 terminal_dock_widget::get_qterminal () |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
153 { |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
154 return (m_experimental_terminal_widget |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
155 ? nullptr : dynamic_cast<QTerminal *> (m_terminal)); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
156 } |
29783
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
157 |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
158 #if defined (HAVE_QSCINTILLA) |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
159 command_widget * |
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
160 terminal_dock_widget::get_command_widget () |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
161 { |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
162 return (m_experimental_terminal_widget |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
163 ? dynamic_cast<command_widget *> (m_terminal) : nullptr); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
164 } |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
165 #endif |
29783
5154c91e0d98
eliminate some connections to parent objects in octave_dock_widget classes
John W. Eaton <jwe@octave.org>
parents:
29611
diff
changeset
|
166 |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
167 void |
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
168 terminal_dock_widget::notice_settings () |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
169 { |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
170 emit settings_changed (); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
171 } |
29611
d64ad3b93372
eliminate direct parent to child connection in terminal dock widget
John W. Eaton <jwe@octave.org>
parents:
29550
diff
changeset
|
172 |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
173 void |
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
174 terminal_dock_widget::init_command_prompt () |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
175 { |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
176 if (m_experimental_terminal_widget) |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
177 { |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
178 #if defined (HAVE_QSCINTILLA) |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
179 command_widget *cmd = get_command_widget (); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
180 if (cmd) |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
181 cmd->init_command_prompt (); |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31087
diff
changeset
|
182 #endif |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
183 } |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
184 } |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
185 |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
186 void |
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
187 terminal_dock_widget::init_control_d_shortcut_behavior () |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
188 { |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
189 gui_settings settings; |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
190 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
191 // Reset use of Ctrl-D. Do this before the call to beginGroup |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
192 // because sc_main_ctrld.key already begins with the sc_group |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
193 // prefix. |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
194 settings.setValue (sc_main_ctrld.settings_key (), false); |
29611
d64ad3b93372
eliminate direct parent to child connection in terminal dock widget
John W. Eaton <jwe@octave.org>
parents:
29550
diff
changeset
|
195 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
196 settings.beginGroup (sc_group); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
197 const QStringList shortcut_settings_keys = settings.allKeys (); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
198 settings.endGroup (); |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
199 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
200 for (const auto& settings_key : shortcut_settings_keys) |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
201 { |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
202 // Check whether Ctrl+D is used from main window, i.e. is a |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
203 // global shortcut. |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
204 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
205 QString section = get_shortcut_section (settings_key); |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
206 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
207 if (section.startsWith ("main_")) |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
208 { |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
209 sc_pref scpref = all_shortcut_preferences::value (settings_key); |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
210 |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
211 QKeySequence actual = QKeySequence (settings.sc_value (scpref)); |
31696
8fed04d0607c
eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents:
31649
diff
changeset
|
212 |
31995
49d21a7b25a8
Replace deprecated QKeyCombination::operator+ by QKeyCombination::operator|.
Markus Mützel <markus.muetzel@gmx.de>
parents:
31808
diff
changeset
|
213 if (actual == QKeySequence (Qt::ControlModifier | Qt::Key_D)) |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
214 { |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
215 settings.setValue (sc_main_ctrld.settings_key (), true); |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
216 break; |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
217 } |
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
218 } |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31995
diff
changeset
|
219 } |
31808
90621682cc03
maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
220 } |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
221 |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
31222
diff
changeset
|
222 OCTAVE_END_NAMESPACE(octave) |