annotate libgui/graphics/GLCanvas.cc @ 23449:c763214a8260

maint: Use convention 'int *x' for naming pointers. * mycell.c, myfeval.c, mypow2.c, myprop.c, myset.c, mystruct.c, Backend.cc, Backend.h, BaseControl.cc, BaseControl.h, ButtonControl.cc, ButtonControl.h, ButtonGroup.cc, ButtonGroup.h, Canvas.cc, Canvas.h, CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h, ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h, Figure.cc, Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc, GLCanvas.h, GenericEventNotify.h, ListBoxControl.cc, ListBoxControl.h, Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, MouseModeActionGroup.cc, MouseModeActionGroup.h, Object.cc, Object.h, ObjectFactory.cc, ObjectFactory.h, ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc, PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc, PushTool.h, QtHandlesUtils.cc, QtHandlesUtils.h, RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc, SliderControl.h, TextControl.cc, TextControl.h, TextEdit.cc, TextEdit.h, ToggleButtonControl.cc, ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h, ToolBarButton.cc, ToolBarButton.h, color-picker.cc, file-editor-tab.cc, file-editor.cc, file-editor.h, find-dialog.cc, find-dialog.h, octave-qscintilla.cc, main-window.cc, main-window.h, octave-cmd.cc, octave-dock-widget.cc, parser.cc, shortcut-manager.cc, workspace-view.cc, __ichol__.cc, __ilu__.cc, __magick_read__.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, cellfun.cc, data.cc, gl2ps-print.cc, graphics.cc, graphics.in.h, ls-hdf5.cc, ls-hdf5.h, ls-mat5.cc, mex.h, oct-map.cc, oct-map.h, oct-stream.cc, octave-link.cc, profiler.cc, profiler.h, psi.cc, qz.cc, sighandlers.cc, symtab.h, txt-eng.h, zfstream.cc, zfstream.h, __init_fltk__.cc, audiodevinfo.cc, gzip.cc, ov-class.cc, ov-classdef.cc, ov-classdef.h, ov-dld-fcn.h, ov-fcn-inline.cc, ov-java.cc, ov-java.h, ov.cc, pt-arg-list.cc, pt-array-list.cc, pt-bp.cc, pt-check.cc, pt-classdef.h, pt-decl.cc, pt-eval.cc, pt-idx.cc, pt-idx.h, pt-jit.cc, pt-misc.cc, pt-pr-code.cc, pt-select.cc, pt-stmt.cc, Array.cc, Array.h, CMatrix.cc, MSparse.cc, Sparse.h, dMatrix.cc, dim-vector.h, fCMatrix.cc, fMatrix.cc, CollocWt.cc, bsxfun-defs.cc, eigs-base.cc, gsvd.cc, gsvd.h, lo-lapack-proto.h, oct-norm.cc, randmtzig.cc, svd.cc, svd.h, mx-inlines.cc, oct-binmap.h, oct-sort.cc, oct-sort.h, oct-string.cc, oct-string.h, sparse-sort.cc, sparse-sort.h: Use convention 'int *x' for naming pointers.
author Rik <rik@octave.org>
date Thu, 27 Apr 2017 15:18:20 -0700
parents 092078913d54
children 2aab625b502c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 /*
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23215
diff changeset
3 Copyright (C) 2011-2017 Michael Goffioul
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4
18500
49877d3be064 update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents: 18498
diff changeset
5 This file is part of Octave.
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6
18500
49877d3be064 update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents: 18498
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22490
diff changeset
8 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22490
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22490
diff changeset
10 (at your option) any later version.
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22490
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22490
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22490
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22490
diff changeset
15 GNU General Public License for more details.
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
18500
49877d3be064 update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents: 18498
diff changeset
18 along with Octave; see the file COPYING. If not, see
49877d3be064 update copyright notices for new QtHandles code
John W. Eaton <jwe@octave.org>
parents: 18498
diff changeset
19 <http://www.gnu.org/licenses/>.
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 */
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21692
diff changeset
23 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21203
diff changeset
24 # include "config.h"
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 #endif
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #include "gl-render.h"
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 #include "graphics.h"
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 #include "GLCanvas.h"
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 #include "gl-select.h"
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 namespace QtHandles
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
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
36 GLCanvas::GLCanvas (QWidget *xparent, const graphics_handle& gh)
20192
5c2564643de4 only force indirect OpenGL rendering on Windows systems (bug #44916)
John W. Eaton <jwe@octave.org>
parents: 20168
diff changeset
37 #if defined (Q_OS_WIN32)
22490
49103c6e0782 Enable AlphaChannel in Qt GLCanvas.
Rik <rik@octave.org>
parents: 22417
diff changeset
38 : QGLWidget (QGLFormat (QGL::SampleBuffers | QGL::AlphaChannel |
49103c6e0782 Enable AlphaChannel in Qt GLCanvas.
Rik <rik@octave.org>
parents: 22417
diff changeset
39 QGL::IndirectRendering),
49103c6e0782 Enable AlphaChannel in Qt GLCanvas.
Rik <rik@octave.org>
parents: 22417
diff changeset
40 xparent),
49103c6e0782 Enable AlphaChannel in Qt GLCanvas.
Rik <rik@octave.org>
parents: 22417
diff changeset
41 Canvas (gh)
20192
5c2564643de4 only force indirect OpenGL rendering on Windows systems (bug #44916)
John W. Eaton <jwe@octave.org>
parents: 20168
diff changeset
42 #else
22490
49103c6e0782 Enable AlphaChannel in Qt GLCanvas.
Rik <rik@octave.org>
parents: 22417
diff changeset
43 : QGLWidget (QGLFormat (QGL::SampleBuffers | QGL::AlphaChannel),
49103c6e0782 Enable AlphaChannel in Qt GLCanvas.
Rik <rik@octave.org>
parents: 22417
diff changeset
44 xparent),
49103c6e0782 Enable AlphaChannel in Qt GLCanvas.
Rik <rik@octave.org>
parents: 22417
diff changeset
45 Canvas (gh)
20192
5c2564643de4 only force indirect OpenGL rendering on Windows systems (bug #44916)
John W. Eaton <jwe@octave.org>
parents: 20168
diff changeset
46 #endif
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
47 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
48 setFocusPolicy (Qt::ClickFocus);
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
49 setFocus ();
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
50 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
52 GLCanvas::~GLCanvas (void)
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22413
diff changeset
53 { }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
55 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
56 GLCanvas::draw (const graphics_handle& gh)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
57 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
58 gh_manager::auto_lock lock;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
59 graphics_object go = gh_manager::get_object (gh);
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
61 if (go)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
62 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
63 octave::opengl_renderer r;
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
65 r.set_viewport (width (), height ());
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
66 r.draw (go);
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
67 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
68 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
70 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
71 GLCanvas::toggleAxes (const graphics_handle& gh)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
72 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
73 canvasToggleAxes (gh);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
74 }
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19642
diff changeset
75
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
76 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
77 GLCanvas::toggleGrid (const graphics_handle& gh)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
78 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
79 canvasToggleGrid (gh);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
80 }
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19642
diff changeset
81
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
82 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
83 GLCanvas::autoAxes (const graphics_handle& gh)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
84 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
85 canvasAutoAxes (gh);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
86 }
19870
815db217f6f4 provide autoscale option for Qt plotting (bug #44307)
John W. Eaton <jwe@octave.org>
parents: 19663
diff changeset
87
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
88 graphics_object
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
89 GLCanvas::selectFromAxes (const graphics_object& ax, const QPoint& pt)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
90 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
91 makeCurrent ();
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
93 if (ax)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
94 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
95 octave::opengl_selector s;
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
96
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
97 s.set_viewport (width (), height ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
98 return s.select (ax, pt.x (), height () - pt.y ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
99 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
101 return graphics_object ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
102 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
103
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
104 inline void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
105 glDrawZoomBox (const QPoint& p1, const QPoint& p2)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
106 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
107 glVertex2d (p1.x (), p1.y ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
108 glVertex2d (p2.x (), p1.y ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
109 glVertex2d (p2.x (), p2.y ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
110 glVertex2d (p1.x (), p2.y ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
111 glVertex2d (p1.x (), p1.y ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
112 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
114 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
115 GLCanvas::drawZoomBox (const QPoint& p1, const QPoint& p2)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
116 {
23215
0842b119dc1b Fix opengl "invalid operation" when zooming (bug #50317)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23083
diff changeset
117 glMatrixMode (GL_MODELVIEW);
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
118 glPushMatrix ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
119 glLoadIdentity ();
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
121 glMatrixMode (GL_PROJECTION);
23215
0842b119dc1b Fix opengl "invalid operation" when zooming (bug #50317)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23083
diff changeset
122 glPushMatrix ();
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
123 glLoadIdentity ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
124 glOrtho (0, width (), height (), 0, 1, -1);
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
125
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
126 glPushAttrib (GL_DEPTH_BUFFER_BIT | GL_CURRENT_BIT);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
127 glDisable (GL_DEPTH_TEST);
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
128
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
129 glBegin (GL_POLYGON);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
130 glColor4f (0.45, 0.62, 0.81, 0.1);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
131 glDrawZoomBox (p1, p2);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
132 glEnd ();
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
133
23215
0842b119dc1b Fix opengl "invalid operation" when zooming (bug #50317)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23083
diff changeset
134 glLineWidth (1.5);
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
135 glBegin (GL_LINE_STRIP);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
136 glColor4f (0.45, 0.62, 0.81, 0.9);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
137 glDrawZoomBox (p1, p2);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
138 glEnd ();
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
140 glPopAttrib ();
23215
0842b119dc1b Fix opengl "invalid operation" when zooming (bug #50317)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23083
diff changeset
141
0842b119dc1b Fix opengl "invalid operation" when zooming (bug #50317)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23083
diff changeset
142 glMatrixMode (GL_MODELVIEW);
0842b119dc1b Fix opengl "invalid operation" when zooming (bug #50317)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23083
diff changeset
143 glPopMatrix ();
0842b119dc1b Fix opengl "invalid operation" when zooming (bug #50317)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23083
diff changeset
144
0842b119dc1b Fix opengl "invalid operation" when zooming (bug #50317)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23083
diff changeset
145 glMatrixMode (GL_PROJECTION);
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
146 glPopMatrix ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
147 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
148
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
149 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
150 GLCanvas::paintGL (void)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
151 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
152 canvasPaintEvent ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
153 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
154
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
155 void
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
156 GLCanvas::mouseDoubleClickEvent (QMouseEvent *xevent)
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
157 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
158 canvasMouseDoubleClickEvent (xevent);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
159 }
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19642
diff changeset
160
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
161 void
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
162 GLCanvas::mouseMoveEvent (QMouseEvent *xevent)
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
163 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
164 canvasMouseMoveEvent (xevent);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
165 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
166
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
167 void
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
168 GLCanvas::mousePressEvent (QMouseEvent *xevent)
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
169 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
170 canvasMousePressEvent (xevent);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
171 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
172
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
173 void
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
174 GLCanvas::mouseReleaseEvent (QMouseEvent *xevent)
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
175 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
176 canvasMouseReleaseEvent (xevent);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
177 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
178
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
179 void
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
180 GLCanvas::wheelEvent (QWheelEvent *xevent)
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
181 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
182 canvasWheelEvent (xevent);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
183 }
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19642
diff changeset
184
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
185 void
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
186 GLCanvas::keyPressEvent (QKeyEvent *xevent)
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
187 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
188 if (! canvasKeyPressEvent (xevent))
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
189 QGLWidget::keyPressEvent (xevent);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
190 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
191
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
192 void
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
193 GLCanvas::keyReleaseEvent (QKeyEvent *xevent)
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
194 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
195 if (! canvasKeyReleaseEvent (xevent))
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
196 QGLWidget::keyReleaseEvent (xevent);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22326
diff changeset
197 }
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
198
22413
8758addcf265 maint: Remove ';' at end of namespace declaration.
Rik <rik@octave.org>
parents: 22411
diff changeset
199 }