Mercurial > octave
annotate libgui/graphics/Figure.cc @ 22721:0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
* Figure.cc (Figure::showMenubar): Remove if block preventing hidden menubar
from being restored. Remove leftover debug code.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Thu, 03 Nov 2016 23:45:38 +0100 |
parents | 48c00363dc74 |
children | 2df51376f587 |
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 |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
3 Copyright (C) 2011-2016 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 |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18498
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18498
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18498
diff
changeset
|
10 option) any later version. |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 |
18500
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18498
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18498
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18498
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
49877d3be064
update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents:
18498
diff
changeset
|
15 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 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
96 if (go && go.isa ("uimenu")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
97 return true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
98 } |
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 return false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
101 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
102 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
103 static QRect |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
104 boundingBoxToRect (const Matrix& bb) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
105 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
106 QRect r; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
107 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
108 if (bb.numel () == 4) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
109 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
110 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
|
111 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
|
112 if (! r.isValid ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
113 r = QRect (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
114 } |
19954
b6061813a693
always obtain gh_manager lock before accessing graphics objects
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
115 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
116 return r; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
117 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
118 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
119 Figure* |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
120 Figure::create (const graphics_object& go) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
121 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
122 return new Figure (go, new FigureWindow ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
123 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
124 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
125 Figure::Figure (const graphics_object& go, FigureWindow* win) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
126 : 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
|
127 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
|
128 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
129 m_container = new Container (win); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
130 win->setCentralWidget (m_container); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
131 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
132 figure::properties& fp = properties<figure> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
133 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
134 // Status bar |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
135 m_statusBar = win->statusBar (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
136 int boffset = 0; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
137 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
138 // Toolbar and menubar |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
139 createFigureToolBarAndMenuBar (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
140 int toffset = 0; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
141 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
142 if (fp.toolbar_is ("figure") || |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
143 (fp.toolbar_is ("auto") && fp.menubar_is ("figure") && |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
144 ! hasUiControlChildren (fp))) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
145 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
146 toffset += m_figureToolBar->sizeHint ().height (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
147 boffset += m_statusBar->sizeHint ().height (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
148 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
149 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
150 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
151 m_figureToolBar->hide (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
152 m_statusBar->hide (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
153 } |
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 if (fp.menubar_is ("figure") || hasUiMenuChildren (fp)) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
156 toffset += m_menuBar->sizeHint ().height (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
157 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
158 m_menuBar->hide (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
159 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
160 m_innerRect = boundingBoxToRect (fp.get_boundingbox (true)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
161 m_outerRect = boundingBoxToRect (fp.get_boundingbox (false)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
162 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
163 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
|
164 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
165 // Enable mouse tracking unconditionally |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
166 enableMouseTracking (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
167 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
168 // 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
|
169 // 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
|
170 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
171 // Figure title |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
172 update (figure::properties::ID_NUMBERTITLE); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
173 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
174 // Decide what keyboard events we listen to |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
175 m_container->canvas (m_handle)->setEventMask (0); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
176 update (figure::properties::ID_KEYPRESSFCN); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
177 update (figure::properties::ID_KEYRELEASEFCN); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
178 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
179 // modal style |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
180 update (figure::properties::ID_WINDOWSTYLE); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
181 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
182 // Visibility |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
183 update (figure::properties::ID_VISIBLE); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
184 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
185 connect (this, SIGNAL (asyncUpdate (void)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
186 this, SLOT (updateContainer (void))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
187 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
188 win->addReceiver (this); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
189 m_container->addReceiver (this); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
190 } |
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 Figure::~Figure (void) |
22417
48c00363dc74
maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents:
22413
diff
changeset
|
193 { } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
194 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
195 static std::string |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
196 mouse_mode_to_string (MouseMode mode) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
197 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
198 switch (mode) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
199 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
200 case NoMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
201 return "none"; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
202 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
203 case RotateMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
204 return "rotate"; |
20531
dcfbf4c1c3c8
eliminate trailing whitespace and tabs from sources
John W. Eaton <jwe@octave.org>
parents:
20524
diff
changeset
|
205 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
206 case ZoomInMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
207 return "zoom in"; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
208 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
209 case ZoomOutMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
210 return "zoom out"; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
211 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
212 case PanMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
213 return "pan"; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
214 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
215 case TextMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
216 return "text"; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
217 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
218 case SelectMode: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
219 return "select"; |
20270
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
220 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
221 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
222 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
223 } |
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 return "none"; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
226 } |
20504
b6ae0ef9327e
Display bottom Qt statusbar on figure based on "toolbar" property (bug #46025).
Rik <rik@octave.org>
parents:
20270
diff
changeset
|
227 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
228 static MouseMode |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
229 mouse_mode_from_string (const std::string& mode) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
230 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
231 if (mode == "none") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
232 return NoMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
233 else if (mode == "rotate") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
234 return RotateMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
235 else if (mode == "zoom in") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
236 return ZoomInMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
237 else if (mode == "zoom out") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
238 return ZoomOutMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
239 else if (mode == "pan") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
240 return PanMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
241 else if (mode == "text") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
242 return TextMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
243 else if (mode == "select") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
244 return SelectMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
245 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
246 return NoMode; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
247 } |
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 QString |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
250 Figure::fileName (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
251 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
252 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
253 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
254 const figure::properties& fp = properties<figure> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
255 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
256 std::string name = fp.get_filename (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
257 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
258 return QString::fromStdString (name); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
259 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
260 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
261 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
262 Figure::setFileName (const QString& name) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
263 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
264 gh_manager::auto_lock lock; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
265 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
266 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
|
267 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
268 fp.set_filename (name.toStdString ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
269 } |
20594
46edfbd31ad7
Fix execution of "windowbuttonmotionfcn" with uipanels (bug #46151)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20537
diff
changeset
|
270 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
271 MouseMode |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
272 Figure::mouseMode (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
273 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
274 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
275 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
276 const figure::properties& fp = properties<figure> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
277 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
278 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
|
279 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
280 if (mode == "zoom") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
281 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
282 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
|
283 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
284 std::string direction = zm.getfield ("Direction").string_value (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
285 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
286 mode += " " + direction; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
287 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
288 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
289 return mouse_mode_from_string (mode); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
290 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
291 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
292 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
293 Figure::createFigureToolBarAndMenuBar (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
294 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
295 QMainWindow* win = qWidget<QMainWindow> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
296 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
297 m_figureToolBar = win->addToolBar (tr ("Figure ToolBar")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
298 m_figureToolBar->setMovable (false); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
299 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
|
300 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
301 m_mouseModeGroup = new MouseModeActionGroup (win); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
302 connect (m_mouseModeGroup, SIGNAL (modeChanged (MouseMode)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
303 SLOT (setMouseMode (MouseMode))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
304 m_figureToolBar->addActions (m_mouseModeGroup->actions ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
305 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
306 QAction *toggle_axes = m_figureToolBar->addAction (tr ("Axes")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
307 connect (toggle_axes, SIGNAL (triggered (void)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
308 this, SLOT (toggleAxes (void))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
309 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
310 QAction *toggle_grid = m_figureToolBar->addAction (tr ("Grid")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
311 connect (toggle_grid, SIGNAL (triggered (void)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
312 this, SLOT (toggleGrid (void))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
313 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
314 QAction *auto_axes = m_figureToolBar->addAction (tr ("Autoscale")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
315 connect (auto_axes, SIGNAL (triggered (void)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
316 this, SLOT (autoAxes (void))); |
20715
5b7643257978
Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents:
20595
diff
changeset
|
317 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
318 m_menuBar = new MenuBar (win); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
319 win->setMenuBar (m_menuBar); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
320 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
321 QMenu* fileMenu = m_menuBar->addMenu (tr ("&File")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
322 fileMenu->menuAction ()->setObjectName ("builtinMenu"); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
323 fileMenu->addAction (tr ("&Save"), this, SLOT (fileSaveFigure (bool))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
324 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
|
325 fileMenu->addSeparator (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
326 fileMenu->addAction (tr ("&Close Figure"), this, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
327 SLOT (fileCloseFigure (void)), Qt::CTRL | Qt::Key_W); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
328 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
329 QMenu* editMenu = m_menuBar->addMenu (tr ("&Edit")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
330 editMenu->menuAction ()->setObjectName ("builtinMenu"); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
331 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
|
332 Qt::CTRL | Qt::Key_C); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
333 editMenu->addSeparator (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
334 editMenu->addActions (m_mouseModeGroup->actions ()); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
335 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
336 QMenu* helpMenu = m_menuBar->addMenu (tr ("&Help")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
337 helpMenu->menuAction ()->setObjectName ("builtinMenu"); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
338 helpMenu->addAction (tr ("About Octave"), this, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
339 SLOT (helpAboutOctave (void))); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
340 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
341 m_menuBar->addReceiver (this); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
342 } |
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 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
345 Figure::updateFigureToolBarAndMenuBar (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
346 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
347 if (m_mouseModeGroup) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
348 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
349 m_blockUpdates = true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
350 m_mouseModeGroup->setMode (mouseMode ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
351 m_blockUpdates = false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
352 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
353 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
354 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
355 Container* |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
356 Figure::innerContainer (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
357 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
358 return m_container; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
359 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
360 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
361 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
362 Figure::redraw (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
363 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
364 Canvas* canvas = m_container->canvas (m_handle); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
365 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
366 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
367 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
368 canvas->redraw (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
369 //canvas->setMouseMode (RotateMode); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
370 } |
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 foreach (QFrame* frame, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
373 qWidget<QWidget> ()->findChildren<QFrame*> ()) |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
374 { |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
375 if (frame->objectName () == "UIPanel" |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
376 || frame->objectName () == "UIButtonGroup") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
377 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
378 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
|
379 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
380 if (obj) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
381 obj->slotRedraw (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
382 } |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
383 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
384 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
385 updateFigureToolBarAndMenuBar (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
386 } |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
387 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
388 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
389 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
|
390 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
391 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
|
392 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
393 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
394 canvas->print (file_cmd, term); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
395 } |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
396 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
397 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
398 Figure::beingDeleted (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
399 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
400 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
|
401 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
402 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
403 canvas->blockRedraw (true); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
404 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
405 m_menuBar->removeReceiver (this); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
406 m_container->removeReceiver (this); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
407 qWidget<FigureWindow> ()->removeReceiver (this); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
408 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
409 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
410 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
411 Figure::update (int pId) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
412 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
413 if (m_blockUpdates) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
414 return; |
19681
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
415 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
416 figure::properties& fp = properties<figure> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
417 QMainWindow* win = qWidget<QMainWindow> (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
418 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
419 m_blockUpdates = true; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
420 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
421 switch (pId) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
422 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
423 case figure::properties::ID_POSITION: |
19621
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19616
diff
changeset
|
424 { |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
425 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
|
426 int toffset = 0; |
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
427 int boffset = 0; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
428 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
429 foreach (QToolBar* tb, win->findChildren<QToolBar*> ()) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
430 if (! tb->isHidden ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
431 toffset += tb->sizeHint ().height (); |
20270
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
432 |
19621
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19616
diff
changeset
|
433 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
|
434 toffset += m_menuBar->sizeHint ().height (); |
20531
dcfbf4c1c3c8
eliminate trailing whitespace and tabs from sources
John W. Eaton <jwe@octave.org>
parents:
20524
diff
changeset
|
435 |
20270
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
436 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
|
437 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
|
438 |
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
439 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
|
440 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
441 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
442 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
443 case figure::properties::ID_NAME: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
444 case figure::properties::ID_NUMBERTITLE: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
445 win->setWindowTitle (Utils::fromStdString (fp.get_title ())); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
446 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
447 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
448 case figure::properties::ID_VISIBLE: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
449 if (fp.is_visible ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
450 QTimer::singleShot (0, win, SLOT (show ())); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
451 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
452 win->hide (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
453 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
454 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
455 case figure::properties::ID_TOOLBAR: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
456 if (fp.toolbar_is ("none")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
457 showFigureToolBar (false); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
458 else if (fp.toolbar_is ("figure")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
459 showFigureToolBar (true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
460 else // "auto" |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
461 showFigureToolBar (! hasUiControlChildren (fp) && |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
462 fp.menubar_is ("figure")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
463 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
464 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
465 case figure::properties::ID_MENUBAR: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
466 showMenuBar (fp.menubar_is ("figure")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
467 if (fp.toolbar_is ("auto")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
468 showFigureToolBar (fp.menubar_is ("figure")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
469 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
470 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
471 case figure::properties::ID_KEYPRESSFCN: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
472 if (fp.get_keypressfcn ().is_empty ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
473 m_container->canvas (m_handle)->clearEventMask (Canvas::KeyPress); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
474 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
475 m_container->canvas (m_handle)->addEventMask (Canvas::KeyPress); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
476 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
477 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
478 case figure::properties::ID_KEYRELEASEFCN: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
479 if (fp.get_keyreleasefcn ().is_empty ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
480 m_container->canvas (m_handle)->clearEventMask (Canvas::KeyRelease); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
481 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
482 m_container->canvas (m_handle)->addEventMask (Canvas::KeyRelease); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
483 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
484 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
485 case figure::properties::ID_WINDOWSTYLE: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
486 if (fp.windowstyle_is ("modal")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
487 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
488 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
|
489 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
490 // 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
|
491 // make it use the modal settings |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
492 if (is_visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
493 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
|
494 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
495 win->setWindowModality (Qt::ApplicationModal); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
496 win->setVisible (is_visible); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
497 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
498 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
499 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
|
500 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
501 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
|
502 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
503 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
504 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
505 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
506 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
507 m_blockUpdates = false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
508 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
509 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
510 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
511 Figure::showFigureToolBar (bool visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
512 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
513 if ((! m_figureToolBar->isHidden ()) != visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
514 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
515 int dy1 = m_figureToolBar->sizeHint ().height (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
516 int dy2 = m_statusBar->sizeHint ().height (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
517 QRect r = qWidget<QWidget> ()->geometry (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
518 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
519 if (! visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
520 r.adjust (0, dy1, 0, -dy2); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
521 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
522 r.adjust (0, -dy1, 0, dy2); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
523 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
524 m_blockUpdates = true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
525 qWidget<QWidget> ()->setGeometry (r); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
526 m_figureToolBar->setVisible (visible); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
527 m_statusBar->setVisible (visible); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
528 m_blockUpdates = false; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
529 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
530 updateBoundingBox (false); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
531 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
532 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
533 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
534 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
535 Figure::showMenuBar (bool visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
536 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
537 int h1 = m_menuBar->sizeHint ().height (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
538 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
539 foreach (QAction* a, m_menuBar->actions ()) |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
540 if (a->objectName () == "builtinMenu") |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
541 a->setVisible (visible); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
542 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
543 int h2 = m_menuBar->sizeHint ().height (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
544 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
545 if (! visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
546 visible = hasUiMenuChildren (properties<figure> ()); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
547 |
22721
0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22417
diff
changeset
|
548 int dy = qMax (h1, h2); |
0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22417
diff
changeset
|
549 QRect r = qWidget<QWidget> ()->geometry (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
550 |
22721
0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22417
diff
changeset
|
551 if (! visible) |
0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22417
diff
changeset
|
552 r.adjust (0, dy, 0, 0); |
0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22417
diff
changeset
|
553 else |
0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22417
diff
changeset
|
554 r.adjust (0, -dy, 0, 0); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
555 |
22721
0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22417
diff
changeset
|
556 m_blockUpdates = true; |
0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22417
diff
changeset
|
557 qWidget<QWidget> ()->setGeometry (r); |
0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22417
diff
changeset
|
558 m_menuBar->setVisible (visible); |
0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22417
diff
changeset
|
559 m_blockUpdates = false; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
560 |
22721
0cd8a1c22f23
Let Qt menubar be restored after being hidden (bug #49529).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22417
diff
changeset
|
561 updateBoundingBox (false); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
562 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
563 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
564 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
565 Figure::updateMenuBar (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
566 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
567 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
568 graphics_object go = object (); |
20270
062422f2e399
Show axes coordinates in Qt figures (bug #44959)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20242
diff
changeset
|
569 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
570 if (go.valid_object ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
571 showMenuBar (Utils::properties<figure> (go).menubar_is ("figure")); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
572 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
573 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
574 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
575 Figure::updateStatusBar (ColumnVector pt) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
576 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
577 if (! m_statusBar->isHidden ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
578 m_statusBar->showMessage (QString ("(%1, %2)") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
579 .arg (pt(0), 0, 'g', 5) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
580 .arg (pt(1), 0, 'g', 5)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
581 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
582 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
583 QWidget* |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
584 Figure::menu (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
585 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
586 return qWidget<QMainWindow> ()->menuBar (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
587 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
588 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
589 struct UpdateBoundingBoxData |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
590 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
591 Matrix m_bbox; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
592 bool m_internal; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
593 graphics_handle m_handle; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
594 Figure* m_figure; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
595 }; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
596 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
597 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
598 Figure::updateBoundingBoxHelper (void* data) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
599 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
600 gh_manager::auto_lock lock; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
601 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
602 UpdateBoundingBoxData* d = reinterpret_cast<UpdateBoundingBoxData*> (data); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
603 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
|
604 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
605 if (go.valid_object ()) |
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 figure::properties& fp = Utils::properties<figure> (go); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
608 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
609 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
|
610 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
611 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
612 delete d; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
613 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
614 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
615 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
616 Figure::updateBoundingBox (bool internal, int flags) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
617 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
618 QWidget* win = qWidget<QWidget> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
619 Matrix bb (1, 4); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
620 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
621 if (internal) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
622 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
623 QRect r = m_innerRect; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
624 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
625 if (flags & UpdateBoundingBoxPosition) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
626 r.moveTopLeft (win->mapToGlobal (m_container->pos ())); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
627 if (flags & UpdateBoundingBoxSize) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
628 r.setSize (m_container->size ()); |
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 if (r.isValid () && r != m_innerRect) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
631 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
632 m_innerRect = r; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
633 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
634 bb(0) = r.x (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
635 bb(1) = r.y (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
636 bb(2) = r.width (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
637 bb(3) = r.height (); |
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 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
640 return; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
641 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
642 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
643 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
644 QRect r = m_outerRect; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
645 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
646 if (flags & UpdateBoundingBoxPosition) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
647 r.moveTopLeft (win->pos ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
648 if (flags & UpdateBoundingBoxSize) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
649 r.setSize (win->frameGeometry ().size ()); |
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 if (r.isValid () && r != m_outerRect) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
652 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
653 m_outerRect = r; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
654 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
655 bb(0) = r.x (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
656 bb(1) = r.y (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
657 bb(2) = r.width (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
658 bb(3) = r.height (); |
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 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
661 return; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
662 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
663 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
664 UpdateBoundingBoxData* d = new UpdateBoundingBoxData (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
665 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
666 d->m_bbox = bb; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
667 d->m_internal = internal; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
668 d->m_handle = m_handle; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
669 d->m_figure = this; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
670 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
671 gh_manager::post_function (Figure::updateBoundingBoxHelper, d); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
672 } |
20594
46edfbd31ad7
Fix execution of "windowbuttonmotionfcn" with uipanels (bug #46151)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20537
diff
changeset
|
673 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
674 bool |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
675 Figure::eventNotifyBefore (QObject* obj, QEvent* xevent) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
676 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
677 if (! m_blockUpdates) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
678 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
679 if (obj == m_container) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
680 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
681 // Do nothing... |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
682 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
683 else if (obj == m_menuBar) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
684 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
685 switch (xevent->type ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
686 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
687 case QEvent::ActionRemoved: |
19621
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19616
diff
changeset
|
688 { |
19623
6b2d7a5dc62a
use xevent instead of ev to avoid shadowed warnings
John W. Eaton <jwe@octave.org>
parents:
19621
diff
changeset
|
689 QAction* a = dynamic_cast<QActionEvent*> (xevent)->action (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
690 |
19621
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19616
diff
changeset
|
691 if (! a->isSeparator () |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
692 && a->objectName () != "builtinMenu") |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
693 updateMenuBar (); |
19621
af0399a5aae0
untabify QtHandles source files
John W. Eaton <jwe@octave.org>
parents:
19616
diff
changeset
|
694 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
695 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
696 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
697 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
698 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
699 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
700 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
701 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
702 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
703 switch (xevent->type ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
704 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
705 case QEvent::Close: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
706 xevent->ignore (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
707 gh_manager::post_callback (m_handle, "closerequestfcn"); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
708 return true; |
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 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
711 break; |
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 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
714 } |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
715 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
716 return false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
717 } |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
718 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
719 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
720 Figure::eventNotifyAfter (QObject* watched, QEvent* xevent) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
721 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
722 if (! m_blockUpdates) |
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 if (watched == m_container) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
725 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
726 switch (xevent->type ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
727 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
728 case QEvent::Resize: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
729 updateBoundingBox (true, UpdateBoundingBoxSize); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
730 break; |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19955
diff
changeset
|
731 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
732 case QEvent::ChildAdded: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
733 if (dynamic_cast<QChildEvent*> (xevent)->child |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
734 ()->isWidgetType()) |
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 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
737 update (figure::properties::ID_TOOLBAR); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
738 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
739 enableMouseTracking (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
740 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
741 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
742 case QEvent::ChildRemoved: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
743 if (dynamic_cast<QChildEvent*> (xevent)->child |
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 } |
21916
3a0c90b59584
Make qt figure window "Help" menu correspond to main window (bug #48223)
Mike Miller <mtmiller@octave.org>
parents:
21824
diff
changeset
|
749 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
750 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
751 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
752 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
753 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
754 else if (watched == m_menuBar) |
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 switch (xevent->type ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
757 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
758 case QEvent::ActionAdded: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
759 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
760 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
|
761 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
762 if (! a->isSeparator () |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
763 && a->objectName () != "builtinMenu") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
764 updateMenuBar (); |
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 break; |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
767 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
768 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
769 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
770 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
771 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
772 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
773 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
774 switch (xevent->type ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
775 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
776 case QEvent::Move: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
777 updateBoundingBox (false, UpdateBoundingBoxPosition); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
778 updateBoundingBox (true, UpdateBoundingBoxPosition); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
779 break; |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19625
diff
changeset
|
780 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
781 case QEvent::Resize: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
782 updateBoundingBox (false, UpdateBoundingBoxSize); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
783 break; |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
784 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
785 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
786 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
787 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
788 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
789 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
790 } |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
791 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
792 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
793 Figure::helpAboutOctave (void) |
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 std::string message |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
796 = 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
|
797 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
798 QMessageBox::about (qWidget<QMainWindow> (), tr ("About Octave"), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
799 QString::fromStdString (message)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
800 } |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
801 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
802 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
803 Figure::setMouseMode (MouseMode mode) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
804 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
805 if (m_blockUpdates) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
806 return; |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
807 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
808 gh_manager::auto_lock lock; |
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 figure::properties& fp = properties<figure> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
811 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
812 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
|
813 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
814 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
|
815 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
816 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
817 canvas->setCursor (mode); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
818 } |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
819 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
820 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
821 Figure::fileSaveFigure (bool prompt) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
822 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
823 QString file = fileName (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
824 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
825 if (file.isEmpty ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
826 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
827 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
|
828 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
829 file = "untitled.pdf"; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
830 } |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
831 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
832 if (prompt || file.isEmpty ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
833 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
834 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
|
835 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
836 file = QFileDialog::getSaveFileName (qWidget<FigureWindow> (), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
837 tr ("Save Figure As"), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
838 finfo.absoluteFilePath (), 0, 0, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
839 QFileDialog::DontUseNativeDialog); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
840 } |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
841 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
842 if (! file.isEmpty ()) |
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 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
|
845 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
846 setFileName (finfo.absoluteFilePath ()); |
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 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
|
849 file.toStdString ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
850 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
851 } |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
852 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
853 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
854 Figure::save_figure_callback (const std::string& file) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
855 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
856 figure::properties& fp = properties<figure> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
857 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
|
858 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
859 Ffeval (ovl ("print", fnum, file)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
860 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
861 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
862 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
863 Figure::copy_figure_callback (const std::string& format) |
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 std::string msg; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
866 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
867 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
|
868 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
869 if (file.empty ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
870 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
871 // Report error? |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
872 return; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
873 } |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20114
diff
changeset
|
874 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
875 save_figure_callback (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 octave_link::copy_image_to_clipboard (file); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
878 } |
19685
7335cc071ab0
make save and saveas menu items work in Qt figure window
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
879 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
880 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
881 Figure::fileSaveFigureAs (void) |
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 fileSaveFigure (true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
884 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
885 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
886 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
887 Figure::fileCloseFigure (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
888 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
889 qWidget<QMainWindow> ()->close (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
890 } |
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 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
893 Figure::editCopy (bool /* choose_format */) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
894 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
895 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
|
896 |
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
897 #if 0 |
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
898 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
899 // 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
|
900 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
901 if (choose_format) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
902 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
903 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
|
904 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
905 format = QFileDialog::getSaveFileName (qWidget<FigureWindow> (), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
906 tr ("Save Figure As"), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
907 finfo.absoluteFilePath (), 0, 0, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
908 QFileDialog::DontUseNativeDialog); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
909 } |
20079
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
910 #endif |
27c0285828f8
make copying images to the clipboard work with Qt graphics
John W. Eaton <jwe@octave.org>
parents:
20078
diff
changeset
|
911 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
912 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
|
913 format.toStdString ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
914 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
915 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
916 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
917 Figure::addCustomToolBar (QToolBar* bar, bool visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
918 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
919 QMainWindow* win = qWidget<QMainWindow> (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
920 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
921 if (! visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
922 win->addToolBar (bar); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
923 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
924 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
925 QSize sz = bar->sizeHint (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
926 QRect r = win->geometry (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
927 //qDebug () << "Figure::addCustomToolBar:" << r; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
928 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
929 r.adjust (0, -sz.height (), 0, 0); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
930 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
931 m_blockUpdates = true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
932 win->setGeometry (r); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
933 win->addToolBarBreak (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
934 win->addToolBar (bar); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
935 m_blockUpdates = false; |
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 //qDebug () << "Figure::addCustomToolBar:" << win->geometry (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
938 updateBoundingBox (false); |
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 } |
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 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
943 Figure::showCustomToolBar (QToolBar* bar, bool visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
944 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
945 QMainWindow* win = qWidget<QMainWindow> (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
946 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
947 if ((! bar->isHidden ()) != visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
948 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
949 QSize sz = bar->sizeHint (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
950 QRect r = win->geometry (); |
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 if (visible) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
953 r.adjust (0, -sz.height (), 0, 0); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
954 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
955 r.adjust (0, sz.height (), 0, 0); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
956 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
957 m_blockUpdates = true; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
958 win->setGeometry (r); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
959 bar->setVisible (visible); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
960 m_blockUpdates = false; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
961 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
962 updateBoundingBox (false); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
963 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
964 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
965 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
966 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
967 Figure::updateContainer (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
968 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
969 redraw (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
970 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
971 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
972 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
973 Figure::toggleAxes (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
974 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
975 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
|
976 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
977 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
978 canvas->toggleAxes (m_handle); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
979 } |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20114
diff
changeset
|
980 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
981 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
982 Figure::toggleGrid (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
983 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
984 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
|
985 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
986 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
987 canvas->toggleGrid (m_handle); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
988 } |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20114
diff
changeset
|
989 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
990 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
991 Figure::autoAxes (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
992 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
993 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
|
994 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
995 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
996 canvas->autoAxes (m_handle); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
997 } |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20114
diff
changeset
|
998 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
999 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1000 Figure::enableMouseTracking (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1001 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1002 // Enable mouse tracking on every widgets |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1003 m_container->setMouseTracking (true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1004 m_container->canvas (m_handle)->qWidget ()->setMouseTracking (true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1005 foreach (QWidget* w, m_container->findChildren<QWidget*> ()) |
20594
46edfbd31ad7
Fix execution of "windowbuttonmotionfcn" with uipanels (bug #46151)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20537
diff
changeset
|
1006 { w->setMouseTracking (true); } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1007 } |
20594
46edfbd31ad7
Fix execution of "windowbuttonmotionfcn" with uipanels (bug #46151)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20537
diff
changeset
|
1008 |
22413
8758addcf265
maint: Remove ';' at end of namespace declaration.
Rik <rik@octave.org>
parents:
22411
diff
changeset
|
1009 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22370
diff
changeset
|
1010 |