Mercurial > octave
annotate libgui/graphics/Canvas.cc @ 20009:f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
* libgui/graphics/Canvas.cc
(canvasMouseDoubleClickEvent): move autoscale if left mouse and zoom,pan.rotate mode call to canvasMousePressEvent
and call canvasMousePressEvent on double click.
(canvasMousePressEvent) set isdlbclick flag if even type was MouseDlbClickEvent, pass doubleclick to figureSelectionType calls,
and if double click on left mouse occured in zoom,rotate,pan mode, then autoscale.
author | John Donoghue |
---|---|
date | Wed, 01 Apr 2015 15:16:12 -0400 |
parents | c3a40003aa42 |
children | 055ad6fbc910 |
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 |
20003
f0e61a67ad9f
Update copyright year in Qt graphics code.
John W. Eaton <jwe@octave.org>
parents:
19967
diff
changeset
|
3 Copyright (C) 2011-2015 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 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 #include <config.h> |
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 <QApplication> |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
28 #include <QBitmap> |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
29 #include <QCursor> |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 #include <QList> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #include <QMouseEvent> |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
32 #include <QWheelEvent> |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 #include <QRectF> |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 #include "Backend.h" |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 #include "Canvas.h" |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 #include "ContextMenu.h" |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 #include "GLCanvas.h" |
18505
fb96b7f55242
rename file to avoid clash on case-insenstive filesystems (bug #41658)
John W. Eaton <jwe@octave.org>
parents:
18501
diff
changeset
|
39 #include "QtHandlesUtils.h" |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 |
19681
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
41 #include "gl2ps-renderer.h" |
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
42 |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 namespace QtHandles |
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 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
46 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
47 Canvas::redraw (bool sync) |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 { |
19953
ed51e17f6ccf
avoid possibly dereferencing invalid pointer
John W. Eaton <jwe@octave.org>
parents:
19896
diff
changeset
|
49 QWidget *w = qWidget (); |
ed51e17f6ccf
avoid possibly dereferencing invalid pointer
John W. Eaton <jwe@octave.org>
parents:
19896
diff
changeset
|
50 |
ed51e17f6ccf
avoid possibly dereferencing invalid pointer
John W. Eaton <jwe@octave.org>
parents:
19896
diff
changeset
|
51 if (w) |
ed51e17f6ccf
avoid possibly dereferencing invalid pointer
John W. Eaton <jwe@octave.org>
parents:
19896
diff
changeset
|
52 { |
ed51e17f6ccf
avoid possibly dereferencing invalid pointer
John W. Eaton <jwe@octave.org>
parents:
19896
diff
changeset
|
53 if (sync) |
ed51e17f6ccf
avoid possibly dereferencing invalid pointer
John W. Eaton <jwe@octave.org>
parents:
19896
diff
changeset
|
54 w->repaint (); |
ed51e17f6ccf
avoid possibly dereferencing invalid pointer
John W. Eaton <jwe@octave.org>
parents:
19896
diff
changeset
|
55 else |
ed51e17f6ccf
avoid possibly dereferencing invalid pointer
John W. Eaton <jwe@octave.org>
parents:
19896
diff
changeset
|
56 w->update (); |
ed51e17f6ccf
avoid possibly dereferencing invalid pointer
John W. Eaton <jwe@octave.org>
parents:
19896
diff
changeset
|
57 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
60 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
61 Canvas::blockRedraw (bool block) |
18498
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 m_redrawBlocked = block; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
65 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
66 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
67 Canvas::setCursor (MouseMode mode) |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
68 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
69 QWidget *w = qWidget (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
70 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
71 if (w) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
72 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
73 static QCursor origCursor = w->cursor (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
74 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
75 switch (mode) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
76 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
77 case PanMode: |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
78 case RotateMode: |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
79 w->setCursor (Qt::OpenHandCursor); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
80 break; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
81 |
19867
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
82 case ZoomInMode: |
19959
210b301a3e39
different cursors for zoom in/out on qthandles canvas
Johannes Leuschner <jhnnslschnr@gmail.com>
parents:
19954
diff
changeset
|
83 w->setCursor (QPixmap (":/images/zoom-in.png")); |
210b301a3e39
different cursors for zoom in/out on qthandles canvas
Johannes Leuschner <jhnnslschnr@gmail.com>
parents:
19954
diff
changeset
|
84 break; |
210b301a3e39
different cursors for zoom in/out on qthandles canvas
Johannes Leuschner <jhnnslschnr@gmail.com>
parents:
19954
diff
changeset
|
85 |
19867
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
86 case ZoomOutMode: |
19959
210b301a3e39
different cursors for zoom in/out on qthandles canvas
Johannes Leuschner <jhnnslschnr@gmail.com>
parents:
19954
diff
changeset
|
87 w->setCursor (QPixmap (":/images/zoom-out.png")); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
88 break; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
89 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
90 default: |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
91 w->setCursor (origCursor); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
92 break; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
93 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
94 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
95 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
96 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
97 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
98 Canvas::print (const QString& file_cmd, const QString& term) |
19681
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
99 { |
19954
b6061813a693
always obtain gh_manager lock before accessing graphics objects
John W. Eaton <jwe@octave.org>
parents:
19953
diff
changeset
|
100 gh_manager::auto_lock lock; |
19681
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
101 graphics_object obj = gh_manager::get_object (m_handle); |
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
102 |
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
103 if (obj.valid_object ()) |
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
104 { |
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
105 graphics_object figObj (obj.get_ancestor ("figure")); |
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
106 |
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
107 gl2ps_print (figObj, file_cmd.toStdString (), term.toStdString ()); |
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
108 } |
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
109 } |
35bca657d74d
printing for Qt plot widget (bug #42537)
John W. Eaton <jwe@octave.org>
parents:
19663
diff
changeset
|
110 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
111 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
112 Canvas::updateCurrentPoint(const graphics_object& fig, |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
113 const graphics_object& obj, QMouseEvent* event) |
18612
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
114 { |
19954
b6061813a693
always obtain gh_manager lock before accessing graphics objects
John W. Eaton <jwe@octave.org>
parents:
19953
diff
changeset
|
115 gh_manager::auto_lock lock; |
b6061813a693
always obtain gh_manager lock before accessing graphics objects
John W. Eaton <jwe@octave.org>
parents:
19953
diff
changeset
|
116 |
18612
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
117 gh_manager::post_set (fig.get_handle (), "currentpoint", |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
118 Utils::figureCurrentPoint (fig, event), false); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
119 |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
120 Matrix children = obj.get_properties ().get_children (); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
121 octave_idx_type num_children = children.numel (); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
122 |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
123 for (int i = 0; i < num_children; i++) |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
124 { |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
125 graphics_object childObj (gh_manager::get_object (children(i))); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
126 |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
127 if (childObj.isa ("axes")) |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
128 { |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
129 axes::properties& ap = Utils::properties<axes> (childObj); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
130 Matrix x_zlim = ap.get_transform_zlim (); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
131 graphics_xform x_form = ap.get_transform (); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
132 |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
133 ColumnVector p1 = x_form.untransform (event->x (), event->y (), |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
134 x_zlim(0)); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
135 ColumnVector p2 = x_form.untransform (event->x (), event->y (), |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
136 x_zlim(1)); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
137 |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
138 Matrix cp (2, 3, 0.0); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
139 |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
140 cp(0,0) = p1(0); cp(0,1) = p1(1); cp(0,2) = p1(2); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
141 cp(1,0) = p2(0); cp(1,1) = p2(1); cp(1,2) = p2(2); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
142 |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
143 gh_manager::post_set (childObj.get_handle (), "currentpoint", cp, |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
144 false); |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
145 } |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
146 } |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
147 } |
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
148 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
149 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
150 Canvas::canvasToggleAxes (const graphics_handle& handle) |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
151 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
152 gh_manager::auto_lock lock; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
153 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
154 graphics_object go = gh_manager::get_object (handle); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
155 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
156 if (go.valid_object ()) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
157 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
158 figure::properties& fp = Utils::properties<figure> (go); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
159 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
160 graphics_handle ah = fp.get_currentaxes (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
161 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
162 graphics_object ax = gh_manager::get_object (ah); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
163 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
164 if (ax.valid_object ()) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
165 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
166 axes::properties& ap = Utils::properties<axes> (ax); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
167 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
168 if (ap.handlevisibility_is ("on")) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
169 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
170 ap.set_visible (! ap.is_visible ()); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
171 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
172 redraw (true); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
173 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
174 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
175 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
176 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
177 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
178 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
179 Canvas::canvasToggleGrid (const graphics_handle& handle) |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
180 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
181 gh_manager::auto_lock lock; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
182 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
183 graphics_object go = gh_manager::get_object (handle); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
184 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
185 if (go.valid_object ()) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
186 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
187 figure::properties& fp = Utils::properties<figure> (go); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
188 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
189 graphics_handle ah = fp.get_currentaxes (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
190 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
191 graphics_object ax = gh_manager::get_object (ah); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
192 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
193 if (ax.valid_object ()) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
194 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
195 axes::properties& ap = Utils::properties<axes> (ax); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
196 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
197 if (ap.handlevisibility_is ("on") && ap.is_visible ()) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
198 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
199 std::string tmp; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
200 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
201 // If any grid is off, then turn them all on. If they are all |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
202 // on, then turn them off. |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
203 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
204 std::string state = ((ap.get_xgrid () == "off" |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
205 || ap.get_ygrid () == "off" |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
206 || ap.get_zgrid () == "off") |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
207 ? "on" : "off"); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
208 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
209 ap.set_xgrid (state); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
210 ap.set_ygrid (state); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
211 ap.set_zgrid (state); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
212 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
213 redraw (true); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
214 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
215 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
216 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
217 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
218 |
19870
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
219 static void |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
220 autoscale_axes (axes::properties& ap) |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
221 { |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
222 ap.clear_zoom_stack (); |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
223 |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
224 ap.set_xlimmode ("auto"); |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
225 ap.set_ylimmode ("auto"); |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
226 ap.set_zlimmode ("auto"); |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
227 } |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
228 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
229 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
230 Canvas::canvasAutoAxes (const graphics_handle& handle) |
19870
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
231 { |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
232 gh_manager::auto_lock lock; |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
233 |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
234 graphics_object go = gh_manager::get_object (handle); |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
235 |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
236 if (go.valid_object ()) |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
237 { |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
238 figure::properties& fp = Utils::properties<figure> (go); |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
239 |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
240 graphics_handle ah = fp.get_currentaxes (); |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
241 |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
242 graphics_object ax = gh_manager::get_object (ah); |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
243 |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
244 if (ax.valid_object ()) |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
245 { |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
246 axes::properties& ap = Utils::properties<axes> (ax); |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
247 |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
248 if (ap.handlevisibility_is ("on") && ap.is_visible ()) |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
249 { |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
250 autoscale_axes (ap); |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
251 |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
252 redraw (true); |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
253 } |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
254 } |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
255 } |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
256 } |
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
257 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
258 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
259 Canvas::canvasPaintEvent (void) |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
260 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
261 if (! m_redrawBlocked) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
262 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
263 gh_manager::auto_lock lock; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
264 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
265 draw (m_handle); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
266 |
19867
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
267 if (m_mouseMode == ZoomInMode && m_mouseAxes.ok ()) |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
268 drawZoomBox (m_mouseAnchor, m_mouseCurrent); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
269 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
270 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
271 |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
272 static bool |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
273 pan_enabled (const graphics_object figObj) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
274 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
275 // Getting pan mode property: |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
276 octave_value ov_pm |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
277 = Utils::properties<figure> (figObj).get___pan_mode__ (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
278 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
279 octave_scalar_map pm = ov_pm.scalar_map_value (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
280 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
281 return pm.contents ("Enable").string_value () == "on"; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
282 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
283 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
284 static std::string |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
285 pan_mode (const graphics_object figObj) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
286 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
287 // Getting pan mode property: |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
288 octave_value ov_pm |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
289 = Utils::properties<figure> (figObj).get___pan_mode__ (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
290 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
291 octave_scalar_map pm = ov_pm.scalar_map_value (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
292 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
293 return pm.contents ("Motion").string_value (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
294 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
295 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
296 static bool |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
297 rotate_enabled (const graphics_object figObj) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
298 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
299 // Getting rotate mode property: |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
300 octave_value ov_rm |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
301 = Utils::properties<figure> (figObj).get___rotate_mode__ (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
302 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
303 octave_scalar_map rm = ov_rm.scalar_map_value (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
304 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
305 return rm.contents ("Enable").string_value () == "on"; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
306 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
307 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
308 static bool |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
309 zoom_enabled (const graphics_object figObj) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
310 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
311 // Getting zoom mode property: |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
312 octave_value ov_zm |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
313 = Utils::properties<figure> (figObj).get___zoom_mode__ (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
314 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
315 octave_scalar_map zm = ov_zm.scalar_map_value (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
316 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
317 return zm.contents ("Enable").string_value () == "on"; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
318 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
319 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
320 static std::string |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
321 zoom_mode (const graphics_object figObj) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
322 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
323 // Getting zoom mode property: |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
324 octave_value ov_zm |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
325 = Utils::properties<figure> (figObj).get___zoom_mode__ (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
326 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
327 octave_scalar_map zm = ov_zm.scalar_map_value (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
328 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
329 return zm.contents ("Motion").string_value (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
330 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
331 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
332 static std::string |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
333 zoom_direction (const graphics_object figObj) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
334 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
335 // Getting zoom mode property: |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
336 octave_value ov_zm |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
337 = Utils::properties<figure> (figObj).get___zoom_mode__ (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
338 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
339 octave_scalar_map zm = ov_zm.scalar_map_value (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
340 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
341 return zm.contents ("Direction").string_value (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
342 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
343 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
344 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
345 Canvas::canvasMouseMoveEvent (QMouseEvent* event) |
19887
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
346 { |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
347 gh_manager::auto_lock lock; |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
348 graphics_object ax = gh_manager::get_object (m_mouseAxes); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
349 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
350 if (m_mouseMode != NoMode && ax.valid_object ()) |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
351 { |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
352 axes::properties& ap = Utils::properties<axes> (ax); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
353 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
354 switch (m_mouseMode) |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
355 { |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
356 case RotateMode: |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
357 { |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
358 ap.rotate3d (m_mouseCurrent.x (), event->x (), |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
359 m_mouseCurrent.y (), event->y ()); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
360 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
361 // Update current mouse position |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
362 m_mouseCurrent = event->pos (); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
363 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
364 // Force immediate redraw |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
365 redraw (true); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
366 } |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
367 break; |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
368 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
369 case ZoomInMode: |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
370 case ZoomOutMode: |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
371 m_mouseCurrent = event->pos (); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
372 redraw (true); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
373 break; |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
374 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
375 case PanMode: |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
376 { |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
377 graphics_object figObj (ax.get_ancestor ("figure")); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
378 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
379 std::string mode = pan_mode (figObj); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
380 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
381 ColumnVector p0 = ap.pixel2coord (m_mouseCurrent.x (), |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
382 m_mouseCurrent.y ()); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
383 ColumnVector p1 = ap.pixel2coord (event->x (), |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
384 event->y ()); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
385 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
386 ap.translate_view (mode, p0(0), p1(0), p0(1), p1(1)); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
387 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
388 // Update current mouse position |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
389 m_mouseCurrent = event->pos (); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
390 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
391 // Force immediate redraw |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
392 redraw (true); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
393 } |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
394 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
395 default: |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
396 break; |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
397 } |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
398 } |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
399 else if (m_mouseMode == NoMode) |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
400 { |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
401 graphics_object obj = gh_manager::get_object (m_handle); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
402 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
403 if (obj.valid_object ()) |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
404 { |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
405 graphics_object figObj (obj.get_ancestor ("figure")); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
406 |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
407 updateCurrentPoint (figObj, obj, event); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
408 gh_manager::post_callback (figObj.get_handle (), |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
409 "windowbuttonmotionfcn"); |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
410 } |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
411 } |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
412 } |
966a1933f3fa
respect x- or y-only pan mode when clicking and dragging (bug #44408)
John W. Eaton <jwe@octave.org>
parents:
19870
diff
changeset
|
413 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
414 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
415 Canvas::canvasMouseDoubleClickEvent (QMouseEvent* event) |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
416 { |
20009
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
417 // same processing as nornal click, but event type is MouseButtonDblClick |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
418 canvasMousePressEvent (event); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
419 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
420 |
19765
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
421 static double |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
422 button_number (QMouseEvent *event) |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
423 { |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
424 double retval = 0; |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
425 |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
426 switch (event->button ()) |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
427 { |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
428 case Qt::LeftButton: |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
429 retval = 1; |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
430 break; |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
431 |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
432 case Qt::MidButton: |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
433 retval = 2; |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
434 break; |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
435 |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
436 case Qt::RightButton: |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
437 retval = 3; |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
438 break; |
19782
98cc7c741c5a
avoid GCC warning about enumeration values not handled in switch statement
John W. Eaton <jwe@octave.org>
parents:
19765
diff
changeset
|
439 |
98cc7c741c5a
avoid GCC warning about enumeration values not handled in switch statement
John W. Eaton <jwe@octave.org>
parents:
19765
diff
changeset
|
440 default: |
98cc7c741c5a
avoid GCC warning about enumeration values not handled in switch statement
John W. Eaton <jwe@octave.org>
parents:
19765
diff
changeset
|
441 break; |
19765
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
442 } |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
443 |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
444 return retval; |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
445 } |
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
446 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
447 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
448 Canvas::canvasMousePressEvent (QMouseEvent* event) |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
449 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
450 gh_manager::auto_lock lock; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
451 graphics_object obj = gh_manager::get_object (m_handle); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
452 |
20009
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
453 bool isdblclick = (event->type () == QEvent::MouseButtonDblClick); |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
454 |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
455 if (obj.valid_object ()) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
456 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
457 graphics_object figObj (obj.get_ancestor ("figure")); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
458 graphics_object currentObj, axesObj; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
459 QList<graphics_object> axesList; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
460 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
461 Matrix children = obj.get_properties ().get_children (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
462 octave_idx_type num_children = children.numel (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
463 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
464 for (int i = 0; i < num_children; i++) |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
465 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
466 graphics_object childObj (gh_manager::get_object (children(i))); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
467 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
468 if (childObj.isa ("axes")) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
469 axesList.append (childObj); |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
470 else if (childObj.isa ("uicontrol") || childObj.isa ("uipanel")) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
471 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
472 Matrix bb = childObj.get_properties ().get_boundingbox (false); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
473 QRectF r (bb(0), bb(1), bb(2), bb(3)); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
474 |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
475 r.adjust (-5, -5, 5, 5); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
476 if (r.contains (event->posF ())) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
477 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
478 currentObj = childObj; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
479 break; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
480 } |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
481 } |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
482 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
483 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
484 if (! currentObj) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
485 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
486 for (QList<graphics_object>::ConstIterator it = axesList.begin (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
487 it != axesList.end (); ++it) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
488 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
489 graphics_object go = selectFromAxes (*it, event->pos ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
490 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
491 if (go) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
492 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
493 currentObj = go; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
494 axesObj = *it; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
495 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
496 // FIXME: is this really necessary? the axes object should |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
497 // have been selected through selectFromAxes anyway |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
498 else if (it->get_properties ().is_hittest ()) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
499 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
500 Matrix bb = it->get_properties ().get_boundingbox (true); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
501 QRectF r (bb(0), bb(1), bb(2), bb(3)); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
502 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
503 if (r.contains (event->posF ())) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
504 axesObj = *it; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
505 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
506 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
507 if (axesObj) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
508 break; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
509 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
510 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
511 if (axesObj) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
512 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
513 if (axesObj.get_properties ().handlevisibility_is ("on")) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
514 Utils::properties<figure> (figObj) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
515 .set_currentaxes (axesObj.get_handle ().as_octave_value ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
516 if (! currentObj) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
517 currentObj = axesObj; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
518 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
519 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
520 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
521 if (! currentObj) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
522 currentObj = obj; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
523 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
524 if (currentObj.get_properties ().handlevisibility_is ("on")) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
525 Utils::properties<figure> (figObj) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
526 .set_currentobject (currentObj.get_handle ().as_octave_value ()); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
527 else |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
528 Utils::properties<figure> (figObj).set_currentobject (octave_NaN); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
529 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
530 Figure* fig = dynamic_cast<Figure*> (Backend::toolkitObject (figObj)); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
531 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
532 MouseMode newMouseMode = NoMode; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
533 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
534 if (fig) |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
535 newMouseMode = fig->mouseMode (); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
536 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
537 switch (newMouseMode) |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
538 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
539 case NoMode: |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
540 gh_manager::post_set (figObj.get_handle (), "selectiontype", |
20009
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
541 Utils::figureSelectionType (event, isdblclick), false); |
19765
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
542 |
18612
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
543 updateCurrentPoint (figObj, obj, event); |
19765
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
544 |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
545 gh_manager::post_callback (figObj.get_handle (), |
19999
0376c1225660
Fix ginput to return button number with Qt toolkit (bug #44676).
Rik <rik@octave.org>
parents:
19967
diff
changeset
|
546 "windowbuttondownfcn", |
0376c1225660
Fix ginput to return button number with Qt toolkit (bug #44676).
Rik <rik@octave.org>
parents:
19967
diff
changeset
|
547 button_number (event)); |
19765
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
548 |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
549 gh_manager::post_callback (currentObj.get_handle (), |
19999
0376c1225660
Fix ginput to return button number with Qt toolkit (bug #44676).
Rik <rik@octave.org>
parents:
19967
diff
changeset
|
550 "buttondownfcn", |
0376c1225660
Fix ginput to return button number with Qt toolkit (bug #44676).
Rik <rik@octave.org>
parents:
19967
diff
changeset
|
551 button_number (event)); |
19765
134e5bfff5c5
* Canvas.cc (button_number): New static function.
John W. Eaton <jwe@octave.org>
parents:
19762
diff
changeset
|
552 |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
553 if (event->button () == Qt::RightButton) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
554 ContextMenu::executeAt (currentObj.get_properties (), |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
555 event->globalPos ()); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
556 break; |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
557 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
558 case TextMode: |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
559 // Handle text insertion here. |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
560 break; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
561 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
562 case PanMode: |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
563 case RotateMode: |
19867
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
564 case ZoomInMode: |
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
565 case ZoomOutMode: |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
566 if (axesObj) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
567 { |
19762
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
568 bool redraw_figure = true; |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
569 |
20009
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
570 if (isdblclick) |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
571 { |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
572 if (event->button () == Qt::LeftButton) |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
573 { |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
574 axes::properties& ap = |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
575 Utils::properties<axes> (axesObj); |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
576 |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
577 autoscale_axes (ap); |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
578 } |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
579 else |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
580 { |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
581 redraw_figure = false; |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
582 } |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
583 } |
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
584 else if (event->modifiers () == Qt::NoModifier) |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
585 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
586 switch (event->buttons ()) |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
587 { |
19762
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
588 case Qt::LeftButton: |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
589 m_mouseAnchor = m_mouseCurrent = event->pos (); |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
590 m_mouseAxes = axesObj.get_handle (); |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
591 m_mouseMode = newMouseMode; |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
592 break; |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
593 |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
594 case Qt::RightButton: |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
595 Utils::properties<axes> (axesObj).unzoom (); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
596 break; |
19762
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
597 |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
598 case Qt::MidButton: |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
599 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
600 axes::properties& ap = |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
601 Utils::properties<axes> (axesObj); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
602 |
19870
815db217f6f4
provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
603 autoscale_axes (ap); |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
604 } |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
605 break; |
19762
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
606 |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
607 default: |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
608 redraw_figure = false; |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
609 break; |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
610 } |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
611 } |
19762
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
612 else if (event->modifiers () == Qt::ShiftModifier) |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
613 { |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
614 switch (event->buttons ()) |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
615 { |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
616 case Qt::LeftButton: |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
617 Utils::properties<axes> (axesObj).unzoom (); |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
618 break; |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
619 |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
620 default: |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
621 redraw_figure = false; |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
622 break; |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
623 } |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
624 } |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
625 |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
626 if (redraw_figure) |
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
627 redraw (false); |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
628 } |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
629 break; |
19762
eebe8da58f8d
allow shift + left button to zoom out (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19759
diff
changeset
|
630 |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
631 default: |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
632 break; |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
633 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
634 } |
20009
f2dea119369e
Qt Canvas: set selection type to 'open' on double click (Bug #44669)
John Donoghue
parents:
20006
diff
changeset
|
635 |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
636 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
637 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
638 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
639 Canvas::canvasMouseReleaseEvent (QMouseEvent* event) |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
640 { |
19867
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
641 if ((m_mouseMode == ZoomInMode || m_mouseMode == ZoomOutMode) |
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
642 && m_mouseAxes.ok ()) |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
643 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
644 gh_manager::auto_lock lock; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
645 graphics_object ax = gh_manager::get_object (m_mouseAxes); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
646 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
647 if (ax.valid_object ()) |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
648 { |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
649 axes::properties& ap = Utils::properties<axes> (ax); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
650 |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
651 graphics_object obj = gh_manager::get_object (m_handle); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
652 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
653 graphics_object figObj (obj.get_ancestor ("figure")); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
654 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
655 std::string zm = zoom_mode (figObj); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
656 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
657 if (m_mouseAnchor == event->pos ()) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
658 { |
19867
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
659 double factor = m_mouseMode == ZoomInMode ? 2.0 : 0.5; |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
660 |
19894
ac18e88ea1bf
zoom about point for single clicks
John W. Eaton <jwe@octave.org>
parents:
19887
diff
changeset
|
661 ColumnVector p1 = ap.pixel2coord (event->x (), event->y ()); |
ac18e88ea1bf
zoom about point for single clicks
John W. Eaton <jwe@octave.org>
parents:
19887
diff
changeset
|
662 |
ac18e88ea1bf
zoom about point for single clicks
John W. Eaton <jwe@octave.org>
parents:
19887
diff
changeset
|
663 ap.zoom_about_point (zm, p1(0), p1(1), factor); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
664 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
665 else |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
666 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
667 ColumnVector p0 = ap.pixel2coord (m_mouseAnchor.x (), |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
668 m_mouseAnchor.y ()); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
669 ColumnVector p1 = ap.pixel2coord (event->x (), |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
670 event->y ()); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
671 |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
672 Matrix xl (1, 2, 0.0); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
673 Matrix yl (1, 2, 0.0); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
674 |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
675 xl(0) = std::min (p0(0), p1(0)); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
676 xl(1) = std::max (p0(0), p1(0)); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
677 yl(0) = std::min (p0(1), p1(1)); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
678 yl(1) = std::max (p0(1), p1(1)); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
679 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
680 ap.zoom (zm, xl, yl); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
681 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
682 |
18692
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
683 redraw (false); |
fe0e34be5576
maint: untabify recently added code files.
Rik <rik@octave.org>
parents:
18612
diff
changeset
|
684 } |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
685 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
686 else if (m_mouseMode == NoMode) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
687 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
688 gh_manager::auto_lock lock; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
689 graphics_object obj = gh_manager::get_object (m_handle); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
690 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
691 if (obj.valid_object ()) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
692 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
693 graphics_object figObj (obj.get_ancestor ("figure")); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
694 |
18612
9597e00ed2dd
Add support for "windowbuttonmotionfcn" and "currentpoint"
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18505
diff
changeset
|
695 updateCurrentPoint (figObj, obj, event); |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
696 gh_manager::post_callback (figObj.get_handle (), |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
697 "windowbuttonupfcn"); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
698 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
699 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
700 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
701 m_mouseAxes = graphics_handle (); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
702 m_mouseMode = NoMode; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
703 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
704 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
705 void |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
706 Canvas::canvasWheelEvent (QWheelEvent* event) |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
707 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
708 gh_manager::auto_lock lock; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
709 graphics_object obj = gh_manager::get_object (m_handle); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
710 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
711 if (obj.valid_object ()) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
712 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
713 std::string mode; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
714 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
715 graphics_object axesObj; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
716 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
717 Matrix children = obj.get_properties ().get_children (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
718 octave_idx_type num_children = children.numel (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
719 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
720 for (int i = 0; i < num_children; i++) |
19896
0e0a3bbe142f
Canvas.cc: Replace tabs with spaces.
Rik <rik@octave.org>
parents:
19894
diff
changeset
|
721 { |
0e0a3bbe142f
Canvas.cc: Replace tabs with spaces.
Rik <rik@octave.org>
parents:
19894
diff
changeset
|
722 graphics_object childObj (gh_manager::get_object (children(i))); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
723 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
724 if (childObj.isa ("axes")) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
725 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
726 graphics_object go = selectFromAxes (childObj, event->pos ()); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
727 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
728 if (go) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
729 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
730 axesObj = childObj; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
731 break; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
732 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
733 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
734 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
735 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
736 if (axesObj) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
737 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
738 MouseMode newMouseMode = NoMode; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
739 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
740 graphics_object figObj (obj.get_ancestor ("figure")); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
741 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
742 Figure* fig = dynamic_cast<Figure*> (Backend::toolkitObject (figObj)); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
743 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
744 if (fig) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
745 newMouseMode = fig->mouseMode (); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
746 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
747 if (axesObj.get_properties ().handlevisibility_is ("on")) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
748 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
749 Utils::properties<figure> (figObj) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
750 .set_currentaxes (axesObj.get_handle ().as_octave_value ()); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
751 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
752 if (zoom_enabled (figObj)) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
753 { |
19867
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
754 if (event->delta () > 0) |
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
755 newMouseMode = ZoomInMode; |
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
756 else |
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
757 newMouseMode = ZoomOutMode; |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
758 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
759 mode = zoom_mode (figObj); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
760 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
761 else if (pan_enabled (figObj)) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
762 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
763 newMouseMode = PanMode; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
764 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
765 mode = pan_mode (figObj); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
766 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
767 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
768 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
769 bool redrawFigure = true; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
770 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
771 switch (newMouseMode) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
772 { |
19867
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
773 case ZoomInMode: |
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
774 case ZoomOutMode: |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
775 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
776 axes::properties& ap = Utils::properties<axes> (axesObj); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
777 |
19759
ed1bafbb87ee
allow mouse wheel zoom amount to be configurable for qt graphics (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
778 // Control how fast to zoom when using scroll wheel. |
ed1bafbb87ee
allow mouse wheel zoom amount to be configurable for qt graphics (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
779 double wheel_zoom_speed = ap.get_mousewheelzoom (); |
ed1bafbb87ee
allow mouse wheel zoom amount to be configurable for qt graphics (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
780 |
ed1bafbb87ee
allow mouse wheel zoom amount to be configurable for qt graphics (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
781 // Determine if we're zooming in or out. |
19867
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
782 double factor = (newMouseMode == ZoomInMode |
19759
ed1bafbb87ee
allow mouse wheel zoom amount to be configurable for qt graphics (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
783 ? 1 / (1.0 - wheel_zoom_speed) |
ed1bafbb87ee
allow mouse wheel zoom amount to be configurable for qt graphics (bug #44304)
John W. Eaton <jwe@octave.org>
parents:
19681
diff
changeset
|
784 : 1.0 - wheel_zoom_speed); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
785 |
19867
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
786 // FIXME: should we zoom about point for 2D plots? |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
787 |
19867
6ba3d0f7c6e8
improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents:
19782
diff
changeset
|
788 ap.zoom (mode, factor); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
789 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
790 break; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
791 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
792 case PanMode: |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
793 { |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
794 axes::properties& ap = Utils::properties<axes> (axesObj); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
795 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
796 double factor = event->delta () > 0 ? 0.1 : -0.1; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
797 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
798 ap.pan (mode, factor); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
799 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
800 break; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
801 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
802 default: |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
803 redrawFigure = false; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
804 break; |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
805 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
806 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
807 if (redrawFigure) |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
808 redraw (false); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
809 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
810 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
811 } |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
18692
diff
changeset
|
812 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
813 bool |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
814 Canvas::canvasKeyPressEvent (QKeyEvent* event) |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
815 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
816 if (m_eventMask & KeyPress) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
817 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
818 octave_scalar_map eventData = Utils::makeKeyEventStruct (event); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
819 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
820 gh_manager::post_set (m_handle, "currentcharacter", |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
821 eventData.getfield ("Character"), false); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
822 gh_manager::post_callback (m_handle, "keypressfcn", eventData); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
823 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
824 return true; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
825 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
826 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
827 return false; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
828 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
829 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
830 bool |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
831 Canvas::canvasKeyReleaseEvent (QKeyEvent* event) |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
832 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
833 if (! event->isAutoRepeat () && (m_eventMask & KeyRelease)) |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
834 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
835 gh_manager::post_callback (m_handle, "keyreleasefcn", |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
836 Utils::makeKeyEventStruct (event)); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
837 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
838 return true; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
839 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
840 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
841 return false; |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
842 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
843 |
19967
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
844 Canvas* |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
845 Canvas::create (const std::string& /* name */, QWidget* parent, |
3cc0734283dc
style fixes in Qt graphics code
John W. Eaton <jwe@octave.org>
parents:
19959
diff
changeset
|
846 const graphics_handle& handle) |
18498
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
847 { |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
848 // Only OpenGL |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
849 return new GLCanvas (parent, handle); |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
850 } |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
851 |
2e7cad6f180c
Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
852 }; // namespace QtHandles |