Mercurial > octave
annotate libgui/graphics/Figure.cc @ 23447:db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
* Backend.cc, BaseControl.cc, ButtonControl.cc, ButtonGroup.cc, Canvas.cc,
Container.cc, ContextMenu.cc, Figure.cc, ListBoxControl.cc, Menu.cc,
MouseModeActionGroup.cc, Object.cc, Object.h, Panel.cc, RadioButtonControl.cc,
ToggleButtonControl.cc, ToolBar.cc, ToolBarButton.cc, annotation-dialog.cc,
file-editor-tab.cc, main-window.cc, webinfo.cc, data.cc, ft-text-renderer.cc,
graphics.in.h, zfstream.h, __init_fltk__.cc, __osmesa_print__.cc, gzip.cc,
ov-java.cc, bp-table.cc, oct-time.cc, lo-utils.cc, oct-base64.cc,
url-transfer.cc:
Use convention "static_cast<void *>" for casting of pointers.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 27 Apr 2017 10:04:31 -0700 |
parents | 73f7ef7169ac |
children | c763214a8260 |
rev | line source |
---|---|
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 2011-2017 Michael Goffioul |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 |
18500
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18498
diff
changeset
|
5 This file is part of Octave. |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 |
18500
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18498
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22744
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22744
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22744
diff
changeset
|
10 (at your option) any later version. |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22744
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22744
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22744
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22744
diff
changeset
|
15 GNU General Public License for more details. |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
18500
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18498
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18498
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 */ |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21662
diff
changeset
|
23 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
24 # include "config.h" |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 #endif |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 #include <QAction> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #include <QActionEvent> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #include <QActionGroup> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 #include <QApplication> |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
31 #include <QClipboard> |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include <QEvent> |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
33 #include <QFileDialog> |
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
34 #include <QFileInfo> |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 #include <QFrame> |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
36 #include <QImage> |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 #include <QMainWindow> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 #include <QMenu> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 #include <QMenuBar> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 #include <QMessageBox> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 #include <QtDebug> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 #include <QTimer> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 #include <QToolBar> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 #include "Canvas.h" |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 #include "Container.h" |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 #include "Figure.h" |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 #include "FigureWindow.h" |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 #include "MouseModeActionGroup.h" |
18505
fb96b7f55242
rename file to avoid clash on case-insenstive filesystems (bug #41658)
John W. Eaton <jwe@octave.org>
parents:
18501
diff
changeset
|
50 #include "QtHandlesUtils.h" |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
52 #include "file-ops.h" |
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
53 #include "unwind-prot.h" |
20085
c58cf3a65519
improve copy to clipboard code for Qt plotting
John W. Eaton <jwe@octave.org>
parents:
20079
diff
changeset
|
54 #include "utils.h" |
21916
3a0c90b59584
Make qt figure window "Help" menu correspond to main window (bug #48223)
Mike Miller <mtmiller@octave.org>
parents:
21824
diff
changeset
|
55 #include "version.h" |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
56 |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
57 #include "octave-qt-link.h" |
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
58 |
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
59 #include "builtin-defun-decls.h" |
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
60 |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
61 namespace QtHandles |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
64 DECLARE_GENERICEVENTNOTIFY_SENDER(MenuBar, QMenuBar); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
65 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
66 static bool |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
67 hasUiControlChildren (const figure::properties& fp) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
68 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
69 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
70 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
71 Matrix kids = fp.get_all_children (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
72 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
73 for (int i = 0; i < kids.numel (); i++) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
74 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
75 graphics_object go (gh_manager::get_object (kids(i))); |
19954
b6061813a693
always obtain gh_manager lock before accessing graphics objects
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
76 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
77 if (go && (go.isa ("uicontrol") || go.isa ("uipanel") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
78 || go.isa ("uibuttongroup"))) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
79 return true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
80 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
81 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
82 return false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
83 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
84 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
85 static bool |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
86 hasUiMenuChildren (const figure::properties& fp) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
87 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
88 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
89 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
90 Matrix kids = fp.get_all_children (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
91 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
92 for (int i = 0; i < kids.numel (); i++) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
93 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
94 graphics_object go (gh_manager::get_object (kids(i))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
95 |
22757
90281ac10fb4
maint: Trim trailing whitespace from files.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
96 if (go && go.isa ("uimenu") && |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
97 go.get ("visible").string_value () == "on") |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
98 return true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
99 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
100 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
101 return false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
102 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
103 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
104 static QRect |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
105 boundingBoxToRect (const Matrix& bb) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
106 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
107 QRect r; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
108 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
109 if (bb.numel () == 4) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
110 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
111 r = QRect (octave::math::round (bb(0)), octave::math::round (bb(1)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
112 octave::math::round (bb(2)), octave::math::round (bb(3))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
113 if (! r.isValid ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
114 r = QRect (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
115 } |
19954
b6061813a693
always obtain gh_manager lock before accessing graphics objects
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
116 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
117 return r; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
118 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
119 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
120 Figure* |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
121 Figure::create (const graphics_object& go) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
122 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
123 return new Figure (go, new FigureWindow ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
124 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
125 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
126 Figure::Figure (const graphics_object& go, FigureWindow* win) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
127 : Object (go, win), m_blockUpdates (false), m_figureToolBar (0), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
128 m_menuBar (0), m_innerRect (), m_outerRect (), m_mouseModeGroup (0) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
129 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
130 m_container = new Container (win); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
131 win->setCentralWidget (m_container); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
132 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
133 figure::properties& fp = properties<figure> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
134 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
135 // Status bar |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
136 m_statusBar = win->statusBar (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
137 int boffset = 0; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
138 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
139 // Toolbar and menubar |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
140 createFigureToolBarAndMenuBar (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
141 int toffset = 0; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
142 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
143 if (fp.toolbar_is ("figure") || |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
144 (fp.toolbar_is ("auto") && fp.menubar_is ("figure") && |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
145 ! hasUiControlChildren (fp))) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
146 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
147 toffset += m_figureToolBar->sizeHint ().height (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
148 boffset += m_statusBar->sizeHint ().height (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
149 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
150 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
151 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
152 m_figureToolBar->hide (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
153 m_statusBar->hide (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
154 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
155 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
156 if (fp.menubar_is ("figure") || hasUiMenuChildren (fp)) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
157 toffset += m_menuBar->sizeHint ().height (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
158 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
159 m_menuBar->hide (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
160 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
161 m_innerRect = boundingBoxToRect (fp.get_boundingbox (true)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
162 m_outerRect = boundingBoxToRect (fp.get_boundingbox (false)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
163 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
164 win->setGeometry (m_innerRect.adjusted (0, -toffset, 0, boffset)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
165 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
166 // Enable mouse tracking unconditionally |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
167 enableMouseTracking (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
168 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
169 // When this constructor gets called all properties are already |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
170 // set, even non default. We force "update" here to get things right. |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
171 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
172 // Figure title |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
173 update (figure::properties::ID_NUMBERTITLE); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
174 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
175 // Decide what keyboard events we listen to |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
176 m_container->canvas (m_handle)->setEventMask (0); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
177 update (figure::properties::ID_KEYPRESSFCN); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
178 update (figure::properties::ID_KEYRELEASEFCN); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
179 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
180 // modal style |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
181 update (figure::properties::ID_WINDOWSTYLE); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
182 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
183 // Visibility |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
184 update (figure::properties::ID_VISIBLE); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
185 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
186 connect (this, SIGNAL (asyncUpdate (void)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
187 this, SLOT (updateContainer (void))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
188 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
189 win->addReceiver (this); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
190 m_container->addReceiver (this); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
191 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
192 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
193 Figure::~Figure (void) |
22417
48c00363dc74
maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents:
22413
diff
changeset
|
194 { } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
195 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
196 static std::string |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
197 mouse_mode_to_string (MouseMode mode) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
198 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
199 switch (mode) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
200 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
201 case NoMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
202 return "none"; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
203 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
204 case RotateMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
205 return "rotate"; |
20531
dcfbf4c1c3c8
eliminate trailing whitespace and tabs from sources
John W. Eaton <jwe@octave.org>
parents:
20524
diff
changeset
|
206 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
207 case ZoomInMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
208 return "zoom in"; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
209 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
210 case ZoomOutMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
211 return "zoom out"; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
212 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
213 case PanMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
214 return "pan"; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
215 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
216 case TextMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
217 return "text"; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
218 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
219 case SelectMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
220 return "select"; |
20270
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
221 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
222 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
223 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
224 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
225 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
226 return "none"; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
227 } |
20504
b6ae0ef9327e
Display bottom Qt statusbar on figure based on "toolbar" property (bug #46025).
Rik <rik@octave.org>
parents:
20270
diff
changeset
|
228 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
229 static MouseMode |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
230 mouse_mode_from_string (const std::string& mode) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
231 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
232 if (mode == "none") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
233 return NoMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
234 else if (mode == "rotate") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
235 return RotateMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
236 else if (mode == "zoom in") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
237 return ZoomInMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
238 else if (mode == "zoom out") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
239 return ZoomOutMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
240 else if (mode == "pan") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
241 return PanMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
242 else if (mode == "text") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
243 return TextMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
244 else if (mode == "select") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
245 return SelectMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
246 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
247 return NoMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
248 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
249 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
250 QString |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
251 Figure::fileName (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
252 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
253 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
254 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
255 const figure::properties& fp = properties<figure> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
256 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
257 std::string name = fp.get_filename (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
258 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
259 return QString::fromStdString (name); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
260 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
261 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
262 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
263 Figure::setFileName (const QString& name) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
264 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
265 gh_manager::auto_lock lock; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
266 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
267 figure::properties& fp = properties<figure> (); |
20537
d0f886a030b7
Use "update" method to initialize Qt Figures (cleanup + bug #46086)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20531
diff
changeset
|
268 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
269 fp.set_filename (name.toStdString ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
270 } |
20594
46edfbd31ad7
Fix execution of "windowbuttonmotionfcn" with uipanels (bug #46151)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20537
diff
changeset
|
271 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
272 MouseMode |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
273 Figure::mouseMode (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
274 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
275 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
276 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
277 const figure::properties& fp = properties<figure> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
278 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
279 std::string mode = fp.get___mouse_mode__ (); |
20537
d0f886a030b7
Use "update" method to initialize Qt Figures (cleanup + bug #46086)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20531
diff
changeset
|
280 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
281 if (mode == "zoom") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
282 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
283 octave_scalar_map zm = fp.get___zoom_mode__ ().scalar_map_value (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
284 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
285 std::string direction = zm.getfield ("Direction").string_value (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
286 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
287 mode += " " + direction; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
288 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
289 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
290 return mouse_mode_from_string (mode); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
291 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
292 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
293 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
294 Figure::createFigureToolBarAndMenuBar (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
295 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
296 QMainWindow* win = qWidget<QMainWindow> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
297 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
298 m_figureToolBar = win->addToolBar (tr ("Figure ToolBar")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
299 m_figureToolBar->setMovable (false); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
300 m_figureToolBar->setFloatable (false); |
21996
d6370831d37f
Set Qt Figure window modal/normal state based on WindowStyle (Bug #48160)
John Donoghue <john.donoghue@ieee.org>
parents:
21916
diff
changeset
|
301 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
302 m_mouseModeGroup = new MouseModeActionGroup (win); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
303 connect (m_mouseModeGroup, SIGNAL (modeChanged (MouseMode)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
304 SLOT (setMouseMode (MouseMode))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
305 m_figureToolBar->addActions (m_mouseModeGroup->actions ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
306 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
307 QAction *toggle_axes = m_figureToolBar->addAction (tr ("Axes")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
308 connect (toggle_axes, SIGNAL (triggered (void)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
309 this, SLOT (toggleAxes (void))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
310 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
311 QAction *toggle_grid = m_figureToolBar->addAction (tr ("Grid")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
312 connect (toggle_grid, SIGNAL (triggered (void)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
313 this, SLOT (toggleGrid (void))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
314 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
315 QAction *auto_axes = m_figureToolBar->addAction (tr ("Autoscale")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
316 connect (auto_axes, SIGNAL (triggered (void)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
317 this, SLOT (autoAxes (void))); |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20595
diff
changeset
|
318 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
319 m_menuBar = new MenuBar (win); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
320 win->setMenuBar (m_menuBar); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
321 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
322 QMenu* fileMenu = m_menuBar->addMenu (tr ("&File")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
323 fileMenu->menuAction ()->setObjectName ("builtinMenu"); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
324 fileMenu->addAction (tr ("&Save"), this, SLOT (fileSaveFigure (bool))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
325 fileMenu->addAction (tr ("Save &As"), this, SLOT (fileSaveFigureAs (void))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
326 fileMenu->addSeparator (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
327 fileMenu->addAction (tr ("&Close Figure"), this, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
328 SLOT (fileCloseFigure (void)), Qt::CTRL | Qt::Key_W); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
329 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
330 QMenu* editMenu = m_menuBar->addMenu (tr ("&Edit")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
331 editMenu->menuAction ()->setObjectName ("builtinMenu"); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
332 editMenu->addAction (tr ("Cop&y"), this, SLOT (editCopy (bool)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
333 Qt::CTRL | Qt::Key_C); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
334 editMenu->addSeparator (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
335 editMenu->addActions (m_mouseModeGroup->actions ()); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
336 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
337 QMenu* helpMenu = m_menuBar->addMenu (tr ("&Help")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
338 helpMenu->menuAction ()->setObjectName ("builtinMenu"); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
339 helpMenu->addAction (tr ("About Octave"), this, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
340 SLOT (helpAboutOctave (void))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
341 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
342 m_menuBar->addReceiver (this); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
343 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
344 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
345 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
346 Figure::updateFigureToolBarAndMenuBar (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
347 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
348 if (m_mouseModeGroup) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
349 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
350 m_blockUpdates = true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
351 m_mouseModeGroup->setMode (mouseMode ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
352 m_blockUpdates = false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
353 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
354 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
355 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
356 Container* |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
357 Figure::innerContainer (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
358 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
359 return m_container; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
360 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
361 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
362 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
363 Figure::redraw (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
364 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
365 Canvas* canvas = m_container->canvas (m_handle); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
366 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
367 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
368 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
369 canvas->redraw (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
370 //canvas->setMouseMode (RotateMode); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
371 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
372 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
373 foreach (QFrame* frame, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
374 qWidget<QWidget> ()->findChildren<QFrame*> ()) |
23223
4b642b593ec2
maint: Indent foreach blocks in Qt GUI code for readability.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
375 { |
4b642b593ec2
maint: Indent foreach blocks in Qt GUI code for readability.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
376 if (frame->objectName () == "UIPanel" |
4b642b593ec2
maint: Indent foreach blocks in Qt GUI code for readability.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
377 || frame->objectName () == "UIButtonGroup") |
4b642b593ec2
maint: Indent foreach blocks in Qt GUI code for readability.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
378 { |
4b642b593ec2
maint: Indent foreach blocks in Qt GUI code for readability.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
379 Object* obj = Object::fromQObject (frame); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
380 |
23223
4b642b593ec2
maint: Indent foreach blocks in Qt GUI code for readability.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
381 if (obj) |
4b642b593ec2
maint: Indent foreach blocks in Qt GUI code for readability.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
382 obj->slotRedraw (); |
4b642b593ec2
maint: Indent foreach blocks in Qt GUI code for readability.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
383 } |
4b642b593ec2
maint: Indent foreach blocks in Qt GUI code for readability.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
384 } |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
385 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
386 updateFigureToolBarAndMenuBar (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
387 } |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
388 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
389 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
390 Figure::print (const QString& file_cmd, const QString& term) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
391 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
392 Canvas* canvas = m_container->canvas (m_handle); |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
393 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
394 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
395 canvas->print (file_cmd, term); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
396 } |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
397 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
398 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
399 Figure::beingDeleted (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
400 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
401 Canvas* canvas = m_container->canvas (m_handle.value (), false); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
402 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
403 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
404 canvas->blockRedraw (true); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
405 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
406 m_menuBar->removeReceiver (this); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
407 m_container->removeReceiver (this); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
408 qWidget<FigureWindow> ()->removeReceiver (this); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
409 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
410 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
411 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
412 Figure::update (int pId) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
413 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
414 if (m_blockUpdates) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
415 return; |
19681
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
416 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
417 figure::properties& fp = properties<figure> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
418 QMainWindow* win = qWidget<QMainWindow> (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
419 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
420 m_blockUpdates = true; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
421 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
422 switch (pId) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
423 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
424 case figure::properties::ID_POSITION: |
19621
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19616
diff
changeset
|
425 { |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
426 m_innerRect = boundingBoxToRect (fp.get_boundingbox (true)); |
20270
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
427 int toffset = 0; |
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
428 int boffset = 0; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
429 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
430 foreach (QToolBar* tb, win->findChildren<QToolBar*> ()) |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
431 if (! tb->isHidden ()) |
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
432 toffset += tb->sizeHint ().height (); |
20270
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
433 |
19621
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19616
diff
changeset
|
434 if (! m_menuBar->isHidden ()) |
22370
0a2961d5893c
Fix calculation of window height in Qt, FLTK (bug #48833, bug #48522).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22323
diff
changeset
|
435 toffset += m_menuBar->sizeHint ().height (); |
20531
dcfbf4c1c3c8
eliminate trailing whitespace and tabs from sources
John W. Eaton <jwe@octave.org>
parents:
20524
diff
changeset
|
436 |
20270
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
437 if (! m_statusBar->isHidden ()) |
22370
0a2961d5893c
Fix calculation of window height in Qt, FLTK (bug #48833, bug #48522).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22323
diff
changeset
|
438 boffset += m_statusBar->sizeHint ().height (); |
20270
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
439 |
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
440 win->setGeometry (m_innerRect.adjusted (0, -toffset, 0, boffset)); |
19621
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19616
diff
changeset
|
441 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
442 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
443 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
444 case figure::properties::ID_NAME: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
445 case figure::properties::ID_NUMBERTITLE: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
446 win->setWindowTitle (Utils::fromStdString (fp.get_title ())); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
447 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
448 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
449 case figure::properties::ID_VISIBLE: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
450 if (fp.is_visible ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
451 QTimer::singleShot (0, win, SLOT (show ())); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
452 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
453 win->hide (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
454 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
455 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
456 case figure::properties::ID_TOOLBAR: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
457 if (fp.toolbar_is ("none")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
458 showFigureToolBar (false); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
459 else if (fp.toolbar_is ("figure")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
460 showFigureToolBar (true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
461 else // "auto" |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
462 showFigureToolBar (! hasUiControlChildren (fp) && |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
463 fp.menubar_is ("figure")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
464 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
465 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
466 case figure::properties::ID_MENUBAR: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
467 showMenuBar (fp.menubar_is ("figure")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
468 if (fp.toolbar_is ("auto")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
469 showFigureToolBar (fp.menubar_is ("figure")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
470 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
471 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
472 case figure::properties::ID_KEYPRESSFCN: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
473 if (fp.get_keypressfcn ().is_empty ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
474 m_container->canvas (m_handle)->clearEventMask (Canvas::KeyPress); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
475 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
476 m_container->canvas (m_handle)->addEventMask (Canvas::KeyPress); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
477 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
478 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
479 case figure::properties::ID_KEYRELEASEFCN: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
480 if (fp.get_keyreleasefcn ().is_empty ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
481 m_container->canvas (m_handle)->clearEventMask (Canvas::KeyRelease); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
482 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
483 m_container->canvas (m_handle)->addEventMask (Canvas::KeyRelease); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
484 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
485 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
486 case figure::properties::ID_WINDOWSTYLE: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
487 if (fp.windowstyle_is ("modal")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
488 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
489 bool is_visible = win->isVisible (); |
21996
d6370831d37f
Set Qt Figure window modal/normal state based on WindowStyle (Bug #48160)
John Donoghue <john.donoghue@ieee.org>
parents:
21916
diff
changeset
|
490 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
491 // if window is already visible, need to hide and reshow it in order to |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
492 // make it use the modal settings |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
493 if (is_visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
494 win->setVisible (false); |
21996
d6370831d37f
Set Qt Figure window modal/normal state based on WindowStyle (Bug #48160)
John Donoghue <john.donoghue@ieee.org>
parents:
21916
diff
changeset
|
495 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
496 win->setWindowModality (Qt::ApplicationModal); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
497 win->setVisible (is_visible); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
498 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
499 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
500 win->setWindowModality (Qt::NonModal); |
21996
d6370831d37f
Set Qt Figure window modal/normal state based on WindowStyle (Bug #48160)
John Donoghue <john.donoghue@ieee.org>
parents:
21916
diff
changeset
|
501 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
502 break; |
21996
d6370831d37f
Set Qt Figure window modal/normal state based on WindowStyle (Bug #48160)
John Donoghue <john.donoghue@ieee.org>
parents:
21916
diff
changeset
|
503 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
504 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
505 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
506 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
507 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
508 m_blockUpdates = false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
509 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
510 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
511 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
512 Figure::showFigureToolBar (bool visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
513 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
514 if ((! m_figureToolBar->isHidden ()) != visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
515 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
516 int dy1 = m_figureToolBar->sizeHint ().height (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
517 int dy2 = m_statusBar->sizeHint ().height (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
518 QRect r = qWidget<QWidget> ()->geometry (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
519 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
520 if (! visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
521 r.adjust (0, dy1, 0, -dy2); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
522 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
523 r.adjust (0, -dy1, 0, dy2); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
524 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
525 m_blockUpdates = true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
526 qWidget<QWidget> ()->setGeometry (r); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
527 m_figureToolBar->setVisible (visible); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
528 m_statusBar->setVisible (visible); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
529 m_blockUpdates = false; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
530 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
531 updateBoundingBox (false); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
532 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
533 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
534 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
535 void |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
536 Figure::showMenuBar (bool visible, int h1) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
537 { |
22757
90281ac10fb4
maint: Trim trailing whitespace from files.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
538 // Get the height before and after toggling the visibility of builtin menus |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
539 if (h1 <= 0) |
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
540 h1 = m_menuBar->sizeHint ().height (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
541 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
542 foreach (QAction* a, m_menuBar->actions ()) |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
543 if (a->objectName () == "builtinMenu") |
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
544 a->setVisible (visible); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
545 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
546 int h2 = m_menuBar->sizeHint ().height (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
547 |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
548 // Keep the menubar visible if it contains custom menus |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
549 if (! visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
550 visible = hasUiMenuChildren (properties<figure> ()); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
551 |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
552 if (m_menuBar->isVisible () ^ visible) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
553 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
554 int dy = qMax (h1, h2); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
555 QRect r = qWidget<QWidget> ()->geometry (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
556 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
557 if (! visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
558 r.adjust (0, dy, 0, 0); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
559 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
560 r.adjust (0, -dy, 0, 0); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
561 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
562 m_blockUpdates = true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
563 qWidget<QWidget> ()->setGeometry (r); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
564 m_menuBar->setVisible (visible); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
565 m_blockUpdates = false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
566 } |
22721
0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22417
diff
changeset
|
567 updateBoundingBox (false); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
568 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
569 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
570 void |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
571 Figure::updateMenuBar (int height) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
572 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
573 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
574 graphics_object go = object (); |
20270
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
575 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
576 if (go.valid_object ()) |
22757
90281ac10fb4
maint: Trim trailing whitespace from files.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
577 showMenuBar (Utils::properties<figure> (go).menubar_is ("figure"), |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
578 height); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
579 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
580 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
581 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
582 Figure::updateStatusBar (ColumnVector pt) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
583 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
584 if (! m_statusBar->isHidden ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
585 m_statusBar->showMessage (QString ("(%1, %2)") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
586 .arg (pt(0), 0, 'g', 5) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
587 .arg (pt(1), 0, 'g', 5)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
588 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
589 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
590 QWidget* |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
591 Figure::menu (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
592 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
593 return qWidget<QMainWindow> ()->menuBar (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
594 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
595 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
596 struct UpdateBoundingBoxData |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
597 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
598 Matrix m_bbox; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
599 bool m_internal; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
600 graphics_handle m_handle; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
601 Figure* m_figure; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
602 }; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
603 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
604 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
605 Figure::updateBoundingBoxHelper (void* data) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
606 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
607 gh_manager::auto_lock lock; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
608 |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23224
diff
changeset
|
609 UpdateBoundingBoxData* d = reinterpret_cast<UpdateBoundingBoxData *> (data); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
610 graphics_object go = gh_manager::get_object (d->m_handle); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
611 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
612 if (go.valid_object ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
613 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
614 figure::properties& fp = Utils::properties<figure> (go); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
615 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
616 fp.set_boundingbox (d->m_bbox, d->m_internal, false); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
617 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
618 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
619 delete d; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
620 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
621 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
622 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
623 Figure::updateBoundingBox (bool internal, int flags) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
624 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
625 QWidget* win = qWidget<QWidget> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
626 Matrix bb (1, 4); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
627 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
628 if (internal) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
629 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
630 QRect r = m_innerRect; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
631 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
632 if (flags & UpdateBoundingBoxPosition) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
633 r.moveTopLeft (win->mapToGlobal (m_container->pos ())); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
634 if (flags & UpdateBoundingBoxSize) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
635 r.setSize (m_container->size ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
636 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
637 if (r.isValid () && r != m_innerRect) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
638 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
639 m_innerRect = r; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
640 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
641 bb(0) = r.x (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
642 bb(1) = r.y (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
643 bb(2) = r.width (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
644 bb(3) = r.height (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
645 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
646 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
647 return; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
648 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
649 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
650 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
651 QRect r = m_outerRect; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
652 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
653 if (flags & UpdateBoundingBoxPosition) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
654 r.moveTopLeft (win->pos ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
655 if (flags & UpdateBoundingBoxSize) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
656 r.setSize (win->frameGeometry ().size ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
657 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
658 if (r.isValid () && r != m_outerRect) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
659 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
660 m_outerRect = r; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
661 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
662 bb(0) = r.x (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
663 bb(1) = r.y (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
664 bb(2) = r.width (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
665 bb(3) = r.height (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
666 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
667 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
668 return; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
669 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
670 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
671 UpdateBoundingBoxData* d = new UpdateBoundingBoxData (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
672 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
673 d->m_bbox = bb; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
674 d->m_internal = internal; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
675 d->m_handle = m_handle; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
676 d->m_figure = this; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
677 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
678 gh_manager::post_function (Figure::updateBoundingBoxHelper, d); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
679 } |
20594
46edfbd31ad7
Fix execution of "windowbuttonmotionfcn" with uipanels (bug #46151)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20537
diff
changeset
|
680 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
681 bool |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
682 Figure::eventNotifyBefore (QObject* obj, QEvent* xevent) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
683 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
684 if (! m_blockUpdates) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
685 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
686 if (obj == m_container) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
687 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
688 // Do nothing... |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
689 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
690 else if (obj == m_menuBar) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
691 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
692 switch (xevent->type ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
693 { |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
694 case QEvent::ActionChanged: |
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
695 m_previousHeight = m_menuBar->sizeHint ().height (); |
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
696 break; |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
697 case QEvent::ActionRemoved: |
19621
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19616
diff
changeset
|
698 { |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23224
diff
changeset
|
699 QAction* a = dynamic_cast<QActionEvent *> (xevent)->action (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
700 |
19621
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19616
diff
changeset
|
701 if (! a->isSeparator () |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
702 && a->objectName () != "builtinMenu") |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
703 updateMenuBar (); |
19621
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19616
diff
changeset
|
704 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
705 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
706 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
707 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
708 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
709 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
710 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
711 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
712 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
713 switch (xevent->type ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
714 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
715 case QEvent::Close: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
716 xevent->ignore (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
717 gh_manager::post_callback (m_handle, "closerequestfcn"); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
718 return true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
719 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
720 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
721 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
722 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
723 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
724 } |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
725 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
726 return false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
727 } |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
728 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
729 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
730 Figure::eventNotifyAfter (QObject* watched, QEvent* xevent) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
731 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
732 if (! m_blockUpdates) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
733 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
734 if (watched == m_container) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
735 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
736 switch (xevent->type ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
737 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
738 case QEvent::Resize: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
739 updateBoundingBox (true, UpdateBoundingBoxSize); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
740 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
741 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
742 case QEvent::ChildAdded: |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23224
diff
changeset
|
743 if (dynamic_cast<QChildEvent *> (xevent)->child |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
744 ()->isWidgetType()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
745 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
746 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
747 update (figure::properties::ID_TOOLBAR); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
748 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
749 enableMouseTracking (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
750 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
751 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
752 case QEvent::ChildRemoved: |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23224
diff
changeset
|
753 if (dynamic_cast<QChildEvent *> (xevent)->child |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
754 ()->isWidgetType()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
755 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
756 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
757 update (figure::properties::ID_TOOLBAR); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
758 } |
21916
3a0c90b59584
Make qt figure window "Help" menu correspond to main window (bug #48223)
Mike Miller <mtmiller@octave.org>
parents:
21824
diff
changeset
|
759 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
760 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
761 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
762 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
763 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
764 else if (watched == m_menuBar) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
765 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
766 switch (xevent->type ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
767 { |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
768 case QEvent::ActionChanged: |
23224
73f7ef7169ac
Make uimenu "Position" property Matlab-compatible (bug #50369).
Rik <rik@octave.org>
parents:
23223
diff
changeset
|
769 // The menubar may have been resized if no action is visible |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
770 { |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23224
diff
changeset
|
771 QAction* a = dynamic_cast<QActionEvent *> (xevent)->action (); |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
772 if (m_menuBar->sizeHint ().height () != m_previousHeight |
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
773 && a->objectName () != "builtinMenu" |
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
774 && ! a->isSeparator ()) |
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
775 updateMenuBar (m_previousHeight); |
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
776 } |
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
777 break; |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
778 case QEvent::ActionAdded: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
779 { |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23224
diff
changeset
|
780 QAction* a = dynamic_cast<QActionEvent *> (xevent)->action (); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
781 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
782 if (! a->isSeparator () |
22744
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
783 && a->objectName () != "builtinMenu" |
2df51376f587
Correctly handle visibility of custom menu items (bug #49529)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22721
diff
changeset
|
784 && a->isVisible ()) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
785 updateMenuBar (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
786 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
787 break; |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
788 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
789 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
790 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
791 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
792 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
793 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
794 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
795 switch (xevent->type ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
796 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
797 case QEvent::Move: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
798 updateBoundingBox (false, UpdateBoundingBoxPosition); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
799 updateBoundingBox (true, UpdateBoundingBoxPosition); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
800 break; |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
801 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
802 case QEvent::Resize: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
803 updateBoundingBox (false, UpdateBoundingBoxSize); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
804 break; |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
805 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
806 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
807 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
808 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
809 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
810 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
811 } |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
812 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
813 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
814 Figure::helpAboutOctave (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
815 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
816 std::string message |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
817 = octave_name_version_copyright_copying_warranty_and_bugs (true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
818 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
819 QMessageBox::about (qWidget<QMainWindow> (), tr ("About Octave"), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
820 QString::fromStdString (message)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
821 } |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
822 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
823 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
824 Figure::setMouseMode (MouseMode mode) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
825 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
826 if (m_blockUpdates) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
827 return; |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
828 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
829 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
830 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
831 figure::properties& fp = properties<figure> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
832 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
833 fp.set___mouse_mode__ (mouse_mode_to_string (mode)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
834 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
835 Canvas* canvas = m_container->canvas (m_handle); |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
836 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
837 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
838 canvas->setCursor (mode); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
839 } |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
840 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
841 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
842 Figure::fileSaveFigure (bool prompt) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
843 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
844 QString file = fileName (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
845 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
846 if (file.isEmpty ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
847 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
848 prompt = true; |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
849 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
850 file = "untitled.pdf"; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
851 } |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
852 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
853 if (prompt || file.isEmpty ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
854 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
855 QFileInfo finfo (file); |
20242
4c2d39de1e96
Allow saving/copying other figures than the currentfigure (bug #45226)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20181
diff
changeset
|
856 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
857 file = QFileDialog::getSaveFileName (qWidget<FigureWindow> (), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
858 tr ("Save Figure As"), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
859 finfo.absoluteFilePath (), 0, 0, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
860 QFileDialog::DontUseNativeDialog); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
861 } |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
862 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
863 if (! file.isEmpty ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
864 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
865 QFileInfo finfo (file); |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
866 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
867 setFileName (finfo.absoluteFilePath ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
868 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
869 octave_link::post_event (this, &Figure::save_figure_callback, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
870 file.toStdString ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
871 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
872 } |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
873 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
874 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
875 Figure::save_figure_callback (const std::string& file) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
876 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
877 figure::properties& fp = properties<figure> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
878 octave_value fnum = fp.get___myhandle__ ().as_octave_value (); |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
879 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
880 Ffeval (ovl ("print", fnum, file)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
881 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
882 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
883 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
884 Figure::copy_figure_callback (const std::string& format) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
885 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
886 std::string msg; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
887 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
888 std::string file = octave::sys::tempnam ("", "oct-", msg) + "." + format; |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
889 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
890 if (file.empty ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
891 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
892 // Report error? |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
893 return; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
894 } |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20114
diff
changeset
|
895 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
896 save_figure_callback (file); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
897 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
898 octave_link::copy_image_to_clipboard (file); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
899 } |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
900 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
901 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
902 Figure::fileSaveFigureAs (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
903 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
904 fileSaveFigure (true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
905 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
906 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
907 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
908 Figure::fileCloseFigure (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
909 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
910 qWidget<QMainWindow> ()->close (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
911 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
912 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
913 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
914 Figure::editCopy (bool /* choose_format */) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
915 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
916 QString format = "png"; |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
917 |
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
918 #if 0 |
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
919 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
920 // FIXME: allow choice of image formats. |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
921 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
922 if (choose_format) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
923 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
924 QFileInfo finfo (file); |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
925 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
926 format = QFileDialog::getSaveFileName (qWidget<FigureWindow> (), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
927 tr ("Save Figure As"), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
928 finfo.absoluteFilePath (), 0, 0, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
929 QFileDialog::DontUseNativeDialog); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
930 } |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
931 #endif |
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
932 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
933 octave_link::post_event (this, &Figure::copy_figure_callback, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
934 format.toStdString ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
935 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
936 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
937 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
938 Figure::addCustomToolBar (QToolBar* bar, bool visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
939 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
940 QMainWindow* win = qWidget<QMainWindow> (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
941 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
942 if (! visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
943 win->addToolBar (bar); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
944 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
945 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
946 QSize sz = bar->sizeHint (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
947 QRect r = win->geometry (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
948 //qDebug () << "Figure::addCustomToolBar:" << r; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
949 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
950 r.adjust (0, -sz.height (), 0, 0); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
951 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
952 m_blockUpdates = true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
953 win->setGeometry (r); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
954 win->addToolBarBreak (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
955 win->addToolBar (bar); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
956 m_blockUpdates = false; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
957 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
958 //qDebug () << "Figure::addCustomToolBar:" << win->geometry (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
959 updateBoundingBox (false); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
960 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
961 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
962 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
963 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
964 Figure::showCustomToolBar (QToolBar* bar, bool visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
965 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
966 QMainWindow* win = qWidget<QMainWindow> (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
967 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
968 if ((! bar->isHidden ()) != visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
969 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
970 QSize sz = bar->sizeHint (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
971 QRect r = win->geometry (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
972 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
973 if (visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
974 r.adjust (0, -sz.height (), 0, 0); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
975 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
976 r.adjust (0, sz.height (), 0, 0); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
977 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
978 m_blockUpdates = true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
979 win->setGeometry (r); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
980 bar->setVisible (visible); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
981 m_blockUpdates = false; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
982 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
983 updateBoundingBox (false); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
984 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
985 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
986 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
987 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
988 Figure::updateContainer (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
989 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
990 redraw (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
991 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
992 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
993 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
994 Figure::toggleAxes (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
995 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
996 Canvas* canvas = m_container->canvas (m_handle); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
997 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
998 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
999 canvas->toggleAxes (m_handle); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1000 } |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20114
diff
changeset
|
1001 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1002 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1003 Figure::toggleGrid (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1004 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1005 Canvas* canvas = m_container->canvas (m_handle); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
1006 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1007 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1008 canvas->toggleGrid (m_handle); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1009 } |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20114
diff
changeset
|
1010 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1011 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1012 Figure::autoAxes (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1013 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1014 Canvas* canvas = m_container->canvas (m_handle); |
19870
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
1015 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1016 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1017 canvas->autoAxes (m_handle); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1018 } |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20114
diff
changeset
|
1019 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1020 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1021 Figure::enableMouseTracking (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1022 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1023 // Enable mouse tracking on every widgets |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1024 m_container->setMouseTracking (true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1025 m_container->canvas (m_handle)->qWidget ()->setMouseTracking (true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1026 foreach (QWidget* w, m_container->findChildren<QWidget*> ()) |
23223
4b642b593ec2
maint: Indent foreach blocks in Qt GUI code for readability.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
1027 w->setMouseTracking (true); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1028 } |
20594
46edfbd31ad7
Fix execution of "windowbuttonmotionfcn" with uipanels (bug #46151)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20537
diff
changeset
|
1029 |
22413
8758addcf265
maint: Remove ';' at end of namespace declaration.
Rik <rik@octave.org>
parents:
22411
diff
changeset
|
1030 } |