annotate src/graphics.in.h @ 14846:460a3c6d8bf1

maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists. Example: func() => func () * dynamic.txi, func.txi, oop.txi, var.txi, embedded.cc, fortdemo.cc, funcdemo.cc, paramdemo.cc, stringdemo.cc, unwinddemo.cc, Array.cc, Array.h, CColVector.cc, CDiagMatrix.h, CMatrix.cc, CNDArray.cc, CRowVector.cc, CSparse.cc, CmplxGEPBAL.cc, EIG.cc, MSparse.cc, MatrixType.cc, Sparse-op-defs.h, Sparse-perm-op-defs.h, Sparse.cc, Sparse.h, SparseCmplxCHOL.cc, SparseCmplxCHOL.h, SparseCmplxLU.cc, SparseCmplxQR.cc, SparseCmplxQR.h, SparseQR.cc, SparseQR.h, SparsedbleCHOL.cc, SparsedbleCHOL.h, SparsedbleLU.cc, SparsedbleLU.h, base-lu.cc, cmd-hist.cc, dColVector.cc, dDiagMatrix.h, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc, dbleCHOL.cc, dbleGEPBAL.cc, dim-vector.cc, eigs-base.cc, f2c-main.c, fCColVector.cc, fCDiagMatrix.h, fCMatrix.cc, fCNDArray.cc, fCRowVector.cc, fCmplxGEPBAL.cc, fColVector.cc, fDiagMatrix.h, fEIG.cc, fMatrix.cc, fNDArray.cc, fRowVector.cc, file-ops.cc, file-stat.cc, floatCHOL.cc, floatGEPBAL.cc, idx-vector.h, lo-specfun.cc, lo-sysdep.cc, mx-inlines.cc, oct-binmap.h, oct-convn.cc, oct-md5.cc, oct-mem.h, oct-rand.cc, oct-syscalls.cc, randgamma.c, randmtzig.c, sparse-base-chol.cc, sparse-base-chol.h, sparse-base-lu.cc, sparse-dmsolve.cc, tempname.c, curl.m, divergence.m, randi.m, dlmwrite.m, edit.m, getappdata.m, what.m, getarchdir.m, install.m, installed_packages.m, repackage.m, unload_packages.m, colorbar.m, figure.m, isosurface.m, legend.m, loglog.m, plot.m, plot3.m, plotyy.m, polar.m, __errplot__.m, __ghostscript__.m, __marching_cube__.m, __plt__.m, __scatter__.m, semilogx.m, semilogy.m, trimesh.m, trisurf.m, demo.m, test.m, datetick.m, __delaunayn__.cc, __dsearchn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, balance.cc, bsxfun.cc, ccolamd.cc, cellfun.cc, chol.cc, daspk.cc, dasrt.cc, dassl.cc, dmperm.cc, eig.cc, eigs.cc, fftw.cc, filter.cc, find.cc, kron.cc, lookup.cc, lsode.cc, matrix_type.cc, md5sum.cc, mgorth.cc, qr.cc, quad.cc, rand.cc, regexp.cc, symbfact.cc, tril.cc, urlwrite.cc, op-bm-bm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-cm-cm.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc, op-fdm-fdm.cc, op-fm-fm.cc, op-int.h, op-m-m.cc, op-m-scm.cc, op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-range.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-str.cc, op-struct.cc, bitfcns.cc, data.cc, debug.cc, dynamic-ld.cc, error.cc, gl-render.cc, graphics.cc, graphics.in.h, load-path.cc, ls-hdf5.cc, ls-mat5.cc, ls-mat5.h, ls-oct-ascii.cc, ls-oct-ascii.h, mex.cc, mk-errno-list, oct-map.cc, oct-obj.h, oct-parse.yy, octave-config.in.cc, ov-base-int.cc, ov-base-mat.cc, ov-base.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-cell.cc, ov-class.cc, ov-class.h, ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-intx.h, ov-range.h, ov-re-mat.cc, ov-re-sparse.cc, ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.h, ov.h, pr-output.cc, pt-id.cc, pt-id.h, pt-mat.cc, pt-select.cc, sparse.cc, symtab.cc, symtab.h, syscalls.cc, toplev.cc, txt-eng-ft.cc, variables.cc, zfstream.cc, zfstream.h, Dork.m, getStash.m, myStash.m, Gork.m, Pork.m, myStash.m, getStash.m, myStash.m, getStash.m, myStash.m, fntests.m: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
author Rik <octave@nomad.inbox5.com>
date Sun, 08 Jul 2012 11:28:50 -0700
parents c973d4637659
children f7afecdd87ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1 /*
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 14021
diff changeset
3 Copyright (C) 2007-2012 John W. Eaton
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6962
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6962
diff changeset
10 option) any later version.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
11
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
15 for more details.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
16
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6962
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6962
diff changeset
19 <http://www.gnu.org/licenses/>.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
20
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
21 */
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
22
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
23 #if !defined (graphics_h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
24 #define graphics_h 1
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
25
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
26 #ifdef HAVE_CONFIG_H
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
27 #include <config.h>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
28 #endif
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
29
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
30 #include <cctype>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
31
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
32 #include <algorithm>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
33 #include <list>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
34 #include <map>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
35 #include <set>
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
36 #include <sstream>
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
37 #include <string>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
38
11075
4e31d44a9763 extract caseless_str class to separate header file
John W. Eaton <jwe@octave.org>
parents: 11074
diff changeset
39 #include "caseless-str.h"
9004
17ba311ef110 add one more missing include
Jaroslav Hajek <highegg@gmail.com>
parents: 8944
diff changeset
40 #include "lo-ieee.h"
17ba311ef110 add one more missing include
Jaroslav Hajek <highegg@gmail.com>
parents: 8944
diff changeset
41
6890
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
42 #include "gripes.h"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
43 #include "oct-map.h"
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
44 #include "oct-mutex.h"
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13938
diff changeset
45 #include "oct-refcount.h"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
46 #include "ov.h"
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
47 #include "txt-eng-ft.h"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
48
8944
cb0e9facc342 make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
49 // FIXME -- maybe this should be a configure option?
cb0e9facc342 make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
50 // Matlab defaults to "Helvetica", but that causes problems for many
cb0e9facc342 make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
51 // gnuplot users.
cb0e9facc342 make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
52 #if !defined (OCTAVE_DEFAULT_FONTNAME)
cb0e9facc342 make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
53 #define OCTAVE_DEFAULT_FONTNAME "*"
cb0e9facc342 make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
54 #endif
cb0e9facc342 make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
55
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
56 // ---------------------------------------------------------------------
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
57
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
58 class graphics_handle
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
59 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
60 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
61 graphics_handle (void) : val (octave_NaN) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
62
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
63 graphics_handle (const octave_value& a);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
64
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
65 graphics_handle (int a) : val (a) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
66
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
67 graphics_handle (double a) : val (a) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
68
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
69 graphics_handle (const graphics_handle& a) : val (a.val) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
70
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
71 graphics_handle& operator = (const graphics_handle& a)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
72 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
73 if (&a != this)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
74 val = a.val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
75
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
76 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
77 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
78
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
79 ~graphics_handle (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
80
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
81 double value (void) const { return val; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
82
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
83 octave_value as_octave_value (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
84 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
85 return ok () ? octave_value (val) : octave_value (Matrix ());
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
86 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
87
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
88 // Prefix increment/decrement operators.
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
89 graphics_handle& operator ++ (void)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
90 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
91 ++val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
92 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
93 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
94
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
95 graphics_handle& operator -- (void)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
96 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
97 --val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
98 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
99 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
100
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
101 // Postfix increment/decrement operators.
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
102 const graphics_handle operator ++ (int)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
103 {
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
104 graphics_handle old_value = *this;
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
105 ++(*this);
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
106 return old_value;
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
107 }
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
108
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
109 const graphics_handle operator -- (int)
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
110 {
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
111 graphics_handle old_value = *this;
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
112 --(*this);
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
113 return old_value;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
114 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
115
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
116 bool ok (void) const { return ! xisnan (val); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
117
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
118 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
119 double val;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
120 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
121
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
122 inline bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
123 operator == (const graphics_handle& a, const graphics_handle& b)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
124 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
125 return a.value () == b.value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
126 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
127
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
128 inline bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
129 operator != (const graphics_handle& a, const graphics_handle& b)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
130 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
131 return a.value () != b.value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
132 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
133
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
134 inline bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
135 operator < (const graphics_handle& a, const graphics_handle& b)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
136 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
137 return a.value () < b.value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
138 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
139
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
140 inline bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
141 operator <= (const graphics_handle& a, const graphics_handle& b)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
142 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
143 return a.value () <= b.value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
144 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
145
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
146 inline bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
147 operator >= (const graphics_handle& a, const graphics_handle& b)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
148 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
149 return a.value () >= b.value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
150 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
151
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
152 inline bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
153 operator > (const graphics_handle& a, const graphics_handle& b)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
154 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
155 return a.value () > b.value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
156 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
157
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
158 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
159
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
160 class base_scaler
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
161 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
162 public:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
163 base_scaler (void) { }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
164
7441
0207ba146089 [project @ 2008-02-03 04:38:58 by jwe]
jwe
parents: 7440
diff changeset
165 virtual ~base_scaler (void) { }
7440
4e3b073e910e [project @ 2008-02-02 18:23:50 by jwe]
jwe
parents: 7439
diff changeset
166
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
167 virtual Matrix scale (const Matrix& m) const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
168 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
169 error ("invalid axis scale");
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
170 return m;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
171 }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
172
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
173 virtual NDArray scale (const NDArray& m) const
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
174 {
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
175 error ("invalid axis scale");
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
176 return m;
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
177 }
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
178
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
179 virtual double scale (double d) const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
180 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
181 error ("invalid axis scale");
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
182 return d;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
183 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
184
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
185 virtual double unscale (double d) const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
186 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
187 error ("invalid axis scale");
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
188 return d;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
189 }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
190
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
191 virtual base_scaler* clone () const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
192 { return new base_scaler (); }
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
193
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
194 virtual bool is_linear (void) const
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
195 { return false; }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
196 };
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
197
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
198 class lin_scaler : public base_scaler
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
199 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
200 public:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
201 lin_scaler (void) { }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
202
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
203 Matrix scale (const Matrix& m) const { return m; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
204
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
205 NDArray scale (const NDArray& m) const { return m; }
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
206
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
207 double scale (double d) const { return d; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
208
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
209 double unscale (double d) const { return d; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
210
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
211 base_scaler* clone (void) const { return new lin_scaler (); }
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
212
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
213 bool is_linear (void) const { return true; }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
214 };
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
215
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
216 class log_scaler : public base_scaler
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
217 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
218 public:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
219 log_scaler (void) { }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
220
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
221 Matrix scale (const Matrix& m) const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
222 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
223 Matrix retval (m.rows (), m.cols ());
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
224
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
225 do_scale (m.data (), retval.fortran_vec (), m.numel ());
13756
6dfebfa334cb allow negative data log plots with OpenGL+FLTK graphics (bug #34232)
John W. Eaton <jwe@octave.org>
parents: 13722
diff changeset
226
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
227 return retval;
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
228 }
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
229
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
230 NDArray scale (const NDArray& m) const
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
231 {
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
232 NDArray retval (m.dims ());
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
233
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
234 do_scale (m.data (), retval.fortran_vec (), m.numel ());
13756
6dfebfa334cb allow negative data log plots with OpenGL+FLTK graphics (bug #34232)
John W. Eaton <jwe@octave.org>
parents: 13722
diff changeset
235
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
236 return retval;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
237 }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
238
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
239 double scale (double d) const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
240 { return log10 (d); }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
241
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
242 double unscale (double d) const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
243 { return pow (10.0, d); }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
244
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
245 base_scaler* clone (void) const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
246 { return new log_scaler (); }
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
247
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
248 private:
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
249 void do_scale (const double *src, double *dest, int n) const
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
250 {
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
251 for (int i = 0; i < n; i++)
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
252 dest[i] = log10 (src[i]);
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
253 }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
254 };
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
255
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
256 class neg_log_scaler : public base_scaler
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
257 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
258 public:
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
259 neg_log_scaler (void) { }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
260
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
261 Matrix scale (const Matrix& m) const
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
262 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
263 Matrix retval (m.rows (), m.cols ());
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
264
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
265 do_scale (m.data (), retval.fortran_vec (), m.numel ());
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
266
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
267 return retval;
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
268 }
13756
6dfebfa334cb allow negative data log plots with OpenGL+FLTK graphics (bug #34232)
John W. Eaton <jwe@octave.org>
parents: 13722
diff changeset
269
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
270 NDArray scale (const NDArray& m) const
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
271 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
272 NDArray retval (m.dims ());
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
273
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
274 do_scale (m.data (), retval.fortran_vec (), m.numel ());
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
275
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
276 return retval;
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
277 }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
278
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
279 double scale (double d) const
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
280 { return -log10 (-d); }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
281
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
282 double unscale (double d) const
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
283 { return -pow (10.0, -d); }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
284
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
285 base_scaler* clone (void) const
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
286 { return new neg_log_scaler (); }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
287
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
288 private:
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
289 void do_scale (const double *src, double *dest, int n) const
13756
6dfebfa334cb allow negative data log plots with OpenGL+FLTK graphics (bug #34232)
John W. Eaton <jwe@octave.org>
parents: 13722
diff changeset
290 {
6dfebfa334cb allow negative data log plots with OpenGL+FLTK graphics (bug #34232)
John W. Eaton <jwe@octave.org>
parents: 13722
diff changeset
291 for (int i = 0; i < n; i++)
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
292 dest[i] = -log10 (-src[i]);
13756
6dfebfa334cb allow negative data log plots with OpenGL+FLTK graphics (bug #34232)
John W. Eaton <jwe@octave.org>
parents: 13722
diff changeset
293 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
294 };
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
295
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
296 class scaler
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
297 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
298 public:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
299 scaler (void) : rep (new base_scaler ()) { }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
300
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
301 scaler (const scaler& s) : rep (s.rep->clone ()) { }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
302
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
303 scaler (const std::string& s)
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
304 : rep (s == "log"
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
305 ? new log_scaler ()
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
306 : (s == "neglog" ? new neg_log_scaler ()
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
307 : (s == "linear" ? new lin_scaler () : new base_scaler ())))
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
308 { }
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
309
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
310 ~scaler (void) { delete rep; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
311
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
312 Matrix scale (const Matrix& m) const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
313 { return rep->scale (m); }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
314
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
315 NDArray scale (const NDArray& m) const
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
316 { return rep->scale (m); }
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
317
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
318 double scale (double d) const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
319 { return rep->scale (d); }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
320
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
321 double unscale (double d) const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
322 { return rep->unscale (d); }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
323
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
324 bool is_linear (void) const
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
325 { return rep->is_linear (); }
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
326
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
327 scaler& operator = (const scaler& s)
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
328 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
329 if (rep)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
330 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
331 delete rep;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
332 rep = 0;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
333 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
334
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
335 rep = s.rep->clone ();
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
336
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
337 return *this;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
338 }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
339
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
340 scaler& operator = (const std::string& s)
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
341 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
342 if (rep)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
343 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
344 delete rep;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
345 rep = 0;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
346 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
347
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
348 if (s == "log")
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
349 rep = new log_scaler ();
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
350 else if (s == "neglog")
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
351 rep = new neg_log_scaler ();
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
352 else if (s == "linear")
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
353 rep = new lin_scaler ();
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
354 else
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
355 rep = new base_scaler ();
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
356
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
357 return *this;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
358 }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
359
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
360 private:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
361 base_scaler *rep;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
362 };
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
363
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
364 // ---------------------------------------------------------------------
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
365
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
366 class property;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
367
13924
3b654a0753b1 Implement waitfor, uiwait and uiresume.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13868
diff changeset
368 enum listener_mode { POSTSET, PERSISTENT, PREDELETE };
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
369
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
370 class base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
371 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
372 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
373 friend class property;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
374
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
375 public:
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
376 base_property (void)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
377 : id (-1), count (1), name (), parent (), hidden (), listeners ()
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
378 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
379
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
380 base_property (const std::string& s, const graphics_handle& h)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
381 : id (-1), count (1), name (s), parent (h), hidden (false), listeners ()
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
382 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
383
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
384 base_property (const base_property& p)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
385 : id (-1), count (1), name (p.name), parent (p.parent),
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
386 hidden (p.hidden), listeners ()
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
387 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
388
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
389 virtual ~base_property (void) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
390
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
391 bool ok (void) const { return parent.ok (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
392
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
393 std::string get_name (void) const { return name; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
394
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
395 void set_name (const std::string& s) { name = s; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
396
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
397 graphics_handle get_parent (void) const { return parent; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
398
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
399 void set_parent (const graphics_handle &h) { parent = h; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
400
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
401 bool is_hidden (void) const { return hidden; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
402
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
403 void set_hidden (bool flag) { hidden = flag; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
404
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
405 virtual bool is_radio (void) const { return false; }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
406
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
407 int get_id (void) const { return id; }
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
408
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
409 void set_id (int d) { id = d; }
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
410
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
411 // Sets property value, notifies graphics toolkit.
8058
ca39c21fa4b8 [mq]: generic_octave_to_backend_nofitication
John W. Eaton <jwe@octave.org>
parents: 8052
diff changeset
412 // If do_run is true, runs associated listeners.
13321
5ea207067ee5 Export base_property::set.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13307
diff changeset
413 OCTINTERP_API bool set (const octave_value& v, bool do_run = true,
5ea207067ee5 Export base_property::set.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13307
diff changeset
414 bool do_notify_toolkit = true);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
415
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
416 virtual octave_value get (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
417 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
418 error ("get: invalid property \"%s\"", name.c_str ());
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
419 return octave_value ();
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
420 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
421
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
422
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
423 virtual std::string values_as_string (void) const
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
424 {
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
425 error ("values_as_string: invalid property \"%s\"", name.c_str ());
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
426 return std::string ();
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
427 }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
428
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
429 virtual Cell values_as_cell (void) const
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
430 {
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
431 error ("values_as_cell: invalid property \"%s\"", name.c_str ());
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
432 return Cell ();
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
433 }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
434
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
435 base_property& operator = (const octave_value& val)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
436 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
437 set (val);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
438 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
439 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
440
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
441 void add_listener (const octave_value& v, listener_mode mode = POSTSET)
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
442 {
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
443 octave_value_list& l = listeners[mode];
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
444 l.resize (l.length () + 1, v);
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
445 }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
446
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
447 void delete_listener (const octave_value& v = octave_value (),
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
448 listener_mode mode = POSTSET)
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
449 {
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
450 octave_value_list& l = listeners[mode];
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
451
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
452 if (v.is_defined ())
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
453 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
454 bool found = false;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
455 int i;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
456
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
457 for (i = 0; i < l.length (); i++)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
458 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
459 if (v.internal_rep () == l(i).internal_rep ())
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
460 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
461 found = true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
462 break;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
463 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
464 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
465 if (found)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
466 {
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
467 for (int j = i; j < l.length () - 1; j++)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
468 l(j) = l (j + 1);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
469
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
470 l.resize (l.length () - 1);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
471 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
472 }
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
473 else
12506
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
474 {
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
475 if (mode == PERSISTENT)
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
476 l.resize (0);
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
477 else
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
478 {
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
479 octave_value_list lnew (0);
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
480 octave_value_list& lp = listeners[PERSISTENT];
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
481 for (int i = l.length () - 1; i >= 0 ; i--)
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
482 {
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
483 for (int j = 0; j < lp.length (); j++)
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
484 {
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
485 if (l(i).internal_rep () == lp(j).internal_rep ())
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
486 {
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
487 lnew.resize (lnew.length () + 1, l(i));
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
488 break;
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
489 }
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
490 }
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
491 }
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
492 l = lnew;
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
493 }
0dda50ae4997 add a persistent mode for listeners
Konstantinos Poulios <logari81@gmail.com>
parents: 12503
diff changeset
494 }
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
495
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
496 }
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
497
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
498 OCTINTERP_API void run_listeners (listener_mode mode = POSTSET);
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
499
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
500 virtual base_property* clone (void) const
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
501 { return new base_property (*this); }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
502
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
503 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
504 virtual bool do_set (const octave_value&)
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
505 {
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
506 error ("set: invalid property \"%s\"", name.c_str ());
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
507 return false;
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
508 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
509
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
510 private:
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
511 typedef std::map<listener_mode, octave_value_list> listener_map;
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
512 typedef std::map<listener_mode, octave_value_list>::iterator listener_map_iterator;
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
513 typedef std::map<listener_mode, octave_value_list>::const_iterator listener_map_const_iterator;
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
514
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
515 private:
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
516 int id;
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13938
diff changeset
517 octave_refcount<int> count;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
518 std::string name;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
519 graphics_handle parent;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
520 bool hidden;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
521 listener_map listeners;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
522 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
523
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
524 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
525
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
526 class string_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
527 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
528 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
529 string_property (const std::string& s, const graphics_handle& h,
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
530 const std::string& val = "")
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
531 : base_property (s, h), str (val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
532
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
533 string_property (const string_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
534 : base_property (p), str (p.str) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
535
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
536 octave_value get (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
537 { return octave_value (str); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
538
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
539 std::string string_value (void) const { return str; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
540
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
541 string_property& operator = (const octave_value& val)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
542 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
543 set (val);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
544 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
545 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
546
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
547 base_property* clone (void) const { return new string_property (*this); }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
548
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
549 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
550 bool do_set (const octave_value& val)
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
551 {
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
552 if (val.is_string ())
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
553 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
554 std::string new_str = val.string_value ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
555
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
556 if (new_str != str)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
557 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
558 str = new_str;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
559 return true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
560 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
561 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
562 else
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
563 error ("set: invalid string property value for \"%s\"",
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
564 get_name ().c_str ());
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
565 return false;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
566 }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
567
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
568 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
569 std::string str;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
570 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
571
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
572 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
573
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
574 class string_array_property : public base_property
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
575 {
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
576 public:
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
577 enum desired_enum { string_t, cell_t };
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
578
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
579 string_array_property (const std::string& s, const graphics_handle& h,
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
580 const std::string& val = "", const char& sep = '|',
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
581 const desired_enum& typ = string_t)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
582 : base_property (s, h), desired_type (typ), separator (sep), str ()
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
583 {
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
584 size_t pos = 0;
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
585
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
586 while (true)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
587 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
588 size_t new_pos = val.find_first_of (separator, pos);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
589
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
590 if (new_pos == std::string::npos)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
591 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
592 str.append (val.substr (pos));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
593 break;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
594 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
595 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
596 str.append (val.substr (pos, new_pos - pos));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
597
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
598 pos = new_pos + 1;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
599 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
600 }
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
601
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
602 string_array_property (const std::string& s, const graphics_handle& h,
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
603 const Cell& c, const char& sep = '|',
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
604 const desired_enum& typ = string_t)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
605 : base_property (s, h), desired_type (typ), separator (sep), str ()
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
606 {
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
607 if (c.is_cellstr ())
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
608 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
609 string_vector strings (c.numel ());
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
610
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
611 for (octave_idx_type i = 0; i < c.numel (); i++)
10585
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
612 strings[i] = c(i).string_value ();
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
613
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
614 str = strings;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
615 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
616 else
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
617 error ("set: invalid order property value for \"%s\"",
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
618 get_name ().c_str ());
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
619 }
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
620
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
621 string_array_property (const string_array_property& p)
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
622 : base_property (p), desired_type (p.desired_type),
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
623 separator (p.separator), str (p.str) { }
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
624
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
625 octave_value get (void) const
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
626 {
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
627 if (desired_type == string_t)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
628 return octave_value (string_value ());
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
629 else
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
630 return octave_value (cell_value ());
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
631 }
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
632
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
633 std::string string_value (void) const
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
634 {
10585
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
635 std::string s;
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
636
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
637 for (octave_idx_type i = 0; i < str.length (); i++)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
638 {
10585
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
639 s += str[i];
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
640 if (i != str.length () - 1)
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
641 s += separator;
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
642 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
643
10585
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
644 return s;
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
645 }
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
646
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
647 Cell cell_value (void) const {return Cell (str);}
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
648
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
649 string_vector string_vector_value (void) const { return str; }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
650
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
651 string_array_property& operator = (const octave_value& val)
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
652 {
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
653 set (val);
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
654 return *this;
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
655 }
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
656
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
657 base_property* clone (void) const { return new string_array_property (*this); }
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
658
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
659 protected:
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
660 bool do_set (const octave_value& val)
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
661 {
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
662 if (val.is_string ())
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
663 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
664 bool replace = false;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
665 std::string new_str = val.string_value ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
666 string_vector strings;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
667 size_t pos = 0;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
668
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
669 while (pos != std::string::npos)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
670 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
671 size_t new_pos = new_str.find_first_of (separator, pos);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
672
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
673 if (new_pos == std::string::npos)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
674 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
675 strings.append (new_str.substr (pos));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
676 break;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
677 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
678 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
679 strings.append (new_str.substr (pos, new_pos - pos));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
680
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
681 pos = new_pos + 1;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
682 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
683
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
684 if (str.numel () == strings.numel ())
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
685 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
686 for (octave_idx_type i = 0; i < str.numel (); i++)
10585
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
687 if (strings[i] != str[i])
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
688 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
689 replace = true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
690 break;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
691 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
692 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
693 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
694 replace = true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
695
13938
3cb8f1fe108c Remember the type of uicontrol::string (plain string or cellstr).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13924
diff changeset
696 desired_type = string_t;
3cb8f1fe108c Remember the type of uicontrol::string (plain string or cellstr).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13924
diff changeset
697
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
698 if (replace)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
699 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
700 str = strings;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
701 return true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
702 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
703 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
704 else if (val.is_cellstr ())
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
705 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
706 bool replace = false;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
707 Cell new_cell = val.cell_value ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
708
10585
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
709 string_vector strings = new_cell.cellstr_value ();
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
710
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
711 octave_idx_type nel = strings.length ();
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
712
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
713 if (nel != str.length ())
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
714 replace = true;
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
715 else
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
716 {
10585
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
717 for (octave_idx_type i = 0; i < nel; i++)
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
718 {
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
719 if (strings[i] != str[i])
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
720 {
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
721 replace = true;
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
722 break;
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
723 }
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
724 }
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
725 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
726
13938
3cb8f1fe108c Remember the type of uicontrol::string (plain string or cellstr).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13924
diff changeset
727 desired_type = cell_t;
3cb8f1fe108c Remember the type of uicontrol::string (plain string or cellstr).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13924
diff changeset
728
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
729 if (replace)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
730 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
731 str = strings;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
732 return true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
733 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
734 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
735 else
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
736 error ("set: invalid string property value for \"%s\"",
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
737 get_name ().c_str ());
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
738 return false;
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
739 }
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
740
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
741 private:
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
742 desired_enum desired_type;
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
743 char separator;
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
744 string_vector str;
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
745 };
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
746
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
747 // ---------------------------------------------------------------------
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
748
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
749 class text_label_property : public base_property
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
750 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
751 public:
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
752 enum type { char_t, cellstr_t };
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
753
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
754 text_label_property (const std::string& s, const graphics_handle& h,
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
755 const std::string& val = "")
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
756 : base_property (s, h), value (val), stored_type (char_t)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
757 { }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
758
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
759 text_label_property (const std::string& s, const graphics_handle& h,
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
760 const NDArray& nda)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
761 : base_property (s, h), stored_type (char_t)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
762 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
763 octave_idx_type nel = nda.numel ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
764
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
765 value.resize (nel);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
766
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
767 for (octave_idx_type i = 0; i < nel; i++)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
768 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
769 std::ostringstream buf;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
770 buf << nda(i);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
771 value[i] = buf.str ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
772 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
773 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
774
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
775 text_label_property (const std::string& s, const graphics_handle& h,
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
776 const Cell& c)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
777 : base_property (s, h), stored_type (cellstr_t)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
778 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
779 octave_idx_type nel = c.numel ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
780
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
781 value.resize (nel);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
782
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
783 for (octave_idx_type i = 0; i < nel; i++)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
784 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
785 octave_value tmp = c(i);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
786
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
787 if (tmp.is_string ())
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
788 value[i] = c(i).string_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
789 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
790 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
791 double d = c(i).double_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
792
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
793 if (! error_state)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
794 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
795 std::ostringstream buf;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
796 buf << d;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
797 value[i] = buf.str ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
798 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
799 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
800 break;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
801 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
802 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
803 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
804
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
805 text_label_property (const text_label_property& p)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
806 : base_property (p), value (p.value), stored_type (p.stored_type)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
807 { }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
808
12965
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
809 bool empty (void) const
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
810 {
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
811 octave_value tmp = get ();
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
812 return tmp.is_empty ();
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
813 }
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
814
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
815 octave_value get (void) const
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
816 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
817 if (stored_type == char_t)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
818 return octave_value (char_value ());
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
819 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
820 return octave_value (cell_value ());
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
821 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
822
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
823 std::string string_value (void) const
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
824 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
825 return value.empty () ? std::string () : value[0];
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
826 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
827
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
828 string_vector string_vector_value (void) const { return value; }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
829
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
830 charMatrix char_value (void) const { return charMatrix (value, ' '); }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
831
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
832 Cell cell_value (void) const {return Cell (value); }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
833
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
834 text_label_property& operator = (const octave_value& val)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
835 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
836 set (val);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
837 return *this;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
838 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
839
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
840 base_property* clone (void) const { return new text_label_property (*this); }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
841
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
842 protected:
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
843
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
844 bool do_set (const octave_value& val)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
845 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
846 if (val.is_string ())
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
847 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
848 value = val.all_strings ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
849
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
850 stored_type = char_t;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
851 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
852 else if (val.is_cell ())
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
853 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
854 Cell c = val.cell_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
855
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
856 octave_idx_type nel = c.numel ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
857
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
858 value.resize (nel);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
859
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
860 for (octave_idx_type i = 0; i < nel; i++)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
861 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
862 octave_value tmp = c(i);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
863
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
864 if (tmp.is_string ())
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
865 value[i] = c(i).string_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
866 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
867 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
868 double d = c(i).double_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
869
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
870 if (! error_state)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
871 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
872 std::ostringstream buf;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
873 buf << d;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
874 value[i] = buf.str ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
875 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
876 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
877 return false;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
878 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
879 }
12965
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
880
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
881 stored_type = cellstr_t;
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
882 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
883 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
884 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
885 NDArray nda = val.array_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
886
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
887 if (! error_state)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
888 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
889 octave_idx_type nel = nda.numel ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
890
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
891 value.resize (nel);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
892
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
893 for (octave_idx_type i = 0; i < nel; i++)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
894 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
895 std::ostringstream buf;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
896 buf << nda(i);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
897 value[i] = buf.str ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
898 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
899
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
900 stored_type = char_t;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
901 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
902 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
903 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
904 error ("set: invalid string property value for \"%s\"",
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
905 get_name ().c_str ());
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
906
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
907 return false;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
908 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
909 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
910
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
911 return true;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
912 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
913
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
914 private:
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
915 string_vector value;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
916 type stored_type;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
917 };
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
918
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
919 // ---------------------------------------------------------------------
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
920
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
921 class radio_values
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
922 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
923 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
924 OCTINTERP_API radio_values (const std::string& opt_string = std::string ());
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
925
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
926 radio_values (const radio_values& a)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
927 : default_val (a.default_val), possible_vals (a.possible_vals) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
928
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
929 radio_values& operator = (const radio_values& a)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
930 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
931 if (&a != this)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
932 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
933 default_val = a.default_val;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
934 possible_vals = a.possible_vals;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
935 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
936
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
937 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
938 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
939
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
940 std::string default_value (void) const { return default_val; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
941
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
942 bool validate (const std::string& val, std::string& match)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
943 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
944 bool retval = true;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
945
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
946 if (! contains (val, match))
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
947 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
948 error ("invalid value = %s", val.c_str ());
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
949 retval = false;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
950 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
951
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
952 return retval;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
953 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
954
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
955 bool contains (const std::string& val, std::string& match)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
956 {
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
957 size_t k = 0;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
958
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
959 size_t len = val.length ();
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
960
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
961 std::string first_match;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
962
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
963 for (std::set<caseless_str>::const_iterator p = possible_vals.begin ();
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
964 p != possible_vals.end (); p++)
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
965 {
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
966 if (p->compare (val, len))
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
967 {
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
968 if (len == p->length ())
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
969 {
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
970 // We found a full match (consider the case of val ==
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
971 // "replace" with possible values "replace" and
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
972 // "replacechildren"). Any other matches are
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
973 // irrelevant, so set match and return now.
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
974
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
975 match = *p;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
976 return true;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
977 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
978 else
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
979 {
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
980 if (k == 0)
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
981 first_match = *p;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
982
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
983 k++;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
984 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
985 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
986 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
987
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
988 if (k == 1)
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
989 {
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
990 match = first_match;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
991 return true;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
992 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
993 else
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
994 return false;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
995 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
996
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
997 std::string values_as_string (void) const;
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
998
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
999 Cell values_as_cell (void) const;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1000
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1001 octave_idx_type nelem (void) const { return possible_vals.size (); }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1002
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1003 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1004 // Might also want to cache
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1005 std::string default_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1006 std::set<caseless_str> possible_vals;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1007 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1008
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1009 class radio_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1010 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1011 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1012 radio_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1013 const radio_values& v = radio_values ())
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1014 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1015 vals (v), current_val (v.default_value ()) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1016
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1017 radio_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1018 const std::string& v)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1019 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1020 vals (v), current_val (vals.default_value ()) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1021
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1022 radio_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1023 const radio_values& v, const std::string& def)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1024 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1025 vals (v), current_val (def) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1026
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1027 radio_property (const radio_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1028 : base_property (p), vals (p.vals), current_val (p.current_val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1029
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1030 octave_value get (void) const { return octave_value (current_val); }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1031
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1032 const std::string& current_value (void) const { return current_val; }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1033
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1034 std::string values_as_string (void) const { return vals.values_as_string (); }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1035
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1036 Cell values_as_cell (void) const { return vals.values_as_cell (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1037
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1038 bool is (const caseless_str& v) const
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1039 { return v.compare (current_val); }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1040
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1041 bool is_radio (void) const { return true; }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1042
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1043 radio_property& operator = (const octave_value& val)
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1044 {
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1045 set (val);
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1046 return *this;
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1047 }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1048
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1049 base_property* clone (void) const { return new radio_property (*this); }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1050
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1051 protected:
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1052 bool do_set (const octave_value& newval)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1053 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1054 if (newval.is_string ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1055 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1056 std::string s = newval.string_value ();
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
1057
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
1058 std::string match;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
1059
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
1060 if (vals.validate (s, match))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1061 {
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
1062 if (match != current_val)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1063 {
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
1064 if (s.length () != match.length ())
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
1065 warning_with_id ("Octave:abbreviated-property-match",
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
1066 "%s: allowing %s to match %s value %s",
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
1067 "set", s.c_str (), get_name ().c_str (),
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
1068 match.c_str ());
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
1069 current_val = match;
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1070 return true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1071 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1072 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1073 else
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1074 error ("set: invalid value for radio property \"%s\" (value = %s)",
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1075 get_name ().c_str (), s.c_str ());
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1076 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1077 else
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1078 error ("set: invalid value for radio property \"%s\"",
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1079 get_name ().c_str ());
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1080 return false;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1081 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1082
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1083 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1084 radio_values vals;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1085 std::string current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1086 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1087
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1088 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1089
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1090 class color_values
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1091 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1092 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1093 color_values (double r = 0, double g = 0, double b = 1)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1094 : xrgb (1, 3)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1095 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1096 xrgb(0) = r;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1097 xrgb(1) = g;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1098 xrgb(2) = b;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1099
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1100 validate ();
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1101 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1102
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1103 color_values (std::string str)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1104 : xrgb (1, 3)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1105 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1106 if (! str2rgb (str))
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1107 error ("invalid color specification: %s", str.c_str ());
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1108 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1109
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1110 color_values (const color_values& c)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1111 : xrgb (c.xrgb)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1112 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1113
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1114 color_values& operator = (const color_values& c)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1115 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1116 if (&c != this)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1117 xrgb = c.xrgb;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1118
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1119 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1120 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1121
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1122 bool operator == (const color_values& c) const
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1123 {
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1124 return (xrgb(0) == c.xrgb(0)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1125 && xrgb(1) == c.xrgb(1)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1126 && xrgb(2) == c.xrgb(2));
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1127 }
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1128
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1129 bool operator != (const color_values& c) const
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1130 { return ! (*this == c); }
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1131
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1132 Matrix rgb (void) const { return xrgb; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1133
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1134 operator octave_value (void) const { return xrgb; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1135
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1136 void validate (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1137 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1138 for (int i = 0; i < 3; i++)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1139 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1140 if (xrgb(i) < 0 || xrgb(i) > 1)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1141 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1142 error ("invalid RGB color specification");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1143 break;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1144 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1145 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1146 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1147
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1148 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1149 Matrix xrgb;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1150
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1151 OCTINTERP_API bool str2rgb (std::string str);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1152 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1153
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1154 class color_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1155 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1156 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1157 color_property (const color_values& c, const radio_values& v)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1158 : base_property ("", graphics_handle ()),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1159 current_type (color_t), color_val (c), radio_val (v),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1160 current_val (v.default_value ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1161 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1162
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1163 color_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1164 const color_values& c = color_values (),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1165 const radio_values& v = radio_values ())
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1166 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1167 current_type (color_t), color_val (c), radio_val (v),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1168 current_val (v.default_value ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1169 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1170
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1171 color_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1172 const radio_values& v)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1173 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1174 current_type (radio_t), color_val (color_values ()), radio_val (v),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1175 current_val (v.default_value ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1176 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1177
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1178 color_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1179 const std::string& v)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1180 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1181 current_type (radio_t), color_val (color_values ()), radio_val (v),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1182 current_val (radio_val.default_value ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1183 { }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1184
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1185 color_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1186 const color_property& v)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1187 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1188 current_type (v.current_type), color_val (v.color_val),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1189 radio_val (v.radio_val), current_val (v.current_val)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1190 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1191
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1192 color_property (const color_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1193 : base_property (p), current_type (p.current_type),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1194 color_val (p.color_val), radio_val (p.radio_val),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1195 current_val (p.current_val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1196
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1197 octave_value get (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1198 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1199 if (current_type == color_t)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1200 return color_val.rgb ();
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1201
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1202 return current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1203 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1204
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1205 bool is_rgb (void) const { return (current_type == color_t); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1206
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1207 bool is_radio (void) const { return (current_type == radio_t); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1208
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1209 bool is (const std::string& v) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1210 { return (is_radio () && current_val == v); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1211
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1212 Matrix rgb (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1213 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1214 if (current_type != color_t)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1215 error ("color has no rgb value");
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1216
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1217 return color_val.rgb ();
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1218 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1219
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1220 const std::string& current_value (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1221 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1222 if (current_type != radio_t)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1223 error ("color has no radio value");
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1224
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1225 return current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1226 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1227
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1228 color_property& operator = (const octave_value& val)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1229 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1230 set (val);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1231 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1232 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1233
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1234 operator octave_value (void) const { return get (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1235
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1236 base_property* clone (void) const { return new color_property (*this); }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1237
10724
f0236b444356 Allow set(h) to work if the handle includes color properties
David Bateman <dbateman@free.fr>
parents: 10722
diff changeset
1238 std::string values_as_string (void) const { return radio_val.values_as_string (); }
f0236b444356 Allow set(h) to work if the handle includes color properties
David Bateman <dbateman@free.fr>
parents: 10722
diff changeset
1239
f0236b444356 Allow set(h) to work if the handle includes color properties
David Bateman <dbateman@free.fr>
parents: 10722
diff changeset
1240 Cell values_as_cell (void) const { return radio_val.values_as_cell (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1241
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1242 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1243 OCTINTERP_API bool do_set (const octave_value& newval);
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1244
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1245 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1246 enum current_enum { color_t, radio_t } current_type;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1247 color_values color_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1248 radio_values radio_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1249 std::string current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1250 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1251
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1252 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1253
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1254 class double_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1255 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1256 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1257 double_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1258 double d = 0)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1259 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1260 current_val (d) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1261
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1262 double_property (const double_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1263 : base_property (p), current_val (p.current_val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1264
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1265 octave_value get (void) const { return octave_value (current_val); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1266
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1267 double double_value (void) const { return current_val; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1268
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1269 double_property& operator = (const octave_value& val)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1270 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1271 set (val);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1272 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1273 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1274
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1275 base_property* clone (void) const { return new double_property (*this); }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1276
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1277 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1278 bool do_set (const octave_value& v)
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1279 {
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1280 if (v.is_scalar_type () && v.is_real_type ())
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1281 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1282 double new_val = v.double_value ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1283
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1284 if (new_val != current_val)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1285 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1286 current_val = new_val;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1287 return true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1288 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1289 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1290 else
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1291 error ("set: invalid value for double property \"%s\"",
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1292 get_name ().c_str ());
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1293 return false;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1294 }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1295
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1296 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1297 double current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1298 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1299
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1300 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1301
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1302 class double_radio_property : public base_property
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1303 {
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1304 public:
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1305 double_radio_property (double d, const radio_values& v)
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1306 : base_property ("", graphics_handle ()),
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1307 current_type (double_t), dval (d), radio_val (v),
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1308 current_val (v.default_value ())
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1309 { }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1310
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1311 double_radio_property (const std::string& nm, const graphics_handle& h,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1312 const std::string& v)
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1313 : base_property (nm, h),
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1314 current_type (radio_t), dval (0), radio_val (v),
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1315 current_val (radio_val.default_value ())
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1316 { }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1317
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1318 double_radio_property (const std::string& nm, const graphics_handle& h,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1319 const double_radio_property& v)
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1320 : base_property (nm, h),
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1321 current_type (v.current_type), dval (v.dval),
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1322 radio_val (v.radio_val), current_val (v.current_val)
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1323 { }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1324
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1325 double_radio_property (const double_radio_property& p)
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1326 : base_property (p), current_type (p.current_type),
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1327 dval (p.dval), radio_val (p.radio_val),
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1328 current_val (p.current_val) { }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1329
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1330 octave_value get (void) const
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1331 {
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1332 if (current_type == double_t)
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1333 return dval;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1334
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1335 return current_val;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1336 }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1337
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1338 bool is_double (void) const { return (current_type == double_t); }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1339
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1340 bool is_radio (void) const { return (current_type == radio_t); }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1341
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1342 bool is (const std::string& v) const
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1343 { return (is_radio () && current_val == v); }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1344
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1345 double double_value (void) const
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1346 {
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1347 if (current_type != double_t)
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1348 error ("%s: property has no double", get_name ().c_str ());
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1349
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1350 return dval;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1351 }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1352
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1353 const std::string& current_value (void) const
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1354 {
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1355 if (current_type != radio_t)
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1356 error ("%s: property has no radio value");
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1357
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1358 return current_val;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1359 }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1360
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1361 double_radio_property& operator = (const octave_value& val)
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1362 {
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1363 set (val);
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1364 return *this;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1365 }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1366
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1367 operator octave_value (void) const { return get (); }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1368
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1369 base_property* clone (void) const
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1370 { return new double_radio_property (*this); }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1371
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1372 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1373 OCTINTERP_API bool do_set (const octave_value& v);
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1374
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1375 private:
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1376 enum current_enum { double_t, radio_t } current_type;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1377 double dval;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1378 radio_values radio_val;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1379 std::string current_val;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1380 };
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1381
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1382 // ---------------------------------------------------------------------
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1383
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1384 class array_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1385 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1386 public:
7836
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1387 array_property (void)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1388 : base_property ("", graphics_handle ()), data (Matrix ()),
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1389 xmin (), xmax (), xminp (), xmaxp (),
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1390 type_constraints (), size_constraints ()
7836
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1391 {
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1392 get_data_limits ();
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1393 }
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1394
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1395 array_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1396 const octave_value& m)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1397 : base_property (nm, h), data (m),
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1398 xmin (), xmax (), xminp (), xmaxp (),
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1399 type_constraints (), size_constraints ()
7836
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1400 {
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1401 get_data_limits ();
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1402 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1403
7848
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
1404 // This copy constructor is only intended to be used
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
1405 // internally to access min/max values; no need to
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
1406 // copy constraints.
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
1407 array_property (const array_property& p)
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
1408 : base_property (p), data (p.data),
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1409 xmin (p.xmin), xmax (p.xmax), xminp (p.xminp), xmaxp (p.xmaxp),
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1410 type_constraints (), size_constraints ()
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1411 { }
7848
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
1412
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1413 octave_value get (void) const { return data; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1414
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1415 void add_constraint (const std::string& type)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1416 { type_constraints.push_back (type); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1417
7524
a653856aa3e1 array_value::add_constraint: pass dim_vector as const reference, not value
John W. Eaton <jwe@octave.org>
parents: 7523
diff changeset
1418 void add_constraint (const dim_vector& dims)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1419 { size_constraints.push_back (dims); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1420
7836
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1421 double min_val (void) const { return xmin; }
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1422 double max_val (void) const { return xmax; }
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1423 double min_pos (void) const { return xminp; }
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1424 double max_neg (void) const { return xmaxp; }
7836
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1425
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1426 Matrix get_limits (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1427 {
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1428 Matrix m (1, 4);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1429
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1430 m(0) = min_val ();
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1431 m(1) = max_val ();
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1432 m(2) = min_pos ();
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1433 m(3) = max_neg ();
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1434
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1435 return m;
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1436 }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1437
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1438 array_property& operator = (const octave_value& val)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1439 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1440 set (val);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1441 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1442 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1443
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1444 base_property* clone (void) const
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1445 {
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1446 array_property *p = new array_property (*this);
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1447
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1448 p->type_constraints = type_constraints;
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1449 p->size_constraints = size_constraints;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1450
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1451 return p;
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1452 }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1453
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1454 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1455 bool do_set (const octave_value& v)
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1456 {
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1457 if (validate (v))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1458 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1459 // FIXME -- should we check for actual data change?
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1460 if (! is_equal (v))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1461 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1462 data = v;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1463
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1464 get_data_limits ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1465
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1466 return true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1467 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1468 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1469 else
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1470 error ("invalid value for array property \"%s\"",
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1471 get_name ().c_str ());
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1472
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1473 return false;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1474 }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1475
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1476 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1477 OCTINTERP_API bool validate (const octave_value& v);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1478
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1479 OCTINTERP_API bool is_equal (const octave_value& v) const;
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1480
7836
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1481 OCTINTERP_API void get_data_limits (void);
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1482
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1483 protected:
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1484 octave_value data;
7836
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1485 double xmin;
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1486 double xmax;
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
1487 double xminp;
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1488 double xmaxp;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1489 std::list<std::string> type_constraints;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1490 std::list<dim_vector> size_constraints;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1491 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1492
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1493 class row_vector_property : public array_property
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1494 {
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1495 public:
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1496 row_vector_property (const std::string& nm, const graphics_handle& h,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1497 const octave_value& m)
7527
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1498 : array_property (nm, h, m)
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1499 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1500 add_constraint (dim_vector (-1, 1));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1501 add_constraint (dim_vector (1, -1));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1502 }
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1503
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1504 row_vector_property (const row_vector_property& p)
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1505 : array_property (p)
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1506 {
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1507 add_constraint (dim_vector (-1, 1));
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1508 add_constraint (dim_vector (1, -1));
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1509 }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1510
7527
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1511 void add_constraint (const std::string& type)
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1512 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1513 array_property::add_constraint (type);
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1514 }
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1515
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1516 void add_constraint (const dim_vector& dims)
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1517 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1518 array_property::add_constraint (dims);
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1519 }
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1520
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1521 void add_constraint (octave_idx_type len)
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1522 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1523 size_constraints.remove (dim_vector (1, -1));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1524 size_constraints.remove (dim_vector (-1, 1));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1525
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1526 add_constraint (dim_vector (1, len));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1527 add_constraint (dim_vector (len, 1));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1528 }
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1529
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1530 row_vector_property& operator = (const octave_value& val)
7527
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1531 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1532 set (val);
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1533 return *this;
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1534 }
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1535
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1536 base_property* clone (void) const
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1537 {
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1538 row_vector_property *p = new row_vector_property (*this);
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1539
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1540 p->type_constraints = type_constraints;
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1541 p->size_constraints = size_constraints;
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1542
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1543 return p;
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1544 }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1545
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1546 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1547 bool do_set (const octave_value& v)
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1548 {
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1549 bool retval = array_property::do_set (v);
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1550
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1551 if (! error_state)
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1552 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1553 dim_vector dv = data.dims ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1554
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1555 if (dv(0) > 1 && dv(1) == 1)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1556 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1557 int tmp = dv(0);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1558 dv(0) = dv(1);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1559 dv(1) = tmp;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1560
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1561 data = data.reshape (dv);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1562 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1563
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1564 return retval;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1565 }
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1566
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1567 return false;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1568 }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1569
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1570 private:
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1571 OCTINTERP_API bool validate (const octave_value& v);
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1572 };
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1573
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1574 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1575
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1576 class bool_property : public radio_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1577 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1578 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1579 bool_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1580 bool val)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1581 : radio_property (nm, h, radio_values (val ? "{on}|off" : "on|{off}"))
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1582 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1583
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1584 bool_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1585 const char* val)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1586 : radio_property (nm, h, radio_values ("on|off"), val)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1587 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1588
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1589 bool_property (const bool_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1590 : radio_property (p) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1591
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1592 bool is_on (void) const { return is ("on"); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1593
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1594 bool_property& operator = (const octave_value& val)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1595 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1596 set (val);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1597 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1598 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1599
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1600 base_property* clone (void) const { return new bool_property (*this); }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1601
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1602 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1603 bool do_set (const octave_value& val)
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1604 {
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1605 if (val.is_bool_scalar ())
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1606 return radio_property::do_set (val.bool_value () ? "on" : "off");
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1607 else
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1608 return radio_property::do_set (val);
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1609 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1610 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1611
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1612 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1613
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1614 class handle_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1615 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1616 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1617 handle_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1618 const graphics_handle& val = graphics_handle ())
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1619 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1620 current_val (val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1621
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1622 handle_property (const handle_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1623 : base_property (p), current_val (p.current_val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1624
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1625 octave_value get (void) const { return current_val.as_octave_value (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1626
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1627 graphics_handle handle_value (void) const { return current_val; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1628
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1629 handle_property& operator = (const octave_value& val)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1630 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1631 set (val);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1632 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1633 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1634
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1635 handle_property& operator = (const graphics_handle& h)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1636 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1637 set (octave_value (h.value ()));
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1638 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1639 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1640
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1641 base_property* clone (void) const { return new handle_property (*this); }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1642
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1643 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1644 OCTINTERP_API bool do_set (const octave_value& v);
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1645
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1646 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1647 graphics_handle current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1648 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1649
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1650 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1651
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1652 class any_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1653 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1654 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1655 any_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1656 const octave_value& m = Matrix ())
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1657 : base_property (nm, h), data (m) { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1658
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1659 any_property (const any_property& p)
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1660 : base_property (p), data (p.data) { }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1661
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1662 octave_value get (void) const { return data; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1663
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1664 any_property& operator = (const octave_value& val)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1665 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1666 set (val);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1667 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1668 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1669
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1670 base_property* clone (void) const { return new any_property (*this); }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1671
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1672 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1673 bool do_set (const octave_value& v)
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1674 {
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1675 data = v;
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1676 return true;
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1677 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1678
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1679 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1680 octave_value data;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1681 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1682
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1683 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1684
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1685 class children_property : public base_property
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1686 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1687 public:
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1688 children_property (void)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1689 : base_property ("", graphics_handle ()), children_list ()
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1690 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1691 do_init_children (Matrix ());
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1692 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1693
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1694 children_property (const std::string& nm, const graphics_handle& h,
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1695 const Matrix &val)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1696 : base_property (nm, h), children_list ()
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1697 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1698 do_init_children (val);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1699 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1700
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1701 children_property (const children_property& p)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1702 : base_property (p), children_list ()
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1703 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1704 do_init_children (p.children_list);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1705 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1706
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1707 children_property& operator = (const octave_value& val)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1708 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1709 set (val);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1710 return *this;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1711 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1712
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1713 base_property* clone (void) const { return new children_property (*this); }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1714
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1715 bool remove_child (const double &val)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1716 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1717 return do_remove_child (val);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1718 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1719
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1720 void adopt (const double &val)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1721 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1722 do_adopt_child (val);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1723 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1724
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1725 Matrix get_children (void) const
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1726 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1727 return do_get_children (false);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1728 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1729
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1730 Matrix get_hidden (void) const
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1731 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1732 return do_get_children (true);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1733 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1734
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1735 Matrix get_all (void) const
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1736 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1737 return do_get_all_children ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1738 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1739
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1740 octave_value get (void) const
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1741 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1742 return octave_value (get_children ());
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1743 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1744
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1745 void delete_children (bool clear = false)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1746 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1747 do_delete_children (clear);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1748 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1749
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1750 void renumber (graphics_handle old_gh, graphics_handle new_gh)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1751 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1752 for (children_list_iterator p = children_list.begin ();
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1753 p != children_list.end (); p++)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1754 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1755 if (*p == old_gh)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1756 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1757 *p = new_gh.value ();
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1758 return;
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1759 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1760 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1761
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1762 error ("children_list::renumber: child not found!");
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1763 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1764
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1765 private:
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1766 typedef std::list<double>::iterator children_list_iterator;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1767 typedef std::list<double>::const_iterator const_children_list_iterator;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1768 std::list<double> children_list;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1769
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1770 protected:
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1771 bool do_set (const octave_value& val)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1772 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1773 const Matrix new_kids = val.matrix_value ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1774
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1775 octave_idx_type nel = new_kids.numel ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1776
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1777 const Matrix new_kids_column = new_kids.reshape (dim_vector (nel, 1));
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1778
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1779 bool is_ok = true;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1780
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1781 if (! error_state)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1782 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1783 const Matrix visible_kids = do_get_children (false);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1784
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1785 if (visible_kids.numel () == new_kids.numel ())
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1786 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1787 Matrix t1 = visible_kids.sort ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1788 Matrix t2 = new_kids_column.sort ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1789
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1790 if (t1 != t2)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1791 is_ok = false;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1792 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1793 else
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1794 is_ok = false;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1795
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1796 if (! is_ok)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1797 error ("set: new children must be a permutation of existing children");
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1798 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1799 else
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1800 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1801 is_ok = false;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1802 error ("set: expecting children to be array of graphics handles");
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1803 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1804
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1805 if (is_ok)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1806 {
11322
71cce7108190 graphics.h.in (base_property::do_set): don't reverse order of children
John W. Eaton <jwe@octave.org>
parents: 11281
diff changeset
1807 Matrix tmp = new_kids_column.stack (get_hidden ());
71cce7108190 graphics.h.in (base_property::do_set): don't reverse order of children
John W. Eaton <jwe@octave.org>
parents: 11281
diff changeset
1808
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1809 children_list.clear ();
11322
71cce7108190 graphics.h.in (base_property::do_set): don't reverse order of children
John W. Eaton <jwe@octave.org>
parents: 11281
diff changeset
1810
71cce7108190 graphics.h.in (base_property::do_set): don't reverse order of children
John W. Eaton <jwe@octave.org>
parents: 11281
diff changeset
1811 // Don't use do_init_children here, as that reverses the
71cce7108190 graphics.h.in (base_property::do_set): don't reverse order of children
John W. Eaton <jwe@octave.org>
parents: 11281
diff changeset
1812 // order of the list, and we don't want to do that if setting
71cce7108190 graphics.h.in (base_property::do_set): don't reverse order of children
John W. Eaton <jwe@octave.org>
parents: 11281
diff changeset
1813 // the child list directly.
71cce7108190 graphics.h.in (base_property::do_set): don't reverse order of children
John W. Eaton <jwe@octave.org>
parents: 11281
diff changeset
1814
71cce7108190 graphics.h.in (base_property::do_set): don't reverse order of children
John W. Eaton <jwe@octave.org>
parents: 11281
diff changeset
1815 for (octave_idx_type i = 0; i < tmp.numel (); i++)
71cce7108190 graphics.h.in (base_property::do_set): don't reverse order of children
John W. Eaton <jwe@octave.org>
parents: 11281
diff changeset
1816 children_list.push_back (tmp.xelem (i));
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1817 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1818
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1819 return is_ok;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1820 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1821
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1822 private:
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1823 void do_init_children (const Matrix &val)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1824 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1825 children_list.clear ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1826 for (octave_idx_type i = 0; i < val.numel (); i++)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1827 children_list.push_front (val.xelem (i));
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1828 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1829
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1830 void do_init_children (const std::list<double> &val)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1831 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1832 children_list.clear ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1833 for (const_children_list_iterator p = val.begin (); p != val.end (); p++)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1834 children_list.push_front (*p);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1835 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1836
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1837 Matrix do_get_children (bool return_hidden) const;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1838
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1839 Matrix do_get_all_children (void) const
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1840 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1841 Matrix retval (children_list.size (), 1);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1842 octave_idx_type i = 0;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1843
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1844 for (const_children_list_iterator p = children_list.begin ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1845 p != children_list.end (); p++)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1846 retval(i++) = *p;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1847 return retval;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1848 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1849
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1850 bool do_remove_child (double child)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1851 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1852 for (children_list_iterator p = children_list.begin ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1853 p != children_list.end (); p++)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1854 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1855 if (*p == child)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1856 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1857 children_list.erase (p);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1858 return true;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1859 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1860 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1861 return false;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1862 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1863
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1864 void do_adopt_child (const double &val)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1865 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1866 children_list.push_front (val);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1867 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1868
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1869 void do_delete_children (bool clear);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1870 };
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1871
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1872
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1873
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1874 // ---------------------------------------------------------------------
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1875
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1876 class callback_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1877 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1878 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1879 callback_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1880 const octave_value& m)
13323
de081abd32c6 don't execute graphics handle callback functions recursively
John W. Eaton <jwe@octave.org>
parents: 13321
diff changeset
1881 : base_property (nm, h), callback (m), executing (false) { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1882
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1883 callback_property (const callback_property& p)
13323
de081abd32c6 don't execute graphics handle callback functions recursively
John W. Eaton <jwe@octave.org>
parents: 13321
diff changeset
1884 : base_property (p), callback (p.callback), executing (false) { }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1885
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1886 octave_value get (void) const { return callback; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1887
7367
600808df131c [project @ 2008-01-14 08:58:02 by jwe]
jwe
parents: 7366
diff changeset
1888 OCTINTERP_API void execute (const octave_value& data = octave_value ()) const;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1889
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10505
diff changeset
1890 bool is_defined (void) const
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1891 {
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10505
diff changeset
1892 return (callback.is_defined () && ! callback.is_empty ());
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10505
diff changeset
1893 }
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10505
diff changeset
1894
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1895 callback_property& operator = (const octave_value& val)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1896 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1897 set (val);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1898 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1899 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1900
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1901 base_property* clone (void) const { return new callback_property (*this); }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1902
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1903 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1904 bool do_set (const octave_value& v)
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1905 {
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1906 if (validate (v))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1907 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1908 callback = v;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1909 return true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1910 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1911 else
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1912 error ("invalid value for callback property \"%s\"",
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1913 get_name ().c_str ());
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1914 return false;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1915 }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1916
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1917 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1918 OCTINTERP_API bool validate (const octave_value& v) const;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1919
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1920 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1921 octave_value callback;
13323
de081abd32c6 don't execute graphics handle callback functions recursively
John W. Eaton <jwe@octave.org>
parents: 13321
diff changeset
1922
de081abd32c6 don't execute graphics handle callback functions recursively
John W. Eaton <jwe@octave.org>
parents: 13321
diff changeset
1923 // If TRUE, we are executing this callback.
de081abd32c6 don't execute graphics handle callback functions recursively
John W. Eaton <jwe@octave.org>
parents: 13321
diff changeset
1924 mutable bool executing;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1925 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1926
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1927 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1928
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1929 class property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1930 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1931 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1932 property (void) : rep (new base_property ("", graphics_handle ()))
7850
56254a8d4d59 Smarter reference counting in base_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7849
diff changeset
1933 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1934
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1935 property (base_property *bp, bool persist = false) : rep (bp)
7850
56254a8d4d59 Smarter reference counting in base_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7849
diff changeset
1936 { if (persist) rep->count++; }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1937
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1938 property (const property& p) : rep (p.rep)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1939 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1940 rep->count++;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1941 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1942
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1943 ~property (void)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1944 {
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13938
diff changeset
1945 if (--rep->count == 0)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1946 delete rep;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1947 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1948
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1949 bool ok (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1950 { return rep->ok (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1951
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1952 std::string get_name (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1953 { return rep->get_name (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1954
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1955 void set_name (const std::string& name)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1956 { rep->set_name (name); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1957
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1958 graphics_handle get_parent (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1959 { return rep->get_parent (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1960
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1961 void set_parent (const graphics_handle& h)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1962 { rep->set_parent (h); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1963
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1964 bool is_hidden (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1965 { return rep->is_hidden (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1966
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1967 void set_hidden (bool flag)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1968 { rep->set_hidden (flag); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1969
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1970 bool is_radio (void) const
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1971 { return rep->is_radio (); }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1972
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1973 int get_id (void) const
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1974 { return rep->get_id (); }
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1975
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1976 void set_id (int d)
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1977 { rep->set_id (d); }
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1978
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1979 octave_value get (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1980 { return rep->get (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1981
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
1982 bool set (const octave_value& val, bool do_run = true,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
1983 bool do_notify_toolkit = true)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
1984 { return rep->set (val, do_run, do_notify_toolkit); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1985
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1986 std::string values_as_string (void) const
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1987 { return rep->values_as_string (); }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1988
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1989 Cell values_as_cell (void) const
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1990 { return rep->values_as_cell (); }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1991
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1992 property& operator = (const octave_value& val)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1993 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1994 *rep = val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1995 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1996 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1997
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1998 property& operator = (const property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1999 {
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13938
diff changeset
2000 if (rep && --rep->count == 0)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2001 delete rep;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2002
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2003 rep = p.rep;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2004 rep->count++;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2005
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2006 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2007 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2008
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2009 void add_listener (const octave_value& v, listener_mode mode = POSTSET)
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2010 { rep->add_listener (v, mode); }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2011
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2012 void delete_listener (const octave_value& v = octave_value (),
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2013 listener_mode mode = POSTSET)
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2014 { rep->delete_listener (v, mode); }
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2015
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2016 void run_listeners (listener_mode mode = POSTSET)
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2017 { rep->run_listeners (mode); }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2018
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2019 OCTINTERP_API static
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2020 property create (const std::string& name, const graphics_handle& parent,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2021 const caseless_str& type,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2022 const octave_value_list& args);
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2023
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2024 property clone (void) const
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2025 { return property (rep->clone ()); }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2026
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2027 /*
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2028 const string_property& as_string_property (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2029 { return *(dynamic_cast<string_property*> (rep)); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2030
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2031 const radio_property& as_radio_property (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2032 { return *(dynamic_cast<radio_property*> (rep)); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2033
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2034 const color_property& as_color_property (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2035 { return *(dynamic_cast<color_property*> (rep)); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2036
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2037 const double_property& as_double_property (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2038 { return *(dynamic_cast<double_property*> (rep)); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2039
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2040 const bool_property& as_bool_property (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2041 { return *(dynamic_cast<bool_property*> (rep)); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2042
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2043 const handle_property& as_handle_property (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2044 { return *(dynamic_cast<handle_property*> (rep)); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2045 */
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2046
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2047 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2048 base_property *rep;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2049 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2050
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2051 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2052
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2053 class property_list
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2054 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2055 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2056 typedef std::map<std::string, octave_value> pval_map_type;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2057 typedef std::map<std::string, pval_map_type> plist_map_type;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2058
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2059 typedef pval_map_type::iterator pval_map_iterator;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2060 typedef pval_map_type::const_iterator pval_map_const_iterator;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2061
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2062 typedef plist_map_type::iterator plist_map_iterator;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2063 typedef plist_map_type::const_iterator plist_map_const_iterator;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2064
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2065 property_list (const plist_map_type& m = plist_map_type ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2066 : plist_map (m) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2067
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2068 ~property_list (void) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2069
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2070 void set (const caseless_str& name, const octave_value& val);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2071
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2072 octave_value lookup (const caseless_str& name) const;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2073
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2074 plist_map_iterator begin (void) { return plist_map.begin (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2075 plist_map_const_iterator begin (void) const { return plist_map.begin (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2076
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2077 plist_map_iterator end (void) { return plist_map.end (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2078 plist_map_const_iterator end (void) const { return plist_map.end (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2079
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2080 plist_map_iterator find (const std::string& go_name)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2081 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2082 return plist_map.find (go_name);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2083 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2084
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2085 plist_map_const_iterator find (const std::string& go_name) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2086 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2087 return plist_map.find (go_name);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2088 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2089
11074
8a3b7e8fcbbc graphics.cc, graphics.h.in, genprops.awk: use octave_map and octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents: 10998
diff changeset
2090 octave_scalar_map as_struct (const std::string& prefix_arg) const;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2091
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2092 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2093 plist_map_type plist_map;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2094 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2095
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2096 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2097
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2098 class graphics_toolkit;
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2099 class graphics_object;
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2100
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2101 class base_graphics_toolkit
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2102 {
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2103 public:
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2104 friend class graphics_toolkit;
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2105
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2106 public:
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2107 base_graphics_toolkit (const std::string& nm)
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2108 : name (nm), count (0) { }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2109
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2110 virtual ~base_graphics_toolkit (void) { }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2111
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2112 std::string get_name (void) const { return name; }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2113
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2114 virtual bool is_valid (void) const { return false; }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2115
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2116 virtual void redraw_figure (const graphics_object&) const
7826
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2117 { gripe_invalid ("redraw_figure"); }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2118
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2119 virtual void print_figure (const graphics_object&, const std::string&,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2120 const std::string&, bool,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2121 const std::string& = "") const
7826
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2122 { gripe_invalid ("print_figure"); }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2123
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2124 virtual Matrix get_canvas_size (const graphics_handle&) const
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2125 {
7826
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2126 gripe_invalid ("get_canvas_size");
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2127 return Matrix (1, 2, 0.0);
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2128 }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2129
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
2130 virtual double get_screen_resolution (void) const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
2131 {
7826
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2132 gripe_invalid ("get_screen_resolution");
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2133 return 72.0;
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
2134 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2135
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
2136 virtual Matrix get_screen_size (void) const
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
2137 {
7826
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2138 gripe_invalid ("get_screen_size");
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
2139 return Matrix (1, 2, 0.0);
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
2140 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
2141
10974
c6dc5f666695 update comments for base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10973
diff changeset
2142 // Callback function executed when the given graphics object
11577
b124b83e5626 fix typo
John W. Eaton <jwe@octave.org>
parents: 11576
diff changeset
2143 // changes. This allows the graphics toolkit to act on property
10974
c6dc5f666695 update comments for base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10973
diff changeset
2144 // changes if needed.
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2145 virtual void update (const graphics_object&, int)
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2146 { gripe_invalid ("base_graphics_toolkit::update"); }
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2147
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2148 void update (const graphics_handle&, int);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2149
10974
c6dc5f666695 update comments for base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10973
diff changeset
2150 // Callback function executed when the given graphics object is
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2151 // created. This allows the graphics toolkit to do toolkit-specific
10974
c6dc5f666695 update comments for base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10973
diff changeset
2152 // initializations for a newly created object.
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2153 virtual bool initialize (const graphics_object&)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2154 { gripe_invalid ("base_graphics_toolkit::initialize"); return false; }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2155
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2156 bool initialize (const graphics_handle&);
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2157
10974
c6dc5f666695 update comments for base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10973
diff changeset
2158 // Callback function executed just prior to deleting the given
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2159 // graphics object. This allows the graphics toolkit to perform
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2160 // toolkit-specific cleanup operations before an object is deleted.
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2161 virtual void finalize (const graphics_object&)
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2162 { gripe_invalid ("base_graphics_toolkit::finalize"); }
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2163
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2164 void finalize (const graphics_handle&);
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2165
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
2166 // Close the graphics toolkit.
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
2167 virtual void close (void)
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
2168 { gripe_invalid ("base_graphics_toolkit::close"); }
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
2169
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2170 private:
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2171 std::string name;
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13938
diff changeset
2172 octave_refcount<int> count;
7826
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2173
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2174 private:
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2175 void gripe_invalid (const std::string& fname) const
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2176 {
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2177 if (! is_valid ())
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2178 error ("%s: invalid graphics toolkit", fname.c_str ());
7826
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2179 }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2180 };
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2181
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2182 class graphics_toolkit
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2183 {
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2184 public:
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2185 graphics_toolkit (void)
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2186 : rep (new base_graphics_toolkit ("unknown"))
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2187 {
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2188 rep->count++;
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2189 }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2190
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2191 graphics_toolkit (base_graphics_toolkit* b)
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2192 : rep (b)
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2193 {
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2194 rep->count++;
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2195 }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2196
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2197 graphics_toolkit (const graphics_toolkit& b)
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2198 : rep (b.rep)
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2199 {
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2200 rep->count++;
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2201 }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2202
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2203 ~graphics_toolkit (void)
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2204 {
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2205 if (--rep->count == 0)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2206 delete rep;
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2207 }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2208
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2209 graphics_toolkit& operator = (const graphics_toolkit& b)
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2210 {
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2211 if (rep != b.rep)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2212 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2213 if (--rep->count == 0)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2214 delete rep;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2215
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2216 rep = b.rep;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2217 rep->count++;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2218 }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2219
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2220 return *this;
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2221 }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2222
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2223 operator bool (void) const { return rep->is_valid (); }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2224
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2225 std::string get_name (void) const { return rep->get_name (); }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2226
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2227 void redraw_figure (const graphics_object& go) const
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2228 { rep->redraw_figure (go); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2229
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2230 void print_figure (const graphics_object& go, const std::string& term,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2231 const std::string& file, bool mono,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2232 const std::string& debug_file = "") const
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2233 { rep->print_figure (go, term, file, mono, debug_file); }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2234
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2235 Matrix get_canvas_size (const graphics_handle& fh) const
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2236 { return rep->get_canvas_size (fh); }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2237
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
2238 double get_screen_resolution (void) const
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
2239 { return rep->get_screen_resolution (); }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
2240
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
2241 Matrix get_screen_size (void) const
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
2242 { return rep->get_screen_size (); }
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
2243
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2244 // Notifies graphics toolkit that object't property has changed.
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2245 void update (const graphics_object& go, int id)
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2246 { rep->update (go, id); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2247
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2248 void update (const graphics_handle& h, int id)
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2249 { rep->update (h, id); }
8058
ca39c21fa4b8 [mq]: generic_octave_to_backend_nofitication
John W. Eaton <jwe@octave.org>
parents: 8052
diff changeset
2250
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2251 // Notifies graphics toolkit that new object was created.
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2252 bool initialize (const graphics_object& go)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2253 { return rep->initialize (go); }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2254
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2255 bool initialize (const graphics_handle& h)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2256 { return rep->initialize (h); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2257
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2258 // Notifies graphics toolkit that object was destroyed.
8058
ca39c21fa4b8 [mq]: generic_octave_to_backend_nofitication
John W. Eaton <jwe@octave.org>
parents: 8052
diff changeset
2259 // This is called only for explicitly deleted object. Children are
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2260 // deleted implicitly and graphics toolkit isn't notified.
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2261 void finalize (const graphics_object& go)
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2262 { rep->finalize (go); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2263
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2264 void finalize (const graphics_handle& h)
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2265 { rep->finalize (h); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2266
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
2267 // Close the graphics toolkit.
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
2268 void close (void) { rep->close (); }
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
2269
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2270 private:
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2271
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2272 base_graphics_toolkit *rep;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2273 };
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2274
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2275 class gtk_manager
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2276 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2277 public:
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2278
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2279 static graphics_toolkit get_toolkit (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2280 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2281 return instance_ok () ? instance->do_get_toolkit () : graphics_toolkit ();
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2282 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2283
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2284 static void register_toolkit (const std::string& name)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2285 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2286 if (instance_ok ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2287 instance->do_register_toolkit (name);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2288 }
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2289
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2290 static void unregister_toolkit (const std::string& name)
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2291 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2292 if (instance_ok ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2293 instance->do_unregister_toolkit (name);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2294 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2295
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2296 static void load_toolkit (const graphics_toolkit& tk)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2297 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2298 if (instance_ok ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2299 instance->do_load_toolkit (tk);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2300 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2301
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2302 static void unload_toolkit (const std::string& name)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2303 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2304 if (instance_ok ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2305 instance->do_unload_toolkit (name);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2306 }
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2307
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2308 static graphics_toolkit find_toolkit (const std::string& name)
7439
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
2309 {
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2310 return instance_ok ()
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2311 ? instance->do_find_toolkit (name) : graphics_toolkit ();
7439
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
2312 }
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
2313
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2314 static Cell available_toolkits_list (void)
7835
ca8b97bb952c added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2315 {
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2316 return instance_ok () ? instance->do_available_toolkits_list () : Cell ();
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2317 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2318
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2319 static Cell loaded_toolkits_list (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2320 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2321 return instance_ok () ? instance->do_loaded_toolkits_list () : Cell ();
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2322 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2323
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2324 static void unload_all_toolkits (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2325 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2326 if (instance_ok ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2327 instance->do_unload_all_toolkits ();
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2328 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2329
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2330 static std::string default_toolkit (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2331 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2332 return instance_ok () ? instance->do_default_toolkit () : std::string ();
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2333 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2334
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2335 private:
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2336
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2337 // FIXME -- default toolkit should be configurable.
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2338
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2339 gtk_manager (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2340 : dtk ("gnuplot"), available_toolkits (), loaded_toolkits () { }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2341
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2342 ~gtk_manager (void) { }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2343
14281
b4d7de953066 Export more required symbols [Win32].
Michael Goffioul <michael.goffioul@gmail.com>
parents: 14257
diff changeset
2344 OCTINTERP_API static void create_instance (void);
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2345
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2346 static bool instance_ok (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2347 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2348 bool retval = true;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2349
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2350 if (! instance)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2351 create_instance ();
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2352
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2353 if (! instance)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2354 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2355 ::error ("unable to create gh_manager!");
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2356
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2357 retval = false;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2358 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2359
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2360 return retval;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2361 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2362
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2363 static void cleanup_instance (void) { delete instance; instance = 0; }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2364
14281
b4d7de953066 Export more required symbols [Win32].
Michael Goffioul <michael.goffioul@gmail.com>
parents: 14257
diff changeset
2365 OCTINTERP_API static gtk_manager *instance;
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2366
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2367 // The name of the default toolkit.
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2368 std::string dtk;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2369
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2370 // The list of toolkits that we know about.
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2371 std::set<std::string> available_toolkits;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2372
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2373 // The list of toolkits we have actually loaded.
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2374 std::map<std::string, graphics_toolkit> loaded_toolkits;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2375
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2376 typedef std::set<std::string>::iterator available_toolkits_iterator;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2377
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2378 typedef std::set<std::string>::const_iterator
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2379 const_available_toolkits_iterator;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2380
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2381 typedef std::map<std::string, graphics_toolkit>::iterator
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2382 loaded_toolkits_iterator;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2383
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2384 typedef std::map<std::string, graphics_toolkit>::const_iterator
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2385 const_loaded_toolkits_iterator;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2386
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2387 graphics_toolkit do_get_toolkit (void) const;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2388
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2389 void do_register_toolkit (const std::string& name)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2390 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2391 available_toolkits.insert (name);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2392 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2393
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2394 void do_unregister_toolkit (const std::string& name)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2395 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2396 available_toolkits.erase (name);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2397 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2398
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2399 void do_load_toolkit (const graphics_toolkit& tk)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2400 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2401 loaded_toolkits[tk.get_name ()] = tk;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2402 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2403
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2404 void do_unload_toolkit (const std::string& name)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2405 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2406 loaded_toolkits.erase (name);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2407 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2408
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2409 graphics_toolkit do_find_toolkit (const std::string& name) const
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2410 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2411 const_loaded_toolkits_iterator p = loaded_toolkits.find (name);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2412
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2413 if (p != loaded_toolkits.end ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2414 return p->second;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2415 else
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2416 return graphics_toolkit ();
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2417 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2418
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2419 Cell do_available_toolkits_list (void) const
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2420 {
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2421 Cell m (1 , available_toolkits.size ());
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2422
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2423 octave_idx_type i = 0;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2424 for (const_available_toolkits_iterator p = available_toolkits.begin ();
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2425 p != available_toolkits.end (); p++)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2426 m(i++) = *p;
7835
ca8b97bb952c added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2427
ca8b97bb952c added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2428 return m;
ca8b97bb952c added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2429 }
ca8b97bb952c added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2430
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2431 Cell do_loaded_toolkits_list (void) const
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2432 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2433 Cell m (1 , loaded_toolkits.size ());
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2434
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2435 octave_idx_type i = 0;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2436 for (const_loaded_toolkits_iterator p = loaded_toolkits.begin ();
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2437 p != loaded_toolkits.end (); p++)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2438 m(i++) = p->first;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2439
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2440 return m;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2441 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2442
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2443 void do_unload_all_toolkits (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2444 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2445 while (! loaded_toolkits.empty ())
14016
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2446 {
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2447 loaded_toolkits_iterator p = loaded_toolkits.begin ();
14016
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2448
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2449 std::string name = p->first;
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2450
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2451 p->second.close ();
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2452
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2453 // The toolkit may have unloaded itself. If not, we'll do
14016
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2454 // it here.
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2455 if (loaded_toolkits.find (name) != loaded_toolkits.end ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2456 unload_toolkit (name);
14016
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2457 }
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2458 }
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2459
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2460 std::string do_default_toolkit (void) { return dtk; }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2461 };
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2462
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2463 // ---------------------------------------------------------------------
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2464
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2465 class base_graphics_object;
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2466 class graphics_object;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2467
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
2468 class OCTINTERP_API base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2469 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2470 public:
7176
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
2471 base_properties (const std::string& ty = "unknown",
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2472 const graphics_handle& mh = graphics_handle (),
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2473 const graphics_handle& p = graphics_handle ());
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2474
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2475 virtual ~base_properties (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2476
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2477 virtual std::string graphics_object_name (void) const { return "unknonwn"; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2478
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2479 void mark_modified (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2480
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2481 void override_defaults (base_graphics_object& obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2482
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2483 virtual void init_integerhandle (const octave_value&)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2484 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2485 panic_impossible ();
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2486 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2487
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2488 // Look through DEFAULTS for properties with given CLASS_NAME, and
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2489 // apply them to the current object with set (virtual method).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2490
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2491 void set_from_list (base_graphics_object& obj, property_list& defaults);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2492
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2493 void insert_property (const std::string& name, property p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2494 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2495 p.set_name (name);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2496 p.set_parent (__myhandle__);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2497 all_props[name] = p;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2498 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2499
9972
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2500 virtual void set (const caseless_str&, const octave_value&);
9185
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2501
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2502 virtual octave_value get (const caseless_str& pname) const;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2503
9616
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2504 virtual octave_value get (const std::string& pname) const
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2505 {
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2506 return get (caseless_str (pname));
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2507 }
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2508
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2509 virtual octave_value get (const char *pname) const
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2510 {
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2511 return get (caseless_str (pname));
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2512 }
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2513
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
2514 virtual octave_value get (bool all = false) const;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2515
9185
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2516 virtual property get_property (const caseless_str& pname);
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2517
9585
06b8b51dca48 also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents: 9582
diff changeset
2518 virtual bool has_property (const caseless_str&) const
06b8b51dca48 also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents: 9582
diff changeset
2519 {
06b8b51dca48 also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents: 9582
diff changeset
2520 panic_impossible ();
06b8b51dca48 also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents: 9582
diff changeset
2521 return false;
06b8b51dca48 also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents: 9582
diff changeset
2522 }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2523
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2524 bool is_modified (void) const { return is___modified__ (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2525
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2526 virtual void remove_child (const graphics_handle& h)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2527 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2528 if (children.remove_child (h.value ()))
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2529 mark_modified ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2530 }
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2531
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2532 virtual void adopt (const graphics_handle& h)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2533 {
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2534 children.adopt (h.value ());
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
2535 mark_modified ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2536 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2537
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2538 virtual graphics_toolkit get_toolkit (void) const;
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2539
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2540 virtual Matrix get_boundingbox (bool /*internal*/ = false,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2541 const Matrix& /*parent_pix_size*/ = Matrix ()) const
7447
25018e35b4cb [project @ 2008-02-05 22:38:57 by jwe]
jwe
parents: 7446
diff changeset
2542 { return Matrix (1, 4, 0.0); }
25018e35b4cb [project @ 2008-02-05 22:38:57 by jwe]
jwe
parents: 7446
diff changeset
2543
7828
4739b6a1925c Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7827
diff changeset
2544 virtual void update_boundingbox (void);
4739b6a1925c Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7827
diff changeset
2545
12389
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
2546 virtual void update_autopos (const std::string& elem_type);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
2547
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2548 virtual void add_listener (const caseless_str&, const octave_value&,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2549 listener_mode = POSTSET);
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2550
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2551 virtual void delete_listener (const caseless_str&, const octave_value&,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2552 listener_mode = POSTSET);
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2553
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2554 void set_tag (const octave_value& val) { tag = val; }
7176
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
2555
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2556 void set_parent (const octave_value& val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2557
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2558 Matrix get_children (void) const
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2559 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2560 return children.get_children ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2561 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2562
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2563 Matrix get_all_children (void) const
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2564 {
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2565 return children.get_all ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2566 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2567
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2568 Matrix get_hidden_children (void) const
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2569 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2570 return children.get_hidden ();
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2571 }
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2572
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2573 void set_modified (const octave_value& val) { set___modified__ (val); }
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2574
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2575 void set___modified__ (const octave_value& val) { __modified__ = val; }
7366
2a2115742cb5 [project @ 2008-01-13 06:46:39 by jwe]
jwe
parents: 7365
diff changeset
2576
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2577 void reparent (const graphics_handle& new_parent) { parent = new_parent; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2578
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2579 // Update data limits for AXIS_TYPE (xdata, ydata, etc.) in the parent
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2580 // axes object.
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2581
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2582 virtual void update_axis_limits (const std::string& axis_type) const;
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2583
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2584 virtual void update_axis_limits (const std::string& axis_type,
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2585 const graphics_handle& h) const;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2586
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2587 virtual void delete_children (bool clear = false)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2588 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2589 children.delete_children (clear);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2590 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2591
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2592 void renumber_child (graphics_handle old_gh, graphics_handle new_gh)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2593 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2594 children.renumber (old_gh, new_gh);
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2595 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2596
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2597 void renumber_parent (graphics_handle new_gh)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2598 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2599 parent = new_gh;
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2600 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2601
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2602 static property_list::pval_map_type factory_defaults (void);
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2603
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2604 // FIXME -- these functions should be generated automatically by the
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2605 // genprops.awk script.
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2606 //
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2607 // EMIT_BASE_PROPERTIES_GET_FUNCTIONS
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2608
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2609 virtual octave_value get_xlim (void) const { return octave_value (); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2610 virtual octave_value get_ylim (void) const { return octave_value (); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2611 virtual octave_value get_zlim (void) const { return octave_value (); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2612 virtual octave_value get_clim (void) const { return octave_value (); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2613 virtual octave_value get_alim (void) const { return octave_value (); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2614
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2615 virtual bool is_xliminclude (void) const { return false; }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2616 virtual bool is_yliminclude (void) const { return false; }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2617 virtual bool is_zliminclude (void) const { return false; }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2618 virtual bool is_climinclude (void) const { return false; }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2619 virtual bool is_aliminclude (void) const { return false; }
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
2620
13324
1e12601d2697 make handles with their handlevisibility property set to "callback" visible in callback functions
John W. Eaton <jwe@octave.org>
parents: 13323
diff changeset
2621 bool is_handle_visible (void) const;
9185
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2622
9972
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2623 std::set<std::string> dynamic_property_names (void) const;
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2624
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2625 bool has_dynamic_property (const std::string& pname);
9185
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2626
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2627 protected:
9972
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2628 std::set<std::string> dynamic_properties;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2629
9972
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2630 void set_dynamic (const caseless_str& pname, const octave_value& val);
9185
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2631
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2632 octave_value get_dynamic (const caseless_str& pname) const;
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2633
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2634 octave_value get_dynamic (bool all = false) const;
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2635
9185
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2636 property get_property_dynamic (const caseless_str& pname);
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2637
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2638 BEGIN_BASE_PROPERTIES
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2639 // properties common to all objects
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2640 bool_property beingdeleted , "off"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2641 radio_property busyaction , "{queue}|cancel"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2642 callback_property buttondownfcn , Matrix ()
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2643 children_property children gf , Matrix ()
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2644 bool_property clipping , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2645 callback_property createfcn , Matrix ()
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2646 callback_property deletefcn , Matrix ()
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2647 radio_property handlevisibility , "{on}|callback|off"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2648 bool_property hittest , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2649 bool_property interruptible , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2650 handle_property parent fs , p
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2651 bool_property selected , "off"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2652 bool_property selectionhighlight , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2653 string_property tag s , ""
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2654 string_property type frs , ty
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2655 any_property userdata , Matrix ()
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2656 bool_property visible , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2657 // additional (octave-specific) properties
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2658 bool_property __modified__ s , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2659 graphics_handle __myhandle__ fhrs , mh
8333
9238637cb81c style fixes
John W. Eaton <jwe@octave.org>
parents: 8300
diff changeset
2660 // FIXME -- should this really be here?
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2661 handle_property uicontextmenu , graphics_handle ()
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2662 END_PROPERTIES
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2663
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2664 protected:
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2665 struct cmp_caseless_str
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2666 {
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2667 bool operator () (const caseless_str &a, const caseless_str &b) const
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2668 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2669 std::string a1 = a;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2670 std::transform (a1.begin (), a1.end (), a1.begin (), tolower);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2671 std::string b1 = b;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2672 std::transform (b1.begin (), b1.end (), b1.begin (), tolower);
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2673
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2674 return a1 < b1;
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2675 }
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2676 };
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2677
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2678 std::map<caseless_str, property, cmp_caseless_str> all_props;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2679
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2680 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2681 void insert_static_property (const std::string& name, base_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2682 { insert_property (name, property (&p, true)); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2683
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2684 virtual void init (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2685 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2686
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
2687 class OCTINTERP_API base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2688 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2689 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2690 friend class graphics_object;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2691
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2692 base_graphics_object (void) : count (1), toolkit_flag (false) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2693
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2694 virtual ~base_graphics_object (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2695
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2696 virtual void mark_modified (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2697 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2698 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2699 get_properties ().mark_modified ();
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2700 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2701 error ("base_graphics_object::mark_modified: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2702 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2703
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2704 virtual void override_defaults (base_graphics_object& obj)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2705 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2706 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2707 get_properties ().override_defaults (obj);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2708 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2709 error ("base_graphics_object::override_defaults: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2710 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2711
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2712 virtual void set_from_list (property_list& plist)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2713 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2714 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2715 get_properties ().set_from_list (*this, plist);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2716 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2717 error ("base_graphics_object::set_from_list: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2718 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2719
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2720 virtual void set (const caseless_str& pname, const octave_value& pval)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2721 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2722 if (valid_object ())
9188
9646be3a59c4 make changeset 1e5c11890f85 work
John W. Eaton <jwe@octave.org>
parents: 9185
diff changeset
2723 get_properties ().set (pname, pval);
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2724 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2725 error ("base_graphics_object::set: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2726 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2727
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2728 virtual void set_defaults (const std::string&)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2729 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2730 error ("base_graphics_object::set_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2731 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2732
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
2733 virtual octave_value get (bool all = false) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2734 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2735 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2736 return get_properties ().get (all);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2737 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2738 {
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2739 error ("base_graphics_object::get: invalid graphics object");
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2740 return octave_value ();
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2741 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2742 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2743
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2744 virtual octave_value get (const caseless_str& pname) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2745 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2746 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2747 return get_properties ().get (pname);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2748 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2749 {
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2750 error ("base_graphics_object::get: invalid graphics object");
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2751 return octave_value ();
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2752 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2753 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2754
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2755 virtual octave_value get_default (const caseless_str&) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2756
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2757 virtual octave_value get_factory_default (const caseless_str&) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2758
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2759 virtual octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2760 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2761 error ("base_graphics_object::get_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2762 return octave_value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2763 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2764
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2765 virtual octave_value get_factory_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2766 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2767 error ("base_graphics_object::get_factory_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2768 return octave_value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2769 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2770
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2771 virtual std::string values_as_string (void);
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2772
11074
8a3b7e8fcbbc graphics.cc, graphics.h.in, genprops.awk: use octave_map and octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents: 10998
diff changeset
2773 virtual octave_scalar_map values_as_struct (void);
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2774
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2775 virtual graphics_handle get_parent (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2776 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2777 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2778 return get_properties ().get_parent ();
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2779 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2780 {
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2781 error ("base_graphics_object::get_parent: invalid graphics object");
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2782 return graphics_handle ();
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2783 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2784 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2785
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2786 graphics_handle get_handle (void) const
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2787 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2788 if (valid_object ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2789 return get_properties ().get___myhandle__ ();
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2790 else
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2791 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2792 error ("base_graphics_object::get_handle: invalid graphics object");
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2793 return graphics_handle ();
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2794 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2795 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2796
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2797 virtual void remove_child (const graphics_handle& h)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2798 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2799 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2800 get_properties ().remove_child (h);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2801 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2802 error ("base_graphics_object::remove_child: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2803 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2804
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2805 virtual void adopt (const graphics_handle& h)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2806 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2807 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2808 get_properties ().adopt (h);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2809 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2810 error ("base_graphics_object::adopt: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2811 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2812
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2813 virtual void reparent (const graphics_handle& np)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2814 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2815 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2816 get_properties ().reparent (np);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2817 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2818 error ("base_graphics_object::reparent: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2819 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2820
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2821 virtual void defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2822 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2823 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2824 {
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2825 std::string msg = (type () + "::defaults");
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2826 gripe_not_implemented (msg.c_str ());
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2827 }
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2828 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2829 error ("base_graphics_object::default: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2830 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2831
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2832 virtual base_properties& get_properties (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2833 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2834 static base_properties properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2835 error ("base_graphics_object::get_properties: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2836 return properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2837 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2838
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2839 virtual const base_properties& get_properties (void) const
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2840 {
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2841 static base_properties properties;
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2842 error ("base_graphics_object::get_properties: invalid graphics object");
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2843 return properties;
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2844 }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2845
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2846 virtual void update_axis_limits (const std::string& axis_type);
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2847
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2848 virtual void update_axis_limits (const std::string& axis_type,
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2849 const graphics_handle& h);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2850
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2851 virtual bool valid_object (void) const { return false; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2852
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2853 bool valid_toolkit_object (void) const { return toolkit_flag; }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2854
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2855 virtual std::string type (void) const
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2856 {
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2857 return (valid_object () ? get_properties ().graphics_object_name ()
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2858 : "unknown");
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2859 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2860
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2861 bool isa (const std::string& go_name) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2862 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2863 return type () == go_name;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2864 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2865
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2866 virtual graphics_toolkit get_toolkit (void) const
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2867 {
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2868 if (valid_object ())
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2869 return get_properties ().get_toolkit ();
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2870 else
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2871 {
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2872 error ("base_graphics_object::get_toolkit: invalid graphics object");
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2873 return graphics_toolkit ();
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2874 }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2875 }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2876
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2877 virtual void add_property_listener (const std::string& nm,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2878 const octave_value& v,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2879 listener_mode mode = POSTSET)
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2880 {
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2881 if (valid_object ())
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2882 get_properties ().add_listener (nm, v, mode);
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2883 }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2884
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2885 virtual void delete_property_listener (const std::string& nm,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2886 const octave_value& v,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2887 listener_mode mode = POSTSET)
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2888 {
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2889 if (valid_object ())
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2890 get_properties ().delete_listener (nm, v, mode);
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2891 }
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2892
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2893 virtual void remove_all_listeners (void);
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2894
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2895 virtual void reset_default_properties (void)
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2896 {
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2897 if (valid_object ())
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2898 {
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2899 std::string msg = (type () + "::reset_default_properties");
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2900 gripe_not_implemented (msg.c_str ());
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2901 }
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2902 else
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2903 error ("base_graphics_object::default: invalid graphics object");
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2904 }
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2905
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2906 protected:
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2907 virtual void initialize (const graphics_object& go)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2908 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2909 if (! toolkit_flag)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2910 toolkit_flag = get_toolkit ().initialize (go);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2911 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2912
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2913 virtual void finalize (const graphics_object& go)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2914 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2915 if (toolkit_flag)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2916 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2917 get_toolkit ().finalize (go);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2918 toolkit_flag = false;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2919 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2920 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2921
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2922 virtual void update (const graphics_object& go, int id)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2923 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2924 if (toolkit_flag)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2925 get_toolkit ().update (go, id);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2926 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2927
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2928 protected:
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2929 // A reference count.
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13938
diff changeset
2930 octave_refcount<int> count;
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
2931
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2932 // A flag telling whether this object is a valid object
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2933 // in the backend context.
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2934 bool toolkit_flag;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2935
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
2936 // No copying!
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
2937
13722
ecff4c684b89 Provide dummy implementations of ctor and assign of base_graphics_object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13714
diff changeset
2938 base_graphics_object (const base_graphics_object&) : count (0) { }
ecff4c684b89 Provide dummy implementations of ctor and assign of base_graphics_object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13714
diff changeset
2939
ecff4c684b89 Provide dummy implementations of ctor and assign of base_graphics_object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13714
diff changeset
2940 base_graphics_object& operator = (const base_graphics_object&)
ecff4c684b89 Provide dummy implementations of ctor and assign of base_graphics_object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13714
diff changeset
2941 {
ecff4c684b89 Provide dummy implementations of ctor and assign of base_graphics_object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13714
diff changeset
2942 return *this;
ecff4c684b89 Provide dummy implementations of ctor and assign of base_graphics_object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13714
diff changeset
2943 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2944 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2945
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
2946 class OCTINTERP_API graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2947 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2948 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2949 graphics_object (void) : rep (new base_graphics_object ()) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2950
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2951 graphics_object (base_graphics_object *new_rep)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2952 : rep (new_rep) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2953
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
2954 graphics_object (const graphics_object& obj) : rep (obj.rep)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2955 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2956 rep->count++;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2957 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2958
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2959 graphics_object& operator = (const graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2960 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2961 if (rep != obj.rep)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2962 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2963 if (--rep->count == 0)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2964 delete rep;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2965
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2966 rep = obj.rep;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2967 rep->count++;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2968 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2969
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2970 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2971 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2972
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2973 ~graphics_object (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2974 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2975 if (--rep->count == 0)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2976 delete rep;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2977 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2978
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2979 void mark_modified (void) { rep->mark_modified (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2980
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2981 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2982 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2983 rep->override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2984 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2985
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2986 void set_from_list (property_list& plist) { rep->set_from_list (plist); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2987
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2988 void set (const caseless_str& name, const octave_value& val)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2989 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2990 rep->set (name, val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2991 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2992
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2993 void set (const octave_value_list& args);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2994
10056
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
2995 void set (const Array<std::string>& names, const Cell& values,
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
2996 octave_idx_type row);
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
2997
11074
8a3b7e8fcbbc graphics.cc, graphics.h.in, genprops.awk: use octave_map and octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents: 10998
diff changeset
2998 void set (const octave_map& m);
10056
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
2999
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
3000 void set_value_or_default (const caseless_str& name,
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
3001 const octave_value& val);
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
3002
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3003 void set_defaults (const std::string& mode) { rep->set_defaults (mode); }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3004
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
3005 octave_value get (bool all = false) const { return rep->get (all); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3006
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3007 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3008 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3009 return name.compare ("default")
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3010 ? get_defaults ()
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3011 : (name.compare ("factory")
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3012 ? get_factory_defaults () : rep->get (name));
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3013 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3014
9620
b00af0da85dd graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents: 9616
diff changeset
3015 octave_value get (const std::string& name) const
b00af0da85dd graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents: 9616
diff changeset
3016 {
b00af0da85dd graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents: 9616
diff changeset
3017 return get (caseless_str (name));
b00af0da85dd graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents: 9616
diff changeset
3018 }
b00af0da85dd graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents: 9616
diff changeset
3019
b00af0da85dd graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents: 9616
diff changeset
3020 octave_value get (const char *name) const
b00af0da85dd graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents: 9616
diff changeset
3021 {
b00af0da85dd graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents: 9616
diff changeset
3022 return get (caseless_str (name));
b00af0da85dd graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents: 9616
diff changeset
3023 }
b00af0da85dd graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents: 9616
diff changeset
3024
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3025 octave_value get_default (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3026 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3027 return rep->get_default (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3028 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3029
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3030 octave_value get_factory_default (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3031 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3032 return rep->get_factory_default (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3033 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3034
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3035 octave_value get_defaults (void) const { return rep->get_defaults (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3036
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3037 octave_value get_factory_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3038 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3039 return rep->get_factory_defaults ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3040 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3041
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
3042 std::string values_as_string (void) { return rep->values_as_string (); }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
3043
11074
8a3b7e8fcbbc graphics.cc, graphics.h.in, genprops.awk: use octave_map and octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents: 10998
diff changeset
3044 octave_map values_as_struct (void) { return rep->values_as_struct (); }
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
3045
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3046 graphics_handle get_parent (void) const { return rep->get_parent (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3047
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
3048 graphics_handle get_handle (void) const { return rep->get_handle (); }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
3049
11250
830b940e7ff4 Turn xget_ancestor into regular API
Michael Goffioul <michael.goffioul@gmail.com>
parents: 11247
diff changeset
3050 graphics_object get_ancestor (const std::string& type) const;
830b940e7ff4 Turn xget_ancestor into regular API
Michael Goffioul <michael.goffioul@gmail.com>
parents: 11247
diff changeset
3051
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3052 void remove_child (const graphics_handle& h) { rep->remove_child (h); }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3053
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3054 void adopt (const graphics_handle& h) { rep->adopt (h); }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3055
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3056 void reparent (const graphics_handle& h) { rep->reparent (h); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3057
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3058 void defaults (void) const { rep->defaults (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3059
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3060 bool isa (const std::string& go_name) const { return rep->isa (go_name); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3061
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3062 base_properties& get_properties (void) { return rep->get_properties (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3063
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3064 const base_properties& get_properties (void) const
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3065 {
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3066 return rep->get_properties ();
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3067 }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3068
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3069 void update_axis_limits (const std::string& axis_type)
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3070 {
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3071 rep->update_axis_limits (axis_type);
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3072 }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3073
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
3074 void update_axis_limits (const std::string& axis_type,
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
3075 const graphics_handle& h)
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
3076 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
3077 rep->update_axis_limits (axis_type, h);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
3078 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
3079
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3080 bool valid_object (void) const { return rep->valid_object (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3081
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
3082 std::string type (void) const { return rep->type (); }
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
3083
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3084 operator bool (void) const { return rep->valid_object (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3085
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3086 // FIXME -- these functions should be generated automatically by the
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3087 // genprops.awk script.
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3088 //
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3089 // EMIT_GRAPHICS_OBJECT_GET_FUNCTIONS
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3090
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3091 octave_value get_xlim (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3092 { return get_properties ().get_xlim (); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3093
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3094 octave_value get_ylim (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3095 { return get_properties ().get_ylim (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3096
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3097 octave_value get_zlim (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3098 { return get_properties ().get_zlim (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3099
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3100 octave_value get_clim (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3101 { return get_properties ().get_clim (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3102
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3103 octave_value get_alim (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3104 { return get_properties ().get_alim (); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3105
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3106 bool is_xliminclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3107 { return get_properties ().is_xliminclude (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3108
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3109 bool is_yliminclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3110 { return get_properties ().is_yliminclude (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3111
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3112 bool is_zliminclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3113 { return get_properties ().is_zliminclude (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3114
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3115 bool is_climinclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3116 { return get_properties ().is_climinclude (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3117
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3118 bool is_aliminclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3119 { return get_properties ().is_aliminclude (); }
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3120
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3121 bool is_handle_visible (void) const
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3122 { return get_properties ().is_handle_visible (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3123
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3124 graphics_toolkit get_toolkit (void) const { return rep->get_toolkit (); }
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3125
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
3126 void add_property_listener (const std::string& nm, const octave_value& v,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3127 listener_mode mode = POSTSET)
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
3128 { rep->add_property_listener (nm, v, mode); }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
3129
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
3130 void delete_property_listener (const std::string& nm, const octave_value& v,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3131 listener_mode mode = POSTSET)
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
3132 { rep->delete_property_listener (nm, v, mode); }
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
3133
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3134 void initialize (void) { rep->initialize (*this); }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3135
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3136 void finalize (void) { rep->finalize (*this); }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3137
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3138 void update (int id) { rep->update (*this, id); }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3139
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3140 void reset_default_properties (void)
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3141 { rep->reset_default_properties (); }
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3142
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3143 private:
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
3144 base_graphics_object *rep;
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3145 };
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3146
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3147 // ---------------------------------------------------------------------
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3148
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
3149 class OCTINTERP_API root_figure : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3150 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3151 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
3152 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3153 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3154 public:
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
3155 void remove_child (const graphics_handle& h);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3156
14357
e7c74f56cd03 fltk toolkit requires figure units to be "pixels". Bug # 35430.
Ben Abbott <bpabbott@mac.com>
parents: 14324
diff changeset
3157 Matrix get_boundingbox (bool internal = false,
e7c74f56cd03 fltk toolkit requires figure units to be "pixels". Bug # 35430.
Ben Abbott <bpabbott@mac.com>
parents: 14324
diff changeset
3158 const Matrix& parent_pix_size = Matrix ()) const;
e7c74f56cd03 fltk toolkit requires figure units to be "pixels". Bug # 35430.
Ben Abbott <bpabbott@mac.com>
parents: 14324
diff changeset
3159
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3160 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3161 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3162
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3163 // FIXME -- it seems strange to me that the diary, diaryfile,
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3164 // echo, format, formatspacing, language, and recursionlimit
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3165 // properties are here. WTF do they have to do with graphics?
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3166 // Also note that these properties (and the monitorpositions,
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3167 // pointerlocation, and pointerwindow properties) are not yet used
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3168 // by Octave, so setting them will have no effect, and changes
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3169 // made elswhere (say, the diary or format functions) will not
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3170 // cause these properties to be updated.
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3171
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
3172 BEGIN_PROPERTIES (root_figure, root)
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3173 handle_property callbackobject Sr , graphics_handle ()
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3174 array_property commandwindowsize r , Matrix (1, 2, 0)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3175 handle_property currentfigure S , graphics_handle ()
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3176 bool_property diary , "off"
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3177 string_property diaryfile , "diary"
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3178 bool_property echo , "off"
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3179 radio_property format , "+|bank|bit|debug|hex|long|longe|longeng|longg|native-bit|native-hex|rational|{short}|shorte|shorteng|shortg"
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3180 radio_property formatspacing , "{loose}|compact"
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3181 string_property language , "ascii"
10949
848f3a13b7cf Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents: 10948
diff changeset
3182 array_property monitorpositions , Matrix (1, 4, 0)
848f3a13b7cf Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents: 10948
diff changeset
3183 array_property pointerlocation , Matrix (1, 2, 0)
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3184 double_property pointerwindow , 0.0
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3185 double_property recursionlimit , 256.0
8560
5cc594679cdc get display characteristics from system
John W. Eaton <jwe@octave.org>
parents: 8465
diff changeset
3186 double_property screendepth r , default_screendepth ()
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3187 double_property screenpixelsperinch r , default_screenpixelsperinch ()
10949
848f3a13b7cf Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents: 10948
diff changeset
3188 array_property screensize r , default_screensize ()
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3189 bool_property showhiddenhandles , "off"
8560
5cc594679cdc get display characteristics from system
John W. Eaton <jwe@octave.org>
parents: 8465
diff changeset
3190 radio_property units U , "inches|centimeters|normalized|points|{pixels}"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3191 END_PROPERTIES
7822
edbaa13397ee Implement callbackobject property in root object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7821
diff changeset
3192
edbaa13397ee Implement callbackobject property in root object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7821
diff changeset
3193 private:
edbaa13397ee Implement callbackobject property in root object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7821
diff changeset
3194 std::list<graphics_handle> cbo_stack;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3195 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3196
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3197 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3198 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3199
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3200 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3201
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3202 root_figure (void) : xproperties (0, graphics_handle ()), default_properties () { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3203
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
3204 ~root_figure (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3205
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3206 void mark_modified (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3207
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3208 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3209 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3210 // Now override with our defaults. If the default_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3211 // list includes the properties for all defaults (line,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3212 // surface, etc.) then we don't have to know the type of OBJ
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3213 // here, we just call its set function and let it decide which
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3214 // properties from the list to use.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3215 obj.set_from_list (default_properties);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3216 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3217
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3218 void set (const caseless_str& name, const octave_value& value)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3219 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3220 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3221 // strip "default", pass rest to function that will
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3222 // parse the remainder and add the element to the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3223 // default_properties map.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3224 default_properties.set (name.substr (7), value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3225 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3226 xproperties.set (name, value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3227 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3228
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3229 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3230 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3231 octave_value retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3232
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3233 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3234 return get_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3235 else if (name.compare ("factory", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3236 return get_factory_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3237 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3238 retval = xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3239
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3240 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3241 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3242
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3243 octave_value get_default (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3244 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3245 octave_value retval = default_properties.lookup (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3246
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3247 if (retval.is_undefined ())
7847
40b16e04172a Make backend switching work.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7846
diff changeset
3248 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3249 // no default property found, use factory default
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3250 retval = factory_properties.lookup (name);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3251
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3252 if (retval.is_undefined ())
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3253 error ("get: invalid default property `%s'", name.c_str ());
7847
40b16e04172a Make backend switching work.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7846
diff changeset
3254 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3255
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3256 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3257 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3258
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3259 octave_value get_factory_default (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3260 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3261 octave_value retval = factory_properties.lookup (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3262
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3263 if (retval.is_undefined ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3264 error ("get: invalid factory default property `%s'", name.c_str ());
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3265
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3266 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3267 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3268
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3269 octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3270 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3271 return default_properties.as_struct ("default");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3272 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3273
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3274 octave_value get_factory_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3275 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3276 return factory_properties.as_struct ("factory");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3277 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3278
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3279 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3280
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3281 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3282
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3283 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3284
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3285 void reset_default_properties (void);
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3286
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3287 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3288 property_list default_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3289
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3290 static property_list factory_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3291
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3292 static property_list::plist_map_type init_factory_properties (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3293 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3294
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3295 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3296
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
3297 class OCTINTERP_API figure : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3298 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3299 public:
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3300 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3301 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3302 public:
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
3303 void init_integerhandle (const octave_value& val)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
3304 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
3305 integerhandle = val;
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
3306 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
3307
8266
81b124f463f9 properly update currentaxes when axes are deleted
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
3308 void remove_child (const graphics_handle& h);
81b124f463f9 properly update currentaxes when axes are deleted
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
3309
7366
2a2115742cb5 [project @ 2008-01-13 06:46:39 by jwe]
jwe
parents: 7365
diff changeset
3310 void set_visible (const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3311
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3312 graphics_toolkit get_toolkit (void) const
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3313 {
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3314 if (! toolkit)
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
3315 toolkit = gtk_manager::get_toolkit ();
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3316
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3317 return toolkit;
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3318 }
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3319
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3320 void set_toolkit (const graphics_toolkit& b);
7439
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
3321
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3322 void set___graphics_toolkit__ (const octave_value& val)
7439
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
3323 {
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
3324 if (! error_state)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3325 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3326 if (val.is_string ())
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3327 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3328 std::string nm = val.string_value ();
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
3329 graphics_toolkit b = gtk_manager::find_toolkit (nm);
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3330 if (b.get_name () != nm)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3331 {
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3332 error ("set___graphics_toolkit__: invalid graphics toolkit");
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3333 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3334 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3335 {
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3336 set_toolkit (b);
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3337 mark_modified ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3338 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3339 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3340 else
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3341 error ("set___graphics_toolkit__ must be a string");
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3342 }
7439
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
3343 }
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3344
13713
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3345 void set_position (const octave_value& val,
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3346 bool do_notify_toolkit = true);
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3347
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3348 void set_outerposition (const octave_value& val,
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3349 bool do_notify_toolkit = true);
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3350
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3351 Matrix get_boundingbox (bool internal = false,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3352 const Matrix& parent_pix_size = Matrix ()) const;
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3353
13713
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3354 void set_boundingbox (const Matrix& bb, bool internal = false,
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3355 bool do_notify_toolkit = true);
7826
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
3356
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3357 Matrix map_from_boundingbox (double x, double y) const;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3358
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3359 Matrix map_to_boundingbox (double x, double y) const;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3360
10991
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3361 void update_units (const caseless_str& old_units);
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3362
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3363 void update_paperunits (const caseless_str& old_paperunits);
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3364
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
3365 std::string get_title (void) const;
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
3366
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3367 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3368 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3369
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
3370 BEGIN_PROPERTIES (figure)
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
3371 any_property __plot_stream__ h , Matrix ()
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
3372 bool_property __enhanced__ h , "on"
10505
82ee24bf783c graphics.h.in: Fix nextplot property values.
Ben Abbott <bpabbott@mac.com>
parents: 10402
diff changeset
3373 radio_property nextplot , "new|{add}|replacechildren|replace"
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3374 callback_property closerequestfcn , "closereq"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3375 handle_property currentaxes S , graphics_handle ()
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3376 array_property colormap , jet_colormap ()
14257
5cc69bafe3b9 Add updating for figure paperorientation property. Bug # 35329.
Ben Abbott <bpabbott@mac.com>
parents: 14138
diff changeset
3377 radio_property paperorientation U , "{portrait}|landscape|rotated"
10566
5475da58d39f graphics.h.in: Have figure color property support a radio value, 'none'.
Ben Abbott <bpabbott@mac.com>
parents: 10553
diff changeset
3378 color_property color , color_property (color_values (1, 1, 1), radio_values ("none"))
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3379 array_property alphamap , Matrix (64, 1, 1)
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3380 string_property currentcharacter r , ""
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3381 handle_property currentobject r , graphics_handle ()
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10505
diff changeset
3382 array_property currentpoint r , Matrix (2, 1, 0)
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3383 bool_property dockcontrols , "off"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3384 bool_property doublebuffer , "on"
11247
29b1f7d68665 make filename property of figure objects writable
John W. Eaton <jwe@octave.org>
parents: 11175
diff changeset
3385 string_property filename , ""
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
3386 bool_property integerhandle S , "on"
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3387 bool_property inverthardcopy , "off"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3388 callback_property keypressfcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3389 callback_property keyreleasefcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3390 radio_property menubar , "none|{figure}"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3391 double_property mincolormap , 64
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3392 string_property name , ""
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3393 bool_property numbertitle , "on"
13713
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3394 array_property outerposition s , Matrix (1, 4, -1.0)
10991
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3395 radio_property paperunits Su , "{inches}|centimeters|normalized|points"
10949
848f3a13b7cf Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents: 10948
diff changeset
3396 array_property paperposition , default_figure_paperposition ()
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3397 radio_property paperpositionmode , "auto|{manual}"
10991
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3398 array_property papersize U , default_figure_papersize ()
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3399 radio_property papertype SU , "{usletter}|uslegal|a0|a1|a2|a3|a4|a5|b0|b1|b2|b3|b4|b5|arch-a|arch-b|arch-c|arch-d|arch-e|a|b|c|d|e|tabloid|<custom>"
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3400 radio_property pointer , "crosshair|fullcrosshair|{arrow}|ibeam|watch|topl|topr|botl|botr|left|top|right|bottom|circle|cross|fleur|custom|hand"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3401 array_property pointershapecdata , Matrix (16, 16, 0)
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3402 array_property pointershapehotspot , Matrix (1, 2, 0)
13713
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3403 array_property position s , default_figure_position ()
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3404 radio_property renderer , "{painters}|zbuffer|opengl|none"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3405 radio_property renderermode , "{auto}|manual"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3406 bool_property resize , "on"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3407 callback_property resizefcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3408 radio_property selectiontype , "{normal}|open|alt|extend"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3409 radio_property toolbar , "none|{auto}|figure"
10991
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3410 radio_property units Su , "inches|centimeters|normalized|points|{pixels}|characters"
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3411 callback_property windowbuttondownfcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3412 callback_property windowbuttonmotionfcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3413 callback_property windowbuttonupfcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3414 callback_property windowbuttonwheelfcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3415 radio_property windowstyle , "{normal}|modal|docked"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3416 string_property wvisual , ""
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3417 radio_property wvisualmode , "{auto}|manual"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3418 string_property xdisplay , ""
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3419 string_property xvisual , ""
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3420 radio_property xvisualmode , "{auto}|manual"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3421 callback_property buttondownfcn , Matrix ()
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3422 string_property __graphics_toolkit__ s , "gnuplot"
13699
dd9b32af0a01 Implement guidata/guihandles.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13324
diff changeset
3423 any_property __guidata__ h , Matrix ()
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3424 END_PROPERTIES
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3425
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3426 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3427 void init (void)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3428 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3429 colormap.add_constraint (dim_vector (-1, 3));
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3430 alphamap.add_constraint (dim_vector (-1, 1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3431 paperposition.add_constraint (dim_vector (1, 4));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3432 pointershapecdata.add_constraint (dim_vector (16, 16));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3433 pointershapehotspot.add_constraint (dim_vector (1, 2));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3434 position.add_constraint (dim_vector (1, 4));
13713
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3435 outerposition.add_constraint (dim_vector (1, 4));
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3436 }
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3437
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3438 private:
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3439 mutable graphics_toolkit toolkit;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3440 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3441
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3442 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3443 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3444
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3445 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3446 figure (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3447 : base_graphics_object (), xproperties (mh, p), default_properties ()
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3448 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3449 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3450 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3451
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
3452 ~figure (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3453
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3454 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3455 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3456 // Allow parent (root figure) to override first (properties knows how
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3457 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3458 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3459
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3460 // Now override with our defaults. If the default_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3461 // list includes the properties for all defaults (line,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3462 // surface, etc.) then we don't have to know the type of OBJ
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3463 // here, we just call its set function and let it decide which
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3464 // properties from the list to use.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3465 obj.set_from_list (default_properties);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3466 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3467
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3468 void set (const caseless_str& name, const octave_value& value)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3469 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3470 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3471 // strip "default", pass rest to function that will
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3472 // parse the remainder and add the element to the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3473 // default_properties map.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3474 default_properties.set (name.substr (7), value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3475 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3476 xproperties.set (name, value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3477 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3478
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3479 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3480 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3481 octave_value retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3482
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3483 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3484 retval = get_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3485 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3486 retval = xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3487
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3488 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3489 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3490
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3491 octave_value get_default (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3492
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3493 octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3494 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3495 return default_properties.as_struct ("default");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3496 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3497
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3498 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3499
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3500 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3501
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3502 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3503
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3504 void reset_default_properties (void);
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3505
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3506 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3507 property_list default_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3508 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3509
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3510 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3511
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3512 class OCTINTERP_API graphics_xform
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3513 {
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3514 public:
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3515 graphics_xform (void)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
3516 : xform (xform_eye ()), xform_inv (xform_eye ()),
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
3517 sx ("linear"), sy ("linear"), sz ("linear"), zlim (1, 2, 0.0)
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3518 {
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3519 zlim(1) = 1.0;
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3520 }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3521
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3522 graphics_xform (const Matrix& xm, const Matrix& xim,
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3523 const scaler& x, const scaler& y, const scaler& z,
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3524 const Matrix& zl)
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3525 : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { }
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3526
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3527 graphics_xform (const graphics_xform& g)
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3528 : xform (g.xform), xform_inv (g.xform_inv), sx (g.sx),
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3529 sy (g.sy), sz (g.sz), zlim (g.zlim) { }
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3530
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3531 ~graphics_xform (void) { }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3532
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3533 graphics_xform& operator = (const graphics_xform& g)
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3534 {
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3535 xform = g.xform;
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3536 xform_inv = g.xform_inv;
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3537 sx = g.sx;
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3538 sy = g.sy;
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3539 sz = g.sz;
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3540 zlim = g.zlim;
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3541
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3542 return *this;
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3543 }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3544
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3545 static ColumnVector xform_vector (double x, double y, double z);
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3546
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3547 static Matrix xform_eye (void);
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3548
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3549 ColumnVector transform (double x, double y, double z,
10553
f88e3d5d88e2 avoid GCC warnings
John W. Eaton <jwe@octave.org>
parents: 10517
diff changeset
3550 bool use_scale = true) const;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3551
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3552 ColumnVector untransform (double x, double y, double z,
10553
f88e3d5d88e2 avoid GCC warnings
John W. Eaton <jwe@octave.org>
parents: 10517
diff changeset
3553 bool use_scale = true) const;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3554
10553
f88e3d5d88e2 avoid GCC warnings
John W. Eaton <jwe@octave.org>
parents: 10517
diff changeset
3555 ColumnVector untransform (double x, double y, bool use_scale = true) const
f88e3d5d88e2 avoid GCC warnings
John W. Eaton <jwe@octave.org>
parents: 10517
diff changeset
3556 { return untransform (x, y, (zlim(0)+zlim(1))/2, use_scale); }
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3557
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3558 Matrix xscale (const Matrix& m) const { return sx.scale (m); }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3559 Matrix yscale (const Matrix& m) const { return sy.scale (m); }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3560 Matrix zscale (const Matrix& m) const { return sz.scale (m); }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3561
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3562 Matrix scale (const Matrix& m) const
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3563 {
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3564 bool has_z = (m.columns () > 2);
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3565
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3566 if (sx.is_linear () && sy.is_linear ()
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3567 && (! has_z || sz.is_linear ()))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3568 return m;
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3569
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3570 Matrix retval (m.dims ());
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3571
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3572 int r = m.rows ();
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3573
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3574 for (int i = 0; i < r; i++)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3575 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3576 retval(i,0) = sx.scale (m(i,0));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3577 retval(i,1) = sy.scale (m(i,1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3578 if (has_z)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3579 retval(i,2) = sz.scale (m(i,2));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3580 }
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3581
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3582 return retval;
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3583 }
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3584
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3585 private:
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3586 Matrix xform;
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3587 Matrix xform_inv;
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3588 scaler sx, sy, sz;
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3589 Matrix zlim;
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3590 };
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3591
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3592 enum {
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3593 AXE_ANY_DIR = 0,
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3594 AXE_DEPTH_DIR = 1,
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3595 AXE_HORZ_DIR = 2,
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3596 AXE_VERT_DIR = 3
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3597 };
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3598
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
3599 class OCTINTERP_API axes : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3600 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3601 public:
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3602 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3603 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3604 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3605 void set_defaults (base_graphics_object& obj, const std::string& mode);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3606
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3607 void remove_child (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3608
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3609 const scaler& get_x_scaler (void) const { return sx; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3610 const scaler& get_y_scaler (void) const { return sy; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3611 const scaler& get_z_scaler (void) const { return sz; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3612
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3613 Matrix get_boundingbox (bool internal = false,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3614 const Matrix& parent_pix_size = Matrix ()) const;
12496
245b5efb07c2 fix axes position synchronization for long text objects
Konstantinos Poulios <logari81@gmail.com>
parents: 12467
diff changeset
3615 Matrix get_extent (bool with_text = false, bool only_text_height=false) const;
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3616
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3617 double get_fontsize_points (double box_pix_height = 0) const;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3618
7828
4739b6a1925c Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7827
diff changeset
3619 void update_boundingbox (void)
4739b6a1925c Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7827
diff changeset
3620 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3621 if (units_is ("normalized"))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3622 {
12441
b932ae4381da improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12440
diff changeset
3623 sync_positions ();
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3624 base_properties::update_boundingbox ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3625 }
7828
4739b6a1925c Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7827
diff changeset
3626 }
4739b6a1925c Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7827
diff changeset
3627
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3628 void update_camera (void);
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3629 void update_axes_layout (void);
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3630 void update_aspectratios (void);
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3631 void update_transform (void)
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3632 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3633 update_aspectratios ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3634 update_camera ();
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3635 update_axes_layout ();
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3636 }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3637
12389
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3638 void update_autopos (const std::string& elem_type);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3639 void update_xlabel_position (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3640 void update_ylabel_position (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3641 void update_zlabel_position (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3642 void update_title_position (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3643
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3644 graphics_xform get_transform (void) const
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3645 { return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); }
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3646
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3647 Matrix get_transform_matrix (void) const { return x_render; }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3648 Matrix get_inverse_transform_matrix (void) const { return x_render_inv; }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3649 Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3650 Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3651 Matrix get_transform_zlim (void) const { return x_zlim; }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3652
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3653 int get_xstate (void) const { return xstate; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3654 int get_ystate (void) const { return ystate; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3655 int get_zstate (void) const { return zstate; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3656 double get_xPlane (void) const { return xPlane; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3657 double get_xPlaneN (void) const { return xPlaneN; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3658 double get_yPlane (void) const { return yPlane; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3659 double get_yPlaneN (void) const { return yPlaneN; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3660 double get_zPlane (void) const { return zPlane; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3661 double get_zPlaneN (void) const { return zPlaneN; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3662 double get_xpTick (void) const { return xpTick; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3663 double get_xpTickN (void) const { return xpTickN; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3664 double get_ypTick (void) const { return ypTick; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3665 double get_ypTickN (void) const { return ypTickN; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3666 double get_zpTick (void) const { return zpTick; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3667 double get_zpTickN (void) const { return zpTickN; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3668 double get_x_min (void) const { return std::min (xPlane, xPlaneN); }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3669 double get_x_max (void) const { return std::max (xPlane, xPlaneN); }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3670 double get_y_min (void) const { return std::min (yPlane, yPlaneN); }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3671 double get_y_max (void) const { return std::max (yPlane, yPlaneN); }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3672 double get_z_min (void) const { return std::min (zPlane, zPlaneN); }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3673 double get_z_max (void) const { return std::max (zPlane, zPlaneN); }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3674 double get_fx (void) const { return fx; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3675 double get_fy (void) const { return fy; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3676 double get_fz (void) const { return fz; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3677 double get_xticklen (void) const { return xticklen; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3678 double get_yticklen (void) const { return yticklen; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3679 double get_zticklen (void) const { return zticklen; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3680 double get_xtickoffset (void) const { return xtickoffset; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3681 double get_ytickoffset (void) const { return ytickoffset; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3682 double get_ztickoffset (void) const { return ztickoffset; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3683 bool get_x2Dtop (void) const { return x2Dtop; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3684 bool get_y2Dright (void) const { return y2Dright; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3685 bool get_layer2Dtop (void) const { return layer2Dtop; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3686 bool get_xySym (void) const { return xySym; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3687 bool get_xyzSym (void) const { return xyzSym; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3688 bool get_zSign (void) const { return zSign; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3689 bool get_nearhoriz (void) const { return nearhoriz; }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3690
7842
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7836
diff changeset
3691 ColumnVector pixel2coord (double px, double py) const
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
3692 { return get_transform ().untransform (px, py, (x_zlim(0)+x_zlim(1))/2); }
7842
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7836
diff changeset
3693
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7836
diff changeset
3694 ColumnVector coord2pixel (double x, double y, double z) const
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7836
diff changeset
3695 { return get_transform ().transform (x, y, z); }
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7836
diff changeset
3696
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
3697 void zoom_about_point (double x, double y, double factor,
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
3698 bool push_to_zoom_stack = true);
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
3699 void zoom (const Matrix& xl, const Matrix& yl, bool push_to_zoom_stack = true);
14314
17de694961f5 make panning work for logscale axes
John W. Eaton <jwe@octave.org>
parents: 14281
diff changeset
3700 void translate_view (double x0, double x1, double y0, double y1);
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10770
diff changeset
3701 void rotate_view (double delta_az, double delta_el);
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
3702 void unzoom (void);
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
3703 void clear_zoom_stack (void);
7842
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7836
diff changeset
3704
10991
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3705 void update_units (const caseless_str& old_units);
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3706
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3707 void update_fontunits (const caseless_str& old_fontunits);
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3708
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3709 private:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3710 scaler sx, sy, sz;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3711 Matrix x_render, x_render_inv;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3712 Matrix x_gl_mat1, x_gl_mat2;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3713 Matrix x_zlim;
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
3714 std::list<octave_value> zoom_stack;
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3715
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3716 // Axes layout data
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3717 int xstate, ystate, zstate;
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3718 double xPlane, xPlaneN, yPlane, yPlaneN, zPlane, zPlaneN;
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3719 double xpTick, xpTickN, ypTick, ypTickN, zpTick, zpTickN;
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3720 double fx, fy, fz;
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3721 double xticklen, yticklen, zticklen;
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3722 double xtickoffset, ytickoffset, ztickoffset;
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3723 bool x2Dtop, y2Dright, layer2Dtop;
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3724 bool xySym, xyzSym, zSign, nearhoriz;
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3725
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3726 #if HAVE_FREETYPE
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3727 // freetype renderer, used for calculation of text (tick labels) size
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3728 ft_render text_renderer;
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3729 #endif
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3730
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3731 void set_text_child (handle_property& h, const std::string& who,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3732 const octave_value& v);
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3733
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
3734 void delete_text_child (handle_property& h);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
3735
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3736 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3737 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3738
8222
11badf6c9e9f __go_draw_axes__.m: Support axes interpreter poperty for tick labels.
Ben Abbott <bpabbott@mac.com>
parents: 8210
diff changeset
3739 // properties which are not in matlab: interpreter
11badf6c9e9f __go_draw_axes__.m: Support axes interpreter poperty for tick labels.
Ben Abbott <bpabbott@mac.com>
parents: 8210
diff changeset
3740
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
3741 BEGIN_PROPERTIES (axes)
10949
848f3a13b7cf Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents: 10948
diff changeset
3742 array_property position u , default_axes_position ()
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3743 bool_property box , "on"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3744 array_property colororder , default_colororder ()
11167
51ac3a08e53c Fix {d,pb}aspectratios for OpenGL backends.
Konstantinos Poulios <logari81@googlemail.com>
parents: 11163
diff changeset
3745 array_property dataaspectratio mu , Matrix (1, 3, 1.0)
51ac3a08e53c Fix {d,pb}aspectratios for OpenGL backends.
Konstantinos Poulios <logari81@googlemail.com>
parents: 11163
diff changeset
3746 radio_property dataaspectratiomode u , "{auto}|manual"
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3747 radio_property layer u , "{bottom}|top"
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
3748 row_vector_property xlim mu , default_lim ()
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
3749 row_vector_property ylim mu , default_lim ()
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
3750 row_vector_property zlim mu , default_lim ()
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
3751 row_vector_property clim m , default_lim ()
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
3752 row_vector_property alim m , default_lim ()
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3753 radio_property xlimmode al , "{auto}|manual"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3754 radio_property ylimmode al , "{auto}|manual"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3755 radio_property zlimmode al , "{auto}|manual"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3756 radio_property climmode al , "{auto}|manual"
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3757 radio_property alimmode , "{auto}|manual"
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
3758 handle_property xlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
3759 handle_property ylabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
3760 handle_property zlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
3761 handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3762 bool_property xgrid , "off"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3763 bool_property ygrid , "off"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3764 bool_property zgrid , "off"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3765 bool_property xminorgrid , "off"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3766 bool_property yminorgrid , "off"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3767 bool_property zminorgrid , "off"
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3768 row_vector_property xtick mu , default_axes_tick ()
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3769 row_vector_property ytick mu , default_axes_tick ()
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3770 row_vector_property ztick mu , default_axes_tick ()
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3771 radio_property xtickmode u , "{auto}|manual"
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3772 radio_property ytickmode u , "{auto}|manual"
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3773 radio_property ztickmode u , "{auto}|manual"
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3774 bool_property xminortick , "off"
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3775 bool_property yminortick , "off"
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3776 bool_property zminortick , "off"
8333
9238637cb81c style fixes
John W. Eaton <jwe@octave.org>
parents: 8300
diff changeset
3777 // FIXME -- should be kind of string array.
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3778 any_property xticklabel m , ""
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3779 any_property yticklabel m , ""
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3780 any_property zticklabel m , ""
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3781 radio_property xticklabelmode u , "{auto}|manual"
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3782 radio_property yticklabelmode u , "{auto}|manual"
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3783 radio_property zticklabelmode u , "{auto}|manual"
8222
11badf6c9e9f __go_draw_axes__.m: Support axes interpreter poperty for tick labels.
Ben Abbott <bpabbott@mac.com>
parents: 8210
diff changeset
3784 radio_property interpreter , "tex|{none}|latex"
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
3785 color_property color , color_property (color_values (1, 1, 1), radio_values ("none"))
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3786 color_property xcolor , color_values (0, 0, 0)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3787 color_property ycolor , color_values (0, 0, 0)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3788 color_property zcolor , color_values (0, 0, 0)
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3789 radio_property xscale alu , "{linear}|log"
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3790 radio_property yscale alu , "{linear}|log"
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3791 radio_property zscale alu , "{linear}|log"
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3792 radio_property xdir u , "{normal}|reverse"
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3793 radio_property ydir u , "{normal}|reverse"
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3794 radio_property zdir u , "{normal}|reverse"
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3795 radio_property yaxislocation u , "{left}|right|zero"
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3796 radio_property xaxislocation u , "{bottom}|top|zero"
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3797 array_property view u , Matrix ()
10770
84c35a483d1f Support 'hold all' (Feature Request #30336)
David Bateman <dbateman@free.fr>
parents: 10724
diff changeset
3798 bool_property __hold_all__ h , "off"
10505
82ee24bf783c graphics.h.in: Fix nextplot property values.
Ben Abbott <bpabbott@mac.com>
parents: 10402
diff changeset
3799 radio_property nextplot , "new|add|replacechildren|{replace}"
10949
848f3a13b7cf Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents: 10948
diff changeset
3800 array_property outerposition u , default_axes_outerposition ()
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
3801 radio_property activepositionproperty , "{outerposition}|position"
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3802 color_property ambientlightcolor , color_values (1, 1, 1)
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3803 array_property cameraposition m , Matrix (1, 3, 0.0)
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3804 array_property cameratarget m , Matrix (1, 3, 0.0)
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3805 array_property cameraupvector m , Matrix ()
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3806 double_property cameraviewangle m , 10.0
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3807 radio_property camerapositionmode , "{auto}|manual"
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3808 radio_property cameratargetmode , "{auto}|manual"
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3809 radio_property cameraupvectormode , "{auto}|manual"
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3810 radio_property cameraviewanglemode , "{auto}|manual"
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3811 array_property currentpoint , Matrix (2, 3, 0.0)
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3812 radio_property drawmode , "{normal}|fast"
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3813 radio_property fontangle u , "{normal}|italic|oblique"
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3814 string_property fontname u , OCTAVE_DEFAULT_FONTNAME
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3815 double_property fontsize u , 10
10991
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3816 radio_property fontunits SU , "{points}|normalized|inches|centimeters|pixels"
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3817 radio_property fontweight u , "{normal}|light|demi|bold"
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3818 radio_property gridlinestyle , "-|--|{:}|-.|none"
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
3819 string_array_property linestyleorder , "-"
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3820 double_property linewidth , 0.5
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3821 radio_property minorgridlinestyle , "-|--|{:}|-.|none"
11167
51ac3a08e53c Fix {d,pb}aspectratios for OpenGL backends.
Konstantinos Poulios <logari81@googlemail.com>
parents: 11163
diff changeset
3822 array_property plotboxaspectratio mu , Matrix (1, 3, 1.0)
51ac3a08e53c Fix {d,pb}aspectratios for OpenGL backends.
Konstantinos Poulios <logari81@googlemail.com>
parents: 11163
diff changeset
3823 radio_property plotboxaspectratiomode u , "{auto}|manual"
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3824 radio_property projection , "{orthographic}|perpective"
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3825 radio_property tickdir mu , "{in}|out"
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3826 radio_property tickdirmode u , "{auto}|manual"
14391
c9ec21bef97a Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
3827 array_property ticklength u , default_axes_ticklength ()
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3828 array_property tightinset r , Matrix (1, 4, 0.0)
8333
9238637cb81c style fixes
John W. Eaton <jwe@octave.org>
parents: 8300
diff changeset
3829 // FIXME -- uicontextmenu should be moved here.
10991
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3830 radio_property units SU , "{normalized}|inches|centimeters|points|pixels|characters"
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3831 // hidden properties for transformation computation
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3832 array_property x_viewtransform h , Matrix (4, 4, 0.0)
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3833 array_property x_projectiontransform h , Matrix (4, 4, 0.0)
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3834 array_property x_viewporttransform h , Matrix (4, 4, 0.0)
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3835 array_property x_normrendertransform h , Matrix (4, 4, 0.0)
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3836 array_property x_rendertransform h , Matrix (4, 4, 0.0)
12126
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
3837 // hidden properties for minor ticks
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
3838 row_vector_property xmtick h , Matrix ()
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
3839 row_vector_property ymtick h , Matrix ()
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
3840 row_vector_property zmtick h , Matrix ()
12467
2f83974d5a6d implement looseinset property for axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12443
diff changeset
3841 // hidden properties for inset
2f83974d5a6d implement looseinset property for axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12443
diff changeset
3842 array_property looseinset hu , Matrix (1, 4, 0.0)
12685
5cbf660e649d Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents: 12506
diff changeset
3843 // hidden properties for alignment of subplots
5cbf660e649d Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents: 12506
diff changeset
3844 radio_property autopos_tag h , "{none}|subplot"
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3845 END_PROPERTIES
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3846
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3847 protected:
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3848 void init (void);
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3849
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3850 private:
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3851
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3852 std::string
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3853 get_scale (const std::string& scale, const Matrix& lims)
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3854 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3855 std::string retval = scale;
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3856
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3857 if (scale == "log" && lims.numel () > 1 && lims(0) < 0 && lims(1) < 0)
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3858 retval = "neglog";
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3859
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3860 return retval;
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3861 }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3862
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3863 void update_xscale (void)
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3864 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3865 sx = get_scale (get_xscale (), xlim.get ().matrix_value ());
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3866 }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3867
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3868 void update_yscale (void)
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3869 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3870 sy = get_scale (get_yscale (), ylim.get ().matrix_value ());
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3871 }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3872
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3873 void update_zscale (void)
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3874 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3875 sz = get_scale (get_zscale (), zlim.get ().matrix_value ());
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3876 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3877
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3878 void update_view (void) { sync_positions (); }
12441
b932ae4381da improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12440
diff changeset
3879 void update_dataaspectratio (void) { sync_positions (); }
b932ae4381da improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12440
diff changeset
3880 void update_dataaspectratiomode (void) { sync_positions (); }
b932ae4381da improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12440
diff changeset
3881 void update_plotboxaspectratio (void) { sync_positions (); }
b932ae4381da improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12440
diff changeset
3882 void update_plotboxaspectratiomode (void) { sync_positions (); }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3883
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3884 void update_layer (void) { update_axes_layout (); }
12503
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3885 void update_yaxislocation (void)
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3886 {
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3887 update_axes_layout ();
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3888 update_ylabel_position ();
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3889 }
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3890 void update_xaxislocation (void)
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3891 {
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3892 update_axes_layout ();
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3893 update_xlabel_position ();
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3894 }
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3895
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3896 void update_xdir (void) { update_camera (); update_axes_layout (); }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3897 void update_ydir (void) { update_camera (); update_axes_layout (); }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3898 void update_zdir (void) { update_camera (); update_axes_layout (); }
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3899
14391
c9ec21bef97a Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
3900 void update_ticklength (void);
c9ec21bef97a Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
3901 void update_tickdir (void) { update_ticklength (); }
c9ec21bef97a Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
3902 void update_tickdirmode (void) { update_ticklength (); }
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
3903
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3904 void update_xtick (void)
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3905 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3906 if (xticklabelmode.is ("auto"))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3907 calc_ticklabels (xtick, xticklabel, xscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3908 }
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3909 void update_ytick (void)
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3910 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3911 if (yticklabelmode.is ("auto"))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3912 calc_ticklabels (ytick, yticklabel, yscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3913 }
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3914 void update_ztick (void)
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3915 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3916 if (zticklabelmode.is ("auto"))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3917 calc_ticklabels (ztick, zticklabel, zscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3918 }
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3919
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3920 void update_xtickmode (void)
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3921 {
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3922 if (xtickmode.is ("auto"))
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3923 {
12126
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
3924 calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), xscale.is ("log"));
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3925 update_xtick ();
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3926 }
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3927 }
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3928 void update_ytickmode (void)
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3929 {
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3930 if (ytickmode.is ("auto"))
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3931 {
12126
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
3932 calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), yscale.is ("log"));
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3933 update_ytick ();
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3934 }
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3935 }
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3936 void update_ztickmode (void)
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3937 {
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3938 if (ztickmode.is ("auto"))
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3939 {
12126
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
3940 calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), zscale.is ("log"));
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3941 update_ztick ();
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3942 }
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3943 }
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3944
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3945 void update_xticklabelmode (void)
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3946 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3947 if (xticklabelmode.is ("auto"))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3948 calc_ticklabels (xtick, xticklabel, xscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3949 }
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3950 void update_yticklabelmode (void)
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3951 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3952 if (yticklabelmode.is ("auto"))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3953 calc_ticklabels (ytick, yticklabel, yscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3954 }
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3955 void update_zticklabelmode (void)
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3956 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3957 if (zticklabelmode.is ("auto"))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3958 calc_ticklabels (ztick, zticklabel, zscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3959 }
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3960
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3961 void update_font (void);
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3962 void update_fontname (void) { update_font (); }
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3963 void update_fontsize (void) { update_font (); }
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3964 void update_fontangle (void) { update_font (); }
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3965 void update_fontweight (void) { update_font (); }
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3966
12685
5cbf660e649d Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents: 12506
diff changeset
3967 void sync_positions (const Matrix& linset);
7860
67edbcb19665 rudimentry (i.e. no font metrics) sync of axes.position and axes.outerposition
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7857
diff changeset
3968 void sync_positions (void);
12685
5cbf660e649d Restructure subplot positioning and avoid labels overlap (bug #31610)
Konstantinos Poulios <logari81@googlemail.com>
parents: 12506
diff changeset
3969
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3970 void update_outerposition (void)
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3971 {
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3972 set_activepositionproperty ("outerposition");
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3973 sync_positions ();
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3974 }
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3975
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3976 void update_position (void)
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3977 {
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3978 set_activepositionproperty ("position");
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3979 sync_positions ();
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3980 }
7860
67edbcb19665 rudimentry (i.e. no font metrics) sync of axes.position and axes.outerposition
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7857
diff changeset
3981
12467
2f83974d5a6d implement looseinset property for axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12443
diff changeset
3982 void update_looseinset (void) { sync_positions (); }
2f83974d5a6d implement looseinset property for axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12443
diff changeset
3983
7827
3584f37eac69 better tick and limit handling, still missing logscale support
Shai Ayal <shaiay@sourceforge.net>
parents: 7826
diff changeset
3984 double calc_tick_sep (double minval, double maxval);
12126
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
3985 void calc_ticks_and_lims (array_property& lims, array_property& ticks, array_property& mticks,
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
3986 bool limmode_is_auto, bool is_logscale);
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3987 void calc_ticklabels (const array_property& ticks, any_property& labels, bool is_logscale);
12334
63dc132a1000 Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents: 12327
diff changeset
3988 Matrix get_ticklabel_extents (const Matrix& ticks,
63dc132a1000 Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents: 12327
diff changeset
3989 const string_vector& ticklabels,
63dc132a1000 Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents: 12327
diff changeset
3990 const Matrix& limits);
63dc132a1000 Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents: 12327
diff changeset
3991
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
3992 void fix_limits (array_property& lims)
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
3993 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3994 if (lims.get ().is_empty ())
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3995 return;
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
3996
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
3997 Matrix l = lims.get ().matrix_value ();
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
3998 if (l(0) > l(1))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3999 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4000 l(0) = 0;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4001 l(1) = 1;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4002 lims = l;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4003 }
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4004 else if (l(0) == l(1))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4005 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4006 l(0) -= 0.5;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4007 l(1) += 0.5;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4008 lims = l;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4009 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4010 }
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4011
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
4012 Matrix calc_tightbox (const Matrix& init_pos);
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
4013
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4014 public:
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
4015 Matrix get_axis_limits (double xmin, double xmax,
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
4016 double min_pos, double max_neg,
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
4017 bool logscale);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4018
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4019 void update_xlim (bool do_clr_zoom = true)
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4020 {
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4021 if (xtickmode.is ("auto"))
12126
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
4022 calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), xscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
4023 if (xticklabelmode.is ("auto"))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4024 calc_ticklabels (xtick, xticklabel, xscale.is ("log"));
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4025
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4026 fix_limits (xlim);
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4027
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4028 update_xscale ();
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4029
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4030 if (do_clr_zoom)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4031 zoom_stack.clear ();
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
4032
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
4033 update_axes_layout ();
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4034 }
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4035
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4036 void update_ylim (bool do_clr_zoom = true)
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4037 {
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4038 if (ytickmode.is ("auto"))
12126
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
4039 calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), yscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
4040 if (yticklabelmode.is ("auto"))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4041 calc_ticklabels (ytick, yticklabel, yscale.is ("log"));
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4042
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4043 fix_limits (ylim);
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4044
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4045 update_yscale ();
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4046
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4047 if (do_clr_zoom)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4048 zoom_stack.clear ();
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
4049
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
4050 update_axes_layout ();
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4051 }
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4052
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4053 void update_zlim (void)
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4054 {
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4055 if (ztickmode.is ("auto"))
12126
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
4056 calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), zscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
4057 if (zticklabelmode.is ("auto"))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4058 calc_ticklabels (ztick, zticklabel, zscale.is ("log"));
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4059
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4060 fix_limits (zlim);
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4061
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4062 update_zscale ();
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4063
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4064 zoom_stack.clear ();
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
4065
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
4066 update_axes_layout ();
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4067 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4068
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4069 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4070
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4071 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4072 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4073
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4074 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4075 axes (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4076 : base_graphics_object (), xproperties (mh, p), default_properties ()
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4077 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4078 xproperties.override_defaults (*this);
7830
61aee739a4da Make sure to initialize axes xform data.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
4079 xproperties.update_transform ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4080 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4081
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
4082 ~axes (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4083
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4084 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4085 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4086 // Allow parent (figure) to override first (properties knows how
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4087 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4088 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4089
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4090 // Now override with our defaults. If the default_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4091 // list includes the properties for all defaults (line,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4092 // surface, etc.) then we don't have to know the type of OBJ
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4093 // here, we just call its set function and let it decide which
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4094 // properties from the list to use.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4095 obj.set_from_list (default_properties);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4096 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4097
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
4098 void set (const caseless_str& name, const octave_value& value)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4099 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4100 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4101 // strip "default", pass rest to function that will
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4102 // parse the remainder and add the element to the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4103 // default_properties map.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4104 default_properties.set (name.substr (7), value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4105 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4106 xproperties.set (name, value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4107 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4108
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4109 void set_defaults (const std::string& mode)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4110 {
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
4111 remove_all_listeners ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4112 xproperties.set_defaults (*this, mode);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4113 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4114
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
4115 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4116 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4117 octave_value retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4118
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4119 // FIXME -- finish this.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4120 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4121 retval = get_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4122 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4123 retval = xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4124
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4125 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4126 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4127
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
4128 octave_value get_default (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4129
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4130 octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4131 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4132 return default_properties.as_struct ("default");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4133 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4134
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4135 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4136
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4137 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4138
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
4139 void update_axis_limits (const std::string& axis_type);
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
4140
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4141 void update_axis_limits (const std::string& axis_type,
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4142 const graphics_handle& h);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4143
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4144 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4145
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
4146 void reset_default_properties (void);
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
4147
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4148 protected:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4149 void initialize (const graphics_object& go);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4150
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4151 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4152 property_list default_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4153 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4154
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4155 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4156
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4157 class OCTINTERP_API line : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4158 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4159 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4160 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4161 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4162 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4163 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4164 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4165
10995
e81914f3921f Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents: 10991
diff changeset
4166 // properties which are not in matlab: interpreter
7366
2a2115742cb5 [project @ 2008-01-13 06:46:39 by jwe]
jwe
parents: 7365
diff changeset
4167
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4168 BEGIN_PROPERTIES (line)
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4169 row_vector_property xdata u , default_data ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4170 row_vector_property ydata u , default_data ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4171 row_vector_property zdata u , Matrix ()
8257
79c874fe5100 More plot object updates
David Bateman <dbateman@free.fr>
parents: 8254
diff changeset
4172 string_property xdatasource , ""
79c874fe5100 More plot object updates
David Bateman <dbateman@free.fr>
parents: 8254
diff changeset
4173 string_property ydatasource , ""
79c874fe5100 More plot object updates
David Bateman <dbateman@free.fr>
parents: 8254
diff changeset
4174 string_property zdatasource , ""
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4175 color_property color , color_values (0, 0, 0)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4176 radio_property linestyle , "{-}|--|:|-.|none"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4177 double_property linewidth , 0.5
10121
b5cc666da6ca Support the '@' marker that was present in Octave 2.1.x
David Bateman <dbateman@free.fr>
parents: 10089
diff changeset
4178 radio_property marker , "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h|@"
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4179 color_property markeredgecolor , "{auto}|none"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4180 color_property markerfacecolor , "auto|{none}"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4181 double_property markersize , 6
7384
47c919254791 [project @ 2008-01-15 20:27:01 by jwe]
jwe
parents: 7380
diff changeset
4182 radio_property interpreter , "{tex}|none|latex"
7377
46b58515067d [project @ 2008-01-15 06:57:15 by jwe]
jwe
parents: 7370
diff changeset
4183 string_property displayname , ""
7380
2ba95a933d3e [project @ 2008-01-15 19:04:27 by jwe]
jwe
parents: 7379
diff changeset
4184 radio_property erasemode , "{normal}|none|xor|background"
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4185 // hidden properties for limit computation
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4186 row_vector_property xlim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4187 row_vector_property ylim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4188 row_vector_property zlim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4189 bool_property xliminclude hl , "on"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4190 bool_property yliminclude hl , "on"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4191 bool_property zliminclude hl , "off"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4192 END_PROPERTIES
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4193
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4194 private:
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4195 Matrix compute_xlim (void) const;
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4196 Matrix compute_ylim (void) const;
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4197
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4198 void update_xdata (void) { set_xlim (compute_xlim ()); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4199
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4200 void update_ydata (void) { set_ylim (compute_ylim ()); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4201
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4202 void update_zdata (void)
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4203 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4204 set_zlim (zdata.get_limits ());
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4205 set_zliminclude (get_zdata ().numel () > 0);
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4206 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4207 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4208
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4209 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4210 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4211
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4212 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4213 line (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4214 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4215 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4216 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4217 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4218
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
4219 ~line (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4220
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4221 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4222
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4223 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4224
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4225 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4226 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4227
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4228 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4229
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4230 class OCTINTERP_API text : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4231 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4232 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4233 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4234 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4235 public:
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4236 double get_fontsize_points (double box_pix_height = 0) const;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4237
14448
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4238 void set_position (const octave_value& val)
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4239 {
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4240 if (! error_state)
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4241 {
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4242 octave_value new_val (val);
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4243
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4244 if (new_val.numel () == 2)
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4245 {
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4246 dim_vector dv (1, 3);
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4247
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4248 new_val = new_val.resize (dv, true);
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4249 }
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4250
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4251 if (position.set (new_val, false))
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4252 {
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4253 set_positionmode ("manual");
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4254 update_position ();
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4255 position.run_listeners (POSTSET);
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4256 mark_modified ();
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4257 }
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4258 else
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4259 set_positionmode ("manual");
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4260 }
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4261 }
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4262
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4263 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4264 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4265
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4266 BEGIN_PROPERTIES (text)
12965
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
4267 text_label_property string u , ""
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4268 radio_property units u , "{data}|pixels|normalized|inches|centimeters|points"
14448
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4269 array_property position smu , Matrix (1, 3, 0.0)
11385
71e7467fbd34 Disable auto-positioning of manually positioned title and axes labels.
Konstantinos Poulios <logari81@googlemail.com>
parents: 11384
diff changeset
4270 double_property rotation mu , 0
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4271 radio_property horizontalalignment mu , "{left}|center|right"
12443
24b38afd6a45 fix plotyy bugs #31800, #32211
Konstantinos Poulios <logari81@googlemail.com>
parents: 12441
diff changeset
4272 color_property color u , color_values (0, 0, 0)
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4273 string_property fontname u , OCTAVE_DEFAULT_FONTNAME
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4274 double_property fontsize u , 10
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4275 radio_property fontangle u , "{normal}|italic|oblique"
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4276 radio_property fontweight u , "light|{normal}|demi|bold"
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4277 radio_property interpreter u , "{tex}|none|latex"
7377
46b58515067d [project @ 2008-01-15 06:57:15 by jwe]
jwe
parents: 7370
diff changeset
4278 color_property backgroundcolor , "{none}"
46b58515067d [project @ 2008-01-15 06:57:15 by jwe]
jwe
parents: 7370
diff changeset
4279 string_property displayname , ""
46b58515067d [project @ 2008-01-15 06:57:15 by jwe]
jwe
parents: 7370
diff changeset
4280 color_property edgecolor , "{none}"
7380
2ba95a933d3e [project @ 2008-01-15 19:04:27 by jwe]
jwe
parents: 7379
diff changeset
4281 radio_property erasemode , "{normal}|none|xor|background"
7377
46b58515067d [project @ 2008-01-15 06:57:15 by jwe]
jwe
parents: 7370
diff changeset
4282 bool_property editing , "off"
8465
cddf85b1524a graphics.h.in: fix typo
Ben Abbott <bpabbott@mac.com>
parents: 8355
diff changeset
4283 radio_property fontunits , "inches|centimeters|normalized|{points}|pixels"
7377
46b58515067d [project @ 2008-01-15 06:57:15 by jwe]
jwe
parents: 7370
diff changeset
4284 radio_property linestyle , "{-}|--|:|-.|none"
46b58515067d [project @ 2008-01-15 06:57:15 by jwe]
jwe
parents: 7370
diff changeset
4285 double_property linewidth , 0.5
46b58515067d [project @ 2008-01-15 06:57:15 by jwe]
jwe
parents: 7370
diff changeset
4286 double_property margin , 1
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4287 radio_property verticalalignment mu , "top|cap|{middle}|baseline|bottom"
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4288 array_property extent rG , Matrix (1, 4, 0.0)
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4289 // hidden properties for limit computation
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4290 row_vector_property xlim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4291 row_vector_property ylim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4292 row_vector_property zlim hlr , Matrix ()
11281
3f952c6973f7 graphics.h.in: Change intended for 11272.
Ben Abbott <bpabbott@mac.com>
parents: 11250
diff changeset
4293 bool_property xliminclude hl , "off"
3f952c6973f7 graphics.h.in: Change intended for 11272.
Ben Abbott <bpabbott@mac.com>
parents: 11250
diff changeset
4294 bool_property yliminclude hl , "off"
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4295 bool_property zliminclude hl , "off"
11385
71e7467fbd34 Disable auto-positioning of manually positioned title and axes labels.
Konstantinos Poulios <logari81@googlemail.com>
parents: 11384
diff changeset
4296 // hidden properties for auto-positioning
12389
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4297 radio_property positionmode hu , "{auto}|manual"
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4298 radio_property rotationmode hu , "{auto}|manual"
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4299 radio_property horizontalalignmentmode hu , "{auto}|manual"
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4300 radio_property verticalalignmentmode hu , "{auto}|manual"
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4301 radio_property autopos_tag h , "{none}|xlabel|ylabel|zlabel|title"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4302 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4303
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4304 Matrix get_data_position (void) const;
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4305 Matrix get_extent_matrix (void) const;
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4306 const uint8NDArray& get_pixels (void) const { return pixels; }
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4307 #if HAVE_FREETYPE
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
4308 // freetype renderer, used for calculation of text size
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4309 ft_render renderer;
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4310 #endif
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4311
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4312 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4313 void init (void)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4314 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4315 position.add_constraint (dim_vector (1, 3));
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4316 cached_units = get_units ();
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
4317 update_font ();
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4318 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4319
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4320 private:
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4321 void update_position (void)
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4322 {
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4323 Matrix pos = get_data_position ();
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4324 Matrix lim;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4325
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4326 lim = Matrix (1, 3, pos(0));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4327 lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4328 set_xlim (lim);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4329
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4330 lim = Matrix (1, 3, pos(1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4331 lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4332 set_ylim (lim);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4333
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4334 if (pos.numel () == 3)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4335 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4336 lim = Matrix (1, 3, pos(2));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4337 lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4338 set_zliminclude ("on");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4339 set_zlim (lim);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4340 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4341 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4342 set_zliminclude ("off");
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4343 }
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4344
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4345 void update_text_extent (void);
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4346
12389
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4347 void request_autopos (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4348 void update_positionmode (void) { request_autopos (); }
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4349 void update_rotationmode (void) { request_autopos (); }
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4350 void update_horizontalalignmentmode (void) { request_autopos (); }
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4351 void update_verticalalignmentmode (void) { request_autopos (); }
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4352
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
4353 void update_font (void);
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
4354 void update_string (void) { request_autopos (); update_text_extent (); }
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4355 void update_rotation (void) { update_text_extent (); }
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
4356 void update_color (void) { update_font (); }
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
4357 void update_fontname (void) { update_font (); update_text_extent (); }
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
4358 void update_fontsize (void) { update_font (); update_text_extent (); }
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
4359 void update_fontangle (void) { update_font (); update_text_extent (); }
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
4360 void update_fontweight (void) { update_font (); update_text_extent (); }
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4361 void update_interpreter (void) { update_text_extent (); }
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4362 void update_horizontalalignment (void) { update_text_extent (); }
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4363 void update_verticalalignment (void) { update_text_extent (); }
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4364
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4365 void update_units (void);
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4366
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4367 private:
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4368 std::string cached_units;
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4369 uint8NDArray pixels;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4370 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4371
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4372 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4373 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4374
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4375 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4376 text (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4377 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4378 {
12433
02669a1aa070 regexp.cc: avoid deprecated Array<T>:resize function
John W. Eaton <jwe@octave.org>
parents: 12389
diff changeset
4379 xproperties.set_clipping ("off");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4380 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4381 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4382
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
4383 ~text (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4384
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4385 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4386
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4387 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4388
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4389 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4390 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4391
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4392 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4393
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4394 class OCTINTERP_API image : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4395 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4396 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4397 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4398 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4399 public:
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4400 bool is_climinclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4401 { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4402 std::string get_climinclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4403 { return climinclude.current_value (); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4404
9680
73153525df9a initial implementation of OpenGL image rendering
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9620
diff changeset
4405 octave_value get_color_data (void) const;
73153525df9a initial implementation of OpenGL image rendering
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9620
diff changeset
4406
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4407 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4408 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4409
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4410 BEGIN_PROPERTIES (image)
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4411 row_vector_property xdata u , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4412 row_vector_property ydata u , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4413 array_property cdata u , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4414 radio_property cdatamapping al , "{scaled}|direct"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4415 // hidden properties for limit computation
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
4416 row_vector_property xlim hlr , Matrix ()
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
4417 row_vector_property ylim hlr , Matrix ()
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
4418 row_vector_property clim hlr , Matrix ()
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4419 bool_property xliminclude hl , "on"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4420 bool_property yliminclude hl , "on"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4421 bool_property climinclude hlg , "on"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4422 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4423
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4424 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4425 void init (void)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4426 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4427 xdata.add_constraint (2);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4428 ydata.add_constraint (2);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4429 cdata.add_constraint ("double");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4430 cdata.add_constraint ("single");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4431 cdata.add_constraint ("logical");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4432 cdata.add_constraint ("uint8");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4433 cdata.add_constraint ("uint16");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4434 cdata.add_constraint ("int16");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4435 cdata.add_constraint (dim_vector (-1, -1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4436 cdata.add_constraint (dim_vector (-1, -1, 3));
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4437 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4438
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4439 private:
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4440 void update_xdata (void)
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4441 {
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4442 Matrix limits = xdata.get_limits ();
11076
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4443 float dp = pixel_xsize ();
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4444
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4445 limits(0) = limits(0) - dp;
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4446 limits(1) = limits(1) + dp;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4447 set_xlim (limits);
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4448 }
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4449
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4450 void update_ydata (void)
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4451 {
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4452 Matrix limits = ydata.get_limits ();
11076
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4453 float dp = pixel_ysize ();
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4454
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4455 limits(0) = limits(0) - dp;
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4456 limits(1) = limits(1) + dp;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4457 set_ylim (limits);
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4458 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4459
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4460 void update_cdata (void)
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4461 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4462 if (cdatamapping_is ("scaled"))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4463 set_clim (cdata.get_limits ());
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4464 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4465 clim = cdata.get_limits ();
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4466 }
11076
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4467
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4468 float pixel_size (octave_idx_type dim, const Matrix limits)
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4469 {
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4470 octave_idx_type l = dim - 1;
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4471 float dp;
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4472
11089
d761f0dc997e graphics.h.in: Properly set image pixel size when unique(x/ydata) is scalar.
Ben Abbott <bpabbott@mac.com>
parents: 11076
diff changeset
4473 if (l > 0 && limits(0) != limits(1))
11076
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4474 dp = (limits(1) - limits(0))/(2*l);
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4475 else
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4476 {
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4477 if (limits(1) == limits(2))
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4478 dp = 0.5;
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4479 else
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4480 dp = (limits(1) - limits(0))/2;
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4481 }
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4482 return dp;
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4483 }
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4484
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4485 public:
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4486 float pixel_xsize (void)
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4487 {
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4488 return pixel_size ((get_cdata ().dims ())(1), xdata.get_limits ());
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4489 }
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4490
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4491 float pixel_ysize (void)
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4492 {
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4493 return pixel_size ((get_cdata ().dims ())(0), ydata.get_limits ());
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4494 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4495 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4496
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4497 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4498 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4499
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4500 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4501 image (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4502 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4503 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4504 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4505 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4506
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
4507 ~image (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4508
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4509 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4510
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4511 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4512
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4513 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4514 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4515
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4516 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4517
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4518 class OCTINTERP_API patch : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4519 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4520 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4521 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4522 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4523 public:
7833
8ff92634982d Add initial support for patch rendering through GLU tessellation (no transparency, no border, no markers yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7832
diff changeset
4524 octave_value get_color_data (void) const;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4525
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4526 bool is_climinclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4527 { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4528 std::string get_climinclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4529 { return climinclude.current_value (); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4530
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4531 bool is_aliminclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4532 { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4533 std::string get_aliminclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4534 { return aliminclude.current_value (); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4535
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4536 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4537 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4538
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4539 BEGIN_PROPERTIES (patch)
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4540 array_property xdata u , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4541 array_property ydata u , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4542 array_property zdata u , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4543 array_property cdata u , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4544 radio_property cdatamapping l , "{scaled}|direct"
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4545 array_property faces , Matrix ()
7848
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
4546 array_property facevertexalphadata , Matrix ()
7836
4fb2db9c87dd Turn cdata properties into array_property. Add min/max computation to array_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7835
diff changeset
4547 array_property facevertexcdata , Matrix ()
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4548 array_property vertices , Matrix ()
7368
68269e42f573 [project @ 2008-01-14 09:18:38 by jwe]
jwe
parents: 7367
diff changeset
4549 array_property vertexnormals , Matrix ()
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
4550 radio_property normalmode , "{auto}|manual"
13810
e6c1308568c3 correct changeset 33f044561ebf; compatibility fix for patch facecolor property
John W. Eaton <jwe@octave.org>
parents: 13807
diff changeset
4551 color_property facecolor , color_property (color_values (0, 0, 0), radio_values ("flat|none|interp"))
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
4552 double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp"))
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
4553 radio_property facelighting , "flat|{none}|gouraud|phong"
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
4554 color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("flat|none|interp"))
7846
d7737a4268b7 Fix typos in property names (edgealpha/facealpha).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7844
diff changeset
4555 double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp"))
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
4556 radio_property edgelighting , "{none}|flat|gouraud|phong"
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
4557 radio_property backfacelighting , "{reverselit}|unlit|lit"
7368
68269e42f573 [project @ 2008-01-14 09:18:38 by jwe]
jwe
parents: 7367
diff changeset
4558 double_property ambientstrength , 0.3
68269e42f573 [project @ 2008-01-14 09:18:38 by jwe]
jwe
parents: 7367
diff changeset
4559 double_property diffusestrength , 0.6
68269e42f573 [project @ 2008-01-14 09:18:38 by jwe]
jwe
parents: 7367
diff changeset
4560 double_property specularstrength , 0.6
68269e42f573 [project @ 2008-01-14 09:18:38 by jwe]
jwe
parents: 7367
diff changeset
4561 double_property specularexponent , 10.0
68269e42f573 [project @ 2008-01-14 09:18:38 by jwe]
jwe
parents: 7367
diff changeset
4562 double_property specularcolorreflectance , 1.0
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
4563 radio_property erasemode , "{normal}|background|xor|none"
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4564 radio_property linestyle , "{-}|--|:|-.|none"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4565 double_property linewidth , 0.5
10121
b5cc666da6ca Support the '@' marker that was present in Octave 2.1.x
David Bateman <dbateman@free.fr>
parents: 10089
diff changeset
4566 radio_property marker , "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h|@"
10089
dd70982c81a3 Allow markerfacecolor and markeredgecolor to be set and used for patch objects
David Bateman <dbateman@free.fr>
parents: 10056
diff changeset
4567 color_property markeredgecolor , "{auto}|none|flat"
dd70982c81a3 Allow markerfacecolor and markeredgecolor to be set and used for patch objects
David Bateman <dbateman@free.fr>
parents: 10056
diff changeset
4568 color_property markerfacecolor , "auto|{none}|flat"
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4569 double_property markersize , 6
7384
47c919254791 [project @ 2008-01-15 20:27:01 by jwe]
jwe
parents: 7380
diff changeset
4570 radio_property interpreter , "{tex}|none|latex"
10998
728c970a3e7f graphics.h.in: Add displayname property to patch and surface objects.
Ben Abbott <bpabbott@mac.com>
parents: 10995
diff changeset
4571 string_property displayname , ""
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4572 radio_property alphadatamapping l , "none|{scaled}|direct"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4573 // hidden properties for limit computation
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4574 row_vector_property xlim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4575 row_vector_property ylim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4576 row_vector_property zlim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4577 row_vector_property clim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4578 row_vector_property alim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4579 bool_property xliminclude hl , "on"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4580 bool_property yliminclude hl , "on"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4581 bool_property zliminclude hl , "on"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4582 bool_property climinclude hlg , "on"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4583 bool_property aliminclude hlg , "on"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4584 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4585
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4586 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4587 void init (void)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4588 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4589 xdata.add_constraint (dim_vector (-1, -1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4590 ydata.add_constraint (dim_vector (-1, -1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4591 zdata.add_constraint (dim_vector (-1, -1));
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4592 vertices.add_constraint (dim_vector (-1, 2));
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4593 vertices.add_constraint (dim_vector (-1, 3));
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4594 cdata.add_constraint (dim_vector (-1, -1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4595 cdata.add_constraint (dim_vector (-1, -1, 3));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4596 facevertexcdata.add_constraint (dim_vector (-1, 1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4597 facevertexcdata.add_constraint (dim_vector (-1, 3));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4598 facevertexalphadata.add_constraint (dim_vector (-1, 1));
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4599 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4600
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4601 private:
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4602 void update_xdata (void) { set_xlim (xdata.get_limits ()); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4603 void update_ydata (void) { set_ylim (ydata.get_limits ()); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4604 void update_zdata (void) { set_zlim (zdata.get_limits ()); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4605
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4606 void update_cdata (void)
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4607 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4608 if (cdatamapping_is ("scaled"))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4609 set_clim (cdata.get_limits ());
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4610 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4611 clim = cdata.get_limits ();
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4612 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4613 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4614
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4615 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4616 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4617
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4618 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4619 patch (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4620 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4621 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4622 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4623 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4624
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
4625 ~patch (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4626
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4627 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4628
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4629 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4630
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4631 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4632 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4633
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4634 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4635
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4636 class OCTINTERP_API surface : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4637 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4638 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4639 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4640 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4641 public:
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4642 octave_value get_color_data (void) const;
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4643
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4644 bool is_climinclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4645 { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4646 std::string get_climinclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4647 { return climinclude.current_value (); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4648
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4649 bool is_aliminclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4650 { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4651 std::string get_aliminclude (void) const
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4652 { return aliminclude.current_value (); }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4653
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4654 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4655 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4656
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4657 BEGIN_PROPERTIES (surface)
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4658 array_property xdata u , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4659 array_property ydata u , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4660 array_property zdata u , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4661 array_property cdata u , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4662 radio_property cdatamapping al , "{scaled}|direct"
8257
79c874fe5100 More plot object updates
David Bateman <dbateman@free.fr>
parents: 8254
diff changeset
4663 string_property xdatasource , ""
79c874fe5100 More plot object updates
David Bateman <dbateman@free.fr>
parents: 8254
diff changeset
4664 string_property ydatasource , ""
79c874fe5100 More plot object updates
David Bateman <dbateman@free.fr>
parents: 8254
diff changeset
4665 string_property zdatasource , ""
79c874fe5100 More plot object updates
David Bateman <dbateman@free.fr>
parents: 8254
diff changeset
4666 string_property cdatasource , ""
14562
05b7fa3b64c8 Restore 'TextureMap' option for surface objects (Bug #35661)
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
4667 color_property facecolor , "{flat}|none|interp|texturemap"
7846
d7737a4268b7 Fix typos in property names (edgealpha/facealpha).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7844
diff changeset
4668 double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp"))
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
4669 color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("flat|none|interp"))
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4670 radio_property linestyle , "{-}|--|:|-.|none"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4671 double_property linewidth , 0.5
10121
b5cc666da6ca Support the '@' marker that was present in Octave 2.1.x
David Bateman <dbateman@free.fr>
parents: 10089
diff changeset
4672 radio_property marker , "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h|@"
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4673 color_property markeredgecolor , "{auto}|none"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4674 color_property markerfacecolor , "auto|{none}"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4675 double_property markersize , 6
7384
47c919254791 [project @ 2008-01-15 20:27:01 by jwe]
jwe
parents: 7380
diff changeset
4676 radio_property interpreter , "{tex}|none|latex"
10998
728c970a3e7f graphics.h.in: Add displayname property to patch and surface objects.
Ben Abbott <bpabbott@mac.com>
parents: 10995
diff changeset
4677 string_property displayname , ""
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4678 array_property alphadata u , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4679 radio_property alphadatamapping l , "none|direct|{scaled}"
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4680 double_property ambientstrength , 0.3
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4681 radio_property backfacelighting , "unlit|lit|{reverselit}"
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4682 double_property diffusestrength , 0.6
7846
d7737a4268b7 Fix typos in property names (edgealpha/facealpha).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7844
diff changeset
4683 double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp"))
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4684 radio_property edgelighting , "{none}|flat|gouraud|phong"
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4685 radio_property erasemode , "{normal}|none|xor|background"
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4686 radio_property facelighting , "{none}|flat|gouraud|phong"
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4687 radio_property meshstyle , "{both}|row|column"
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4688 radio_property normalmode u , "{auto}|manual"
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4689 double_property specularcolorreflectance , 1
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4690 double_property specularexponent , 10
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4691 double_property specularstrength , 0.9
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4692 array_property vertexnormals u , Matrix ()
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4693 // hidden properties for limit computation
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4694 row_vector_property xlim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4695 row_vector_property ylim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4696 row_vector_property zlim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4697 row_vector_property clim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4698 row_vector_property alim hlr , Matrix ()
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4699 bool_property xliminclude hl , "on"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4700 bool_property yliminclude hl , "on"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4701 bool_property zliminclude hl , "on"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4702 bool_property climinclude hlg , "on"
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4703 bool_property aliminclude hlg , "on"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4704 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4705
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4706 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4707 void init (void)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4708 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4709 xdata.add_constraint (dim_vector (-1, -1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4710 ydata.add_constraint (dim_vector (-1, -1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4711 zdata.add_constraint (dim_vector (-1, -1));
10923
4c1ffaed8caa graphics.cc (convert_cdata): avoid data conversion for entire cdata array at once
John W. Eaton <jwe@octave.org>
parents: 10921
diff changeset
4712 alphadata.add_constraint ("single");
4c1ffaed8caa graphics.cc (convert_cdata): avoid data conversion for entire cdata array at once
John W. Eaton <jwe@octave.org>
parents: 10921
diff changeset
4713 alphadata.add_constraint ("double");
4c1ffaed8caa graphics.cc (convert_cdata): avoid data conversion for entire cdata array at once
John W. Eaton <jwe@octave.org>
parents: 10921
diff changeset
4714 alphadata.add_constraint ("uint8");
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4715 alphadata.add_constraint (dim_vector (-1, -1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4716 vertexnormals.add_constraint (dim_vector (-1, -1, 3));
10923
4c1ffaed8caa graphics.cc (convert_cdata): avoid data conversion for entire cdata array at once
John W. Eaton <jwe@octave.org>
parents: 10921
diff changeset
4717 cdata.add_constraint ("single");
4c1ffaed8caa graphics.cc (convert_cdata): avoid data conversion for entire cdata array at once
John W. Eaton <jwe@octave.org>
parents: 10921
diff changeset
4718 cdata.add_constraint ("double");
4c1ffaed8caa graphics.cc (convert_cdata): avoid data conversion for entire cdata array at once
John W. Eaton <jwe@octave.org>
parents: 10921
diff changeset
4719 cdata.add_constraint ("uint8");
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4720 cdata.add_constraint (dim_vector (-1, -1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4721 cdata.add_constraint (dim_vector (-1, -1, 3));
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4722 }
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4723
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4724 private:
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4725 void update_normals (void);
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4726
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4727 void update_xdata (void)
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4728 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4729 update_normals ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4730 set_xlim (xdata.get_limits ());
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4731 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4732
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4733 void update_ydata (void)
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4734 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4735 update_normals ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4736 set_ylim (ydata.get_limits ());
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4737 }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4738
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4739 void update_zdata (void)
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4740 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4741 update_normals ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4742 set_zlim (zdata.get_limits ());
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4743 }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4744
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4745 void update_cdata (void)
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4746 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4747 if (cdatamapping_is ("scaled"))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4748 set_clim (cdata.get_limits ());
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4749 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4750 clim = cdata.get_limits ();
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4751 }
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4752
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4753 void update_alphadata (void)
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4754 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4755 if (alphadatamapping_is ("scaled"))
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4756 set_alim (alphadata.get_limits ());
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4757 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4758 alim = alphadata.get_limits ();
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4759 }
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4760
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4761 void update_normalmode (void)
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4762 { update_normals (); }
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4763
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4764 void update_vertexnormals (void)
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4765 { set_normalmode ("manual"); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4766 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4767
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4768 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4769 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4770
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4771 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4772 surface (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4773 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4774 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4775 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4776 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4777
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
4778 ~surface (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4779
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4780 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4781
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4782 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4783
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4784 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4785 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4786
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4787 // ---------------------------------------------------------------------
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4788
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4789 class OCTINTERP_API hggroup : public base_graphics_object
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4790 {
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4791 public:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4792 class OCTINTERP_API properties : public base_properties
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4793 {
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4794 public:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4795 void remove_child (const graphics_handle& h)
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4796 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4797 base_properties::remove_child (h);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4798 update_limits ();
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4799 }
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4800
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4801 void adopt (const graphics_handle& h)
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4802 {
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4803
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4804 base_properties::adopt (h);
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4805 update_limits (h);
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4806 }
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4807
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4808 // See the genprops.awk script for an explanation of the
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4809 // properties declarations.
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4810
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4811 BEGIN_PROPERTIES (hggroup)
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4812 // hidden properties for limit computation
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
4813 row_vector_property xlim hr , Matrix ()
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
4814 row_vector_property ylim hr , Matrix ()
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
4815 row_vector_property zlim hr , Matrix ()
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
4816 row_vector_property clim hr , Matrix ()
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
4817 row_vector_property alim hr , Matrix ()
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4818 bool_property xliminclude h , "on"
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4819 bool_property yliminclude h , "on"
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4820 bool_property zliminclude h , "on"
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4821 bool_property climinclude h , "on"
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4822 bool_property aliminclude h , "on"
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4823 END_PROPERTIES
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4824
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4825 private:
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4826 void update_limits (void) const;
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4827
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4828 void update_limits (const graphics_handle& h) const;
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4829
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4830 protected:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4831 void init (void)
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4832 { }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4833
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4834 };
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4835
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4836 private:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4837 properties xproperties;
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4838
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4839 public:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4840 hggroup (const graphics_handle& mh, const graphics_handle& p)
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4841 : base_graphics_object (), xproperties (mh, p)
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4842 {
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4843 xproperties.override_defaults (*this);
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4844 }
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4845
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
4846 ~hggroup (void) { }
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4847
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4848 base_properties& get_properties (void) { return xproperties; }
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4849
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4850 const base_properties& get_properties (void) const { return xproperties; }
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4851
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4852 bool valid_object (void) const { return true; }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4853
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4854 void update_axis_limits (const std::string& axis_type);
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4855
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4856 void update_axis_limits (const std::string& axis_type,
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4857 const graphics_handle& h);
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4858
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4859 };
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4860
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4861 // ---------------------------------------------------------------------
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
4862
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4863 class OCTINTERP_API uimenu : public base_graphics_object
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4864 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4865 public:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4866 class OCTINTERP_API properties : public base_properties
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4867 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4868 public:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4869 void remove_child (const graphics_handle& h)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4870 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4871 base_properties::remove_child (h);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4872 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4873
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4874 void adopt (const graphics_handle& h)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4875 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4876 base_properties::adopt (h);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4877 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4878
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4879 // See the genprops.awk script for an explanation of the
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4880 // properties declarations.
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4881
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4882 BEGIN_PROPERTIES (uimenu)
13307
cbdefe0ec514 Add __object__ property to uimenu.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13281
diff changeset
4883 any_property __object__ , Matrix ()
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4884 string_property accelerator , ""
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
4885 callback_property callback , Matrix ()
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4886 bool_property checked , "off"
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4887 bool_property enable , "on"
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4888 color_property foregroundcolor , color_values (0, 0, 0)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4889 string_property label , ""
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4890 double_property position , 9
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4891 bool_property separator , "off"
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4892 string_property fltk_label h , ""
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4893 END_PROPERTIES
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4894
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4895 protected:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4896 void init (void)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4897 { }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4898 };
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4899
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4900 private:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4901 properties xproperties;
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4902
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4903 public:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4904 uimenu (const graphics_handle& mh, const graphics_handle& p)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4905 : base_graphics_object (), xproperties (mh, p)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4906 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4907 xproperties.override_defaults (*this);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4908 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4909
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
4910 ~uimenu (void) { }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4911
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4912 base_properties& get_properties (void) { return xproperties; }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4913
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4914 const base_properties& get_properties (void) const { return xproperties; }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4915
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4916 bool valid_object (void) const { return true; }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4917
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4918 };
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4919
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4920 // ---------------------------------------------------------------------
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
4921
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4922 class OCTINTERP_API uicontextmenu : public base_graphics_object
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4923 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4924 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4925 class OCTINTERP_API properties : public base_properties
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4926 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4927 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4928 // See the genprops.awk script for an explanation of the
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4929 // properties declarations.
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4930
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4931 BEGIN_PROPERTIES (uicontextmenu)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4932 any_property __object__ , Matrix ()
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
4933 callback_property callback , Matrix ()
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4934 array_property position , Matrix (1, 2, 0.0)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4935 END_PROPERTIES
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4936
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4937 protected:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4938 void init (void)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4939 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4940 position.add_constraint (dim_vector (1, 2));
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4941 position.add_constraint (dim_vector (2, 1));
13868
87f78c11d725 cell2struct: if DIM is omitted, use a default value of 1.
John W. Eaton <jwe@octave.org>
parents: 13816
diff changeset
4942 visible.set (octave_value (true));
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4943 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4944 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4945
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4946 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4947 properties xproperties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4948
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4949 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4950 uicontextmenu (const graphics_handle& mh, const graphics_handle& p)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4951 : base_graphics_object (), xproperties (mh, p)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4952 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4953 xproperties.override_defaults (*this);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4954 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4955
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
4956 ~uicontextmenu (void) { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4957
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4958 base_properties& get_properties (void) { return xproperties; }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4959
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4960 const base_properties& get_properties (void) const { return xproperties; }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4961
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4962 bool valid_object (void) const { return true; }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4963
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4964 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4965
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4966 // ---------------------------------------------------------------------
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
4967
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4968 class OCTINTERP_API uicontrol : public base_graphics_object
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4969 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4970 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4971 class OCTINTERP_API properties : public base_properties
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4972 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4973 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4974 Matrix get_boundingbox (bool internal = false,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4975 const Matrix& parent_pix_size = Matrix ()) const;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4976
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4977 double get_fontsize_points (double box_pix_height = 0) const;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4978
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4979 // See the genprops.awk script for an explanation of the
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4980 // properties declarations.
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4981
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4982 BEGIN_PROPERTIES (uicontrol)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4983 any_property __object__ , Matrix ()
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4984 color_property backgroundcolor , color_values (1, 1, 1)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4985 callback_property callback , Matrix ()
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4986 array_property cdata , Matrix ()
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4987 bool_property clipping , "on"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4988 radio_property enable , "{on}|inactive|off"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4989 array_property extent rG , Matrix (1, 4, 0.0)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4990 radio_property fontangle u , "{normal}|italic|oblique"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4991 string_property fontname u , OCTAVE_DEFAULT_FONTNAME
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4992 double_property fontsize u , 10
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4993 radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4994 radio_property fontweight u , "light|{normal}|demi|bold"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4995 color_property foregroundcolor , color_values (0, 0, 0)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4996 radio_property horizontalalignment , "{left}|center|right"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4997 callback_property keypressfcn , Matrix ()
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4998 double_property listboxtop , 1
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4999 double_property max , 1
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5000 double_property min , 0
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5001 array_property position , default_control_position ()
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5002 array_property sliderstep , default_control_sliderstep ()
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5003 string_array_property string u , ""
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5004 radio_property style S , "{pushbutton}|togglebutton|radiobutton|checkbox|edit|text|slider|frame|listbox|popupmenu"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5005 string_property tooltipstring , ""
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5006 radio_property units u , "normalized|inches|centimeters|points|{pixels}|characters"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5007 row_vector_property value , Matrix (1, 1, 1.0)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5008 radio_property verticalalignment , "top|{middle}|bottom"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5009 END_PROPERTIES
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5010
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5011 private:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5012 std::string cached_units;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5013
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5014 protected:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5015 void init (void)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5016 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5017 cdata.add_constraint ("double");
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5018 cdata.add_constraint ("single");
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5019 cdata.add_constraint ("uint8");
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5020 cdata.add_constraint (dim_vector (-1, -1, 3));
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5021 position.add_constraint (dim_vector (1, 4));
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5022 sliderstep.add_constraint (dim_vector (1, 2));
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5023 cached_units = get_units ();
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5024 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5025
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5026 void update_text_extent (void);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5027
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5028 void update_string (void) { update_text_extent (); }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5029 void update_fontname (void) { update_text_extent (); }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5030 void update_fontsize (void) { update_text_extent (); }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5031 void update_fontangle (void) { update_text_extent (); }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5032 void update_fontweight (void) { update_text_extent (); }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5033 void update_fontunits (const caseless_str& old_units);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5034
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5035 void update_units (void);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5036
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5037 };
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5038
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5039 private:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5040 properties xproperties;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5041
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5042 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5043 uicontrol (const graphics_handle& mh, const graphics_handle& p)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5044 : base_graphics_object (), xproperties (mh, p)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5045 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5046 xproperties.override_defaults (*this);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5047 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5048
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5049 ~uicontrol (void) { }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5050
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5051 base_properties& get_properties (void) { return xproperties; }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5052
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5053 const base_properties& get_properties (void) const { return xproperties; }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5054
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5055 bool valid_object (void) const { return true; }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5056 };
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5057
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5058 // ---------------------------------------------------------------------
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5059
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5060 class OCTINTERP_API uipanel : public base_graphics_object
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5061 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5062 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5063 class OCTINTERP_API properties : public base_properties
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5064 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5065 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5066 Matrix get_boundingbox (bool internal = false,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5067 const Matrix& parent_pix_size = Matrix ()) const;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5068
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5069 double get_fontsize_points (double box_pix_height = 0) const;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5070
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5071 // See the genprops.awk script for an explanation of the
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5072 // properties declarations.
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5073
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5074 BEGIN_PROPERTIES (uipanel)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5075 any_property __object__ , Matrix ()
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5076 color_property backgroundcolor , color_values (1, 1, 1)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5077 radio_property bordertype , "none|{etchedin}|etchedout|beveledin|beveledout|line"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5078 double_property borderwidth , 1
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5079 radio_property fontangle , "{normal}|italic|oblique"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5080 string_property fontname , OCTAVE_DEFAULT_FONTNAME
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5081 double_property fontsize , 10
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5082 radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5083 radio_property fontweight , "light|{normal}|demi|bold"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5084 color_property foregroundcolor , color_values (0, 0, 0)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5085 color_property highlightcolor , color_values (1, 1, 1)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5086 array_property position , default_panel_position ()
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5087 callback_property resizefcn , Matrix ()
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5088 color_property shadowcolor , color_values (0, 0, 0)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5089 string_property title , ""
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5090 radio_property titleposition , "{lefttop}|centertop|righttop|leftbottom|centerbottom|rightbottom"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5091 radio_property units S , "{normalized}|inches|centimeters|points|pixels|characters"
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5092 END_PROPERTIES
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5093
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5094 protected:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5095 void init (void)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5096 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5097 position.add_constraint (dim_vector (1, 4));
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5098 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5099
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5100 void update_units (const caseless_str& old_units);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5101 void update_fontunits (const caseless_str& old_units);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5102
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5103 };
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5104
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5105 private:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5106 properties xproperties;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5107
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5108 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5109 uipanel (const graphics_handle& mh, const graphics_handle& p)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5110 : base_graphics_object (), xproperties (mh, p)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5111 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5112 xproperties.override_defaults (*this);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5113 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5114
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5115 ~uipanel (void) { }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5116
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5117 base_properties& get_properties (void) { return xproperties; }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5118
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5119 const base_properties& get_properties (void) const { return xproperties; }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5120
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5121 bool valid_object (void) const { return true; }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5122 };
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5123
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5124 // ---------------------------------------------------------------------
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5125
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5126 class OCTINTERP_API uitoolbar : public base_graphics_object
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5127 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5128 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5129 class OCTINTERP_API properties : public base_properties
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5130 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5131 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5132 // See the genprops.awk script for an explanation of the
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5133 // properties declarations.
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5134
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5135 BEGIN_PROPERTIES (uitoolbar)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5136 any_property __object__ , Matrix ()
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5137 END_PROPERTIES
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5138
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5139 protected:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5140 void init (void)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5141 { }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5142 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5143
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5144 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5145 properties xproperties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5146
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5147 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5148 uitoolbar (const graphics_handle& mh, const graphics_handle& p)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5149 : base_graphics_object (), xproperties (mh, p), default_properties ()
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5150 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5151 xproperties.override_defaults (*this);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5152 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5153
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5154 ~uitoolbar (void) { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5155
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5156 void override_defaults (base_graphics_object& obj)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5157 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5158 // Allow parent (figure) to override first (properties knows how
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5159 // to find the parent object).
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5160 xproperties.override_defaults (obj);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5161
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5162 // Now override with our defaults. If the default_properties
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5163 // list includes the properties for all defaults (line,
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5164 // surface, etc.) then we don't have to know the type of OBJ
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5165 // here, we just call its set function and let it decide which
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5166 // properties from the list to use.
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5167 obj.set_from_list (default_properties);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5168 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5169
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5170 void set (const caseless_str& name, const octave_value& value)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5171 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5172 if (name.compare ("default", 7))
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5173 // strip "default", pass rest to function that will
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5174 // parse the remainder and add the element to the
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5175 // default_properties map.
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5176 default_properties.set (name.substr (7), value);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5177 else
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5178 xproperties.set (name, value);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5179 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5180
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5181 octave_value get (const caseless_str& name) const
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5182 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5183 octave_value retval;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5184
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5185 if (name.compare ("default", 7))
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5186 retval = get_default (name.substr (7));
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5187 else
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5188 retval = xproperties.get (name);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5189
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5190 return retval;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5191 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5192
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5193 octave_value get_default (const caseless_str& name) const;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5194
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5195 octave_value get_defaults (void) const
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5196 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5197 return default_properties.as_struct ("default");
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5198 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5199
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5200 base_properties& get_properties (void) { return xproperties; }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5201
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5202 const base_properties& get_properties (void) const { return xproperties; }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5203
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5204 bool valid_object (void) const { return true; }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5205
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5206 void reset_default_properties (void);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5207
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5208 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5209 property_list default_properties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5210 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5211
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5212 // ---------------------------------------------------------------------
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5213
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5214 class OCTINTERP_API uipushtool : public base_graphics_object
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5215 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5216 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5217 class OCTINTERP_API properties : public base_properties
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5218 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5219 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5220 // See the genprops.awk script for an explanation of the
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5221 // properties declarations.
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5222
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5223 BEGIN_PROPERTIES (uipushtool)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5224 any_property __object__ , Matrix ()
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5225 array_property cdata , Matrix ()
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
5226 callback_property clickedcallback , Matrix ()
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5227 bool_property enable , "on"
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5228 bool_property separator , "off"
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5229 string_property tooltipstring , ""
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5230 END_PROPERTIES
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5231
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5232 protected:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5233 void init (void)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5234 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5235 cdata.add_constraint ("double");
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5236 cdata.add_constraint ("single");
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5237 cdata.add_constraint ("uint8");
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5238 cdata.add_constraint (dim_vector (-1, -1, 3));
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5239 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5240 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5241
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5242 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5243 properties xproperties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5244
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5245 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5246 uipushtool (const graphics_handle& mh, const graphics_handle& p)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5247 : base_graphics_object (), xproperties (mh, p)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5248 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5249 xproperties.override_defaults (*this);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5250 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5251
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5252 ~uipushtool (void) { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5253
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5254 base_properties& get_properties (void) { return xproperties; }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5255
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5256 const base_properties& get_properties (void) const { return xproperties; }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5257
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5258 bool valid_object (void) const { return true; }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5259
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5260 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5261
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5262 // ---------------------------------------------------------------------
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5263
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5264 class OCTINTERP_API uitoggletool : public base_graphics_object
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5265 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5266 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5267 class OCTINTERP_API properties : public base_properties
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5268 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5269 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5270 // See the genprops.awk script for an explanation of the
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5271 // properties declarations.
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5272
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5273 BEGIN_PROPERTIES (uitoggletool)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5274 any_property __object__ , Matrix ()
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5275 array_property cdata , Matrix ()
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
5276 callback_property clickedcallback , Matrix ()
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5277 bool_property enable , "on"
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
5278 callback_property offcallback , Matrix ()
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14563
diff changeset
5279 callback_property oncallback , Matrix ()
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5280 bool_property separator , "off"
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5281 bool_property state , "off"
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5282 string_property tooltipstring , ""
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5283 END_PROPERTIES
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5284
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5285 protected:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5286 void init (void)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5287 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5288 cdata.add_constraint ("double");
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5289 cdata.add_constraint ("single");
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5290 cdata.add_constraint ("uint8");
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5291 cdata.add_constraint (dim_vector (-1, -1, 3));
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5292 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5293 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5294
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5295 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5296 properties xproperties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5297
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5298 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5299 uitoggletool (const graphics_handle& mh, const graphics_handle& p)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5300 : base_graphics_object (), xproperties (mh, p)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5301 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5302 xproperties.override_defaults (*this);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5303 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5304
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5305 ~uitoggletool (void) { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5306
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5307 base_properties& get_properties (void) { return xproperties; }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5308
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5309 const base_properties& get_properties (void) const { return xproperties; }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5310
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5311 bool valid_object (void) const { return true; }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5312
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5313 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5314
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5315 // ---------------------------------------------------------------------
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5316
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5317 octave_value
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5318 get_property_from_handle (double handle, const std::string &property,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5319 const std::string &func);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5320 bool
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5321 set_property_in_handle (double handle, const std::string &property,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5322 const octave_value &arg, const std::string &func);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5323
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5324 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5325
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5326 class graphics_event;
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5327
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5328 class
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5329 base_graphics_event
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5330 {
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5331 public:
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5332 friend class graphics_event;
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5333
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5334 base_graphics_event (void) : count (1) { }
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5335
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5336 virtual ~base_graphics_event (void) { }
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5337
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5338 virtual void execute (void) = 0;
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5339
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5340 private:
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13938
diff changeset
5341 octave_refcount<int> count;
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5342 };
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5343
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5344 class
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5345 graphics_event
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5346 {
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5347 public:
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5348 typedef void (*event_fcn) (void*);
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5349
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5350 graphics_event (void) : rep (0) { }
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5351
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
5352 graphics_event (const graphics_event& e) : rep (e.rep)
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5353 {
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5354 rep->count++;
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5355 }
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5356
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5357 ~graphics_event (void)
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5358 {
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5359 if (rep && --rep->count == 0)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5360 delete rep;
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5361 }
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5362
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5363 graphics_event& operator = (const graphics_event& e)
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5364 {
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5365 if (rep != e.rep)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5366 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5367 if (rep && --rep->count == 0)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5368 delete rep;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5369
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5370 rep = e.rep;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5371 if (rep)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5372 rep->count++;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5373 }
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5374
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5375 return *this;
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5376 }
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5377
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5378 void execute (void)
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5379 { if (rep) rep->execute (); }
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5380
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5381 bool ok (void) const
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5382 { return (rep != 0); }
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5383
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5384 static graphics_event
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5385 create_callback_event (const graphics_handle& h,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5386 const std::string& name,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5387 const octave_value& data = Matrix ());
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5388
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5389 static graphics_event
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5390 create_callback_event (const graphics_handle& h,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5391 const octave_value& cb,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5392 const octave_value& data = Matrix ());
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5393
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5394 static graphics_event
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5395 create_function_event (event_fcn fcn, void *data = 0);
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5396
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5397 static graphics_event
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5398 create_set_event (const graphics_handle& h, const std::string& name,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5399 const octave_value& value,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5400 bool notify_toolkit = true);
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5401 private:
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5402 base_graphics_event *rep;
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5403 };
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5404
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
5405 class OCTINTERP_API gh_manager
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5406 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5407 protected:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5408
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5409 gh_manager (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5410
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5411 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5412
13992
e1f76bfe0452 apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents: 13985
diff changeset
5413 static void create_instance (void);
e1f76bfe0452 apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents: 13985
diff changeset
5414
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5415 static bool instance_ok (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5416 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5417 bool retval = true;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5418
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5419 if (! instance)
13992
e1f76bfe0452 apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents: 13985
diff changeset
5420 create_instance ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5421
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5422 if (! instance)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5423 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5424 ::error ("unable to create gh_manager!");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5425
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5426 retval = false;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5427 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5428
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5429 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5430 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5431
13992
e1f76bfe0452 apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents: 13985
diff changeset
5432 static void cleanup_instance (void) { delete instance; instance = 0; }
e1f76bfe0452 apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents: 13985
diff changeset
5433
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5434 static graphics_handle get_handle (bool integer_figure_handle)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5435 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5436 return instance_ok ()
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5437 ? instance->do_get_handle (integer_figure_handle) : graphics_handle ();
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5438 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5439
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5440 static void free (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5441 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5442 if (instance_ok ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5443 instance->do_free (h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5444 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5445
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5446 static void renumber_figure (const graphics_handle& old_gh,
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5447 const graphics_handle& new_gh)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5448 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5449 if (instance_ok ())
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5450 instance->do_renumber_figure (old_gh, new_gh);
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5451 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5452
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5453 static graphics_handle lookup (double val)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5454 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5455 return instance_ok () ? instance->do_lookup (val) : graphics_handle ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5456 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5457
10265
8c583af2cf64 validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents: 10161
diff changeset
5458 static graphics_handle lookup (const octave_value& val)
8c583af2cf64 validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents: 10161
diff changeset
5459 {
8c583af2cf64 validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents: 10161
diff changeset
5460 return val.is_real_scalar ()
8c583af2cf64 validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents: 10161
diff changeset
5461 ? lookup (val.double_value ()) : graphics_handle ();
8c583af2cf64 validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents: 10161
diff changeset
5462 }
8c583af2cf64 validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents: 10161
diff changeset
5463
12324
85934e0fcce9 gl-renderer.cc and gl2ps-renderer.cc: access objects directly from gh_manager instead of working with handles
John W. Eaton <jwe@octave.org>
parents: 12174
diff changeset
5464 static graphics_object get_object (double val)
85934e0fcce9 gl-renderer.cc and gl2ps-renderer.cc: access objects directly from gh_manager instead of working with handles
John W. Eaton <jwe@octave.org>
parents: 12174
diff changeset
5465 {
85934e0fcce9 gl-renderer.cc and gl2ps-renderer.cc: access objects directly from gh_manager instead of working with handles
John W. Eaton <jwe@octave.org>
parents: 12174
diff changeset
5466 return get_object (lookup (val));
85934e0fcce9 gl-renderer.cc and gl2ps-renderer.cc: access objects directly from gh_manager instead of working with handles
John W. Eaton <jwe@octave.org>
parents: 12174
diff changeset
5467 }
85934e0fcce9 gl-renderer.cc and gl2ps-renderer.cc: access objects directly from gh_manager instead of working with handles
John W. Eaton <jwe@octave.org>
parents: 12174
diff changeset
5468
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5469 static graphics_object get_object (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5470 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5471 return instance_ok () ? instance->do_get_object (h) : graphics_object ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5472 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5473
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5474 static graphics_handle
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5475 make_graphics_handle (const std::string& go_name,
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5476 const graphics_handle& parent,
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5477 bool integer_figure_handle = false,
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5478 bool do_createfcn = true,
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5479 bool do_notify_toolkit = true)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5480 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5481 return instance_ok ()
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5482 ? instance->do_make_graphics_handle (go_name, parent,
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5483 integer_figure_handle,
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5484 do_createfcn, do_notify_toolkit)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5485 : graphics_handle ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5486 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5487
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5488 static graphics_handle make_figure_handle (double val,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5489 bool do_notify_toolkit = true)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5490 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5491 return instance_ok ()
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5492 ? instance->do_make_figure_handle (val, do_notify_toolkit)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5493 : graphics_handle ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5494 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5495
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5496 static void push_figure (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5497 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5498 if (instance_ok ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5499 instance->do_push_figure (h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5500 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5501
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5502 static void pop_figure (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5503 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5504 if (instance_ok ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5505 instance->do_pop_figure (h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5506 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5507
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5508 static graphics_handle current_figure (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5509 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5510 return instance_ok ()
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5511 ? instance->do_current_figure () : graphics_handle ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5512 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5513
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5514 static Matrix handle_list (bool show_hidden = false)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5515 {
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5516 return instance_ok ()
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5517 ? instance->do_handle_list (show_hidden) : Matrix ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5518 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5519
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5520 static void lock (void)
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5521 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5522 if (instance_ok ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5523 instance->do_lock ();
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5524 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5525
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5526 static bool try_lock (void)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5527 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5528 if (instance_ok ())
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5529 return instance->do_try_lock ();
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5530 else
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5531 return false;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5532 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5533
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5534 static void unlock (void)
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5535 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5536 if (instance_ok ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5537 instance->do_unlock ();
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5538 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5539
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5540 static Matrix figure_handle_list (bool show_hidden = false)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5541 {
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5542 return instance_ok ()
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5543 ? instance->do_figure_handle_list (show_hidden) : Matrix ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5544 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5545
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5546 static void execute_listener (const graphics_handle& h,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5547 const octave_value& l)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5548 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5549 if (instance_ok ())
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5550 instance->do_execute_listener (h, l);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5551 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5552
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5553 static void execute_callback (const graphics_handle& h,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5554 const std::string& name,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5555 const octave_value& data = Matrix ())
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5556 {
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5557 octave_value cb;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5558
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5559 if (true)
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5560 {
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5561 gh_manager::auto_lock lock;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5562
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5563 graphics_object go = get_object (h);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5564
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5565 if (go.valid_object ())
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5566 cb = go.get (name);
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5567 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5568
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5569 if (! error_state)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5570 execute_callback (h, cb, data);
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5571 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5572
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5573 static void execute_callback (const graphics_handle& h,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5574 const octave_value& cb,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5575 const octave_value& data = Matrix ())
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5576 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5577 if (instance_ok ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5578 instance->do_execute_callback (h, cb, data);
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5579 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5580
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5581 static void post_callback (const graphics_handle& h,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5582 const std::string& name,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5583 const octave_value& data = Matrix ())
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5584 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5585 if (instance_ok ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5586 instance->do_post_callback (h, name, data);
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5587 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5588
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5589 static void post_function (graphics_event::event_fcn fcn, void* data = 0)
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5590 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5591 if (instance_ok ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5592 instance->do_post_function (fcn, data);
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5593 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5594
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5595 static void post_set (const graphics_handle& h, const std::string& name,
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5596 const octave_value& value, bool notify_toolkit = true)
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5597 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5598 if (instance_ok ())
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5599 instance->do_post_set (h, name, value, notify_toolkit);
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5600 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5601
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5602 static int process_events (void)
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5603 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5604 return (instance_ok () ? instance->do_process_events () : 0);
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5605 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5606
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5607 static int flush_events (void)
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5608 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5609 return (instance_ok () ? instance->do_process_events (true) : 0);
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5610 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5611
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5612 static void enable_event_processing (bool enable = true)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5613 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5614 if (instance_ok ())
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5615 instance->do_enable_event_processing (enable);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5616 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5617
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5618 static bool is_handle_visible (const graphics_handle& h)
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5619 {
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5620 bool retval = false;
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5621
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5622 graphics_object go = get_object (h);
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5623
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5624 if (go.valid_object ())
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5625 retval = go.is_handle_visible ();
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5626
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5627 return retval;
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5628 }
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5629
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5630 static void close_all_figures (void)
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5631 {
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5632 if (instance_ok ())
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5633 instance->do_close_all_figures ();
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5634 }
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5635
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5636 public:
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5637 class auto_lock : public octave_autolock
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5638 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5639 public:
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5640 auto_lock (bool wait = true)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5641 : octave_autolock (instance_ok ()
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5642 ? instance->graphics_lock
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5643 : octave_mutex (),
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5644 wait)
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5645 { }
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5646
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5647 private:
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5648
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5649 // No copying!
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5650 auto_lock (const auto_lock&);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5651 auto_lock& operator = (const auto_lock&);
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5652 };
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5653
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5654 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5655
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5656 static gh_manager *instance;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5657
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5658 typedef std::map<graphics_handle, graphics_object>::iterator iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5659 typedef std::map<graphics_handle, graphics_object>::const_iterator const_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5660
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5661 typedef std::set<graphics_handle>::iterator free_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5662 typedef std::set<graphics_handle>::const_iterator const_free_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5663
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5664 typedef std::list<graphics_handle>::iterator figure_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5665 typedef std::list<graphics_handle>::const_iterator const_figure_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5666
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5667 // A map of handles to graphics objects.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5668 std::map<graphics_handle, graphics_object> handle_map;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5669
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5670 // The available graphics handles.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5671 std::set<graphics_handle> handle_free_list;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5672
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5673 // The next handle available if handle_free_list is empty.
7286
c0c6aa5afff4 [project @ 2007-12-11 16:52:56 by jwe]
jwe
parents: 7283
diff changeset
5674 double next_handle;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5675
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5676 // The allocated figure handles. Top of the stack is most recently
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5677 // created.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5678 std::list<graphics_handle> figure_list;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5679
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
5680 // The lock for accessing the graphics sytsem.
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5681 octave_mutex graphics_lock;
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5682
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
5683 // The list of events queued by graphics toolkits.
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5684 std::list<graphics_event> event_queue;
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5685
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
5686 // The stack of callback objects.
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5687 std::list<graphics_object> callback_objects;
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5688
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5689 // A flag telling whether event processing must be constantly on.
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5690 int event_processing;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5691
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5692 graphics_handle do_get_handle (bool integer_figure_handle);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5693
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5694 void do_free (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5695
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5696 void do_renumber_figure (const graphics_handle& old_gh,
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5697 const graphics_handle& new_gh);
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5698
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5699 graphics_handle do_lookup (double val)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5700 {
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
5701 iterator p = (xisnan (val) ? handle_map.end () : handle_map.find (val));
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5702
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5703 return (p != handle_map.end ()) ? p->first : graphics_handle ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5704 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5705
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5706 graphics_object do_get_object (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5707 {
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
5708 iterator p = (h.ok () ? handle_map.find (h) : handle_map.end ());
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5709
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5710 return (p != handle_map.end ()) ? p->second : graphics_object ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5711 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5712
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5713 graphics_handle do_make_graphics_handle (const std::string& go_name,
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5714 const graphics_handle& p,
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5715 bool integer_figure_handle,
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5716 bool do_createfcn,
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5717 bool do_notify_toolkit);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5718
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5719 graphics_handle do_make_figure_handle (double val, bool do_notify_toolkit);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5720
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5721 Matrix do_handle_list (bool show_hidden)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5722 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5723 Matrix retval (1, handle_map.size ());
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5724
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5725 octave_idx_type i = 0;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5726 for (const_iterator p = handle_map.begin (); p != handle_map.end (); p++)
7056
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
5727 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5728 graphics_handle h = p->first;
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5729
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5730 if (show_hidden || is_handle_visible (h))
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5731 retval(i++) = h.value ();
7056
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
5732 }
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5733
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5734 retval.resize (1, i);
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5735
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5736 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5737 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5738
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5739 Matrix do_figure_handle_list (bool show_hidden)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5740 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5741 Matrix retval (1, figure_list.size ());
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5742
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5743 octave_idx_type i = 0;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5744 for (const_figure_list_iterator p = figure_list.begin ();
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5745 p != figure_list.end ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5746 p++)
7056
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
5747 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5748 graphics_handle h = *p;
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5749
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5750 if (show_hidden || is_handle_visible (h))
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5751 retval(i++) = h.value ();
7056
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
5752 }
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5753
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5754 retval.resize (1, i);
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5755
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5756 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5757 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5758
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5759 void do_push_figure (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5760
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5761 void do_pop_figure (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5762
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5763 graphics_handle do_current_figure (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5764 {
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5765 graphics_handle retval;
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5766
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5767 for (const_figure_list_iterator p = figure_list.begin ();
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5768 p != figure_list.end ();
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5769 p++)
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5770 {
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5771 graphics_handle h = *p;
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5772
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5773 if (is_handle_visible (h))
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5774 retval = h;
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5775 }
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5776
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5777 return retval;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5778 }
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5779
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5780 void do_lock (void) { graphics_lock.lock (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
5781
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5782 bool do_try_lock (void) { return graphics_lock.try_lock (); }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5783
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5784 void do_unlock (void) { graphics_lock.unlock (); }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5785
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5786 void do_execute_listener (const graphics_handle& h, const octave_value& l);
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5787
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5788 void do_execute_callback (const graphics_handle& h, const octave_value& cb,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5789 const octave_value& data);
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5790
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5791 void do_post_callback (const graphics_handle& h, const std::string name,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5792 const octave_value& data);
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5793
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5794 void do_post_function (graphics_event::event_fcn fcn, void* fcn_data);
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5795
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5796 void do_post_set (const graphics_handle& h, const std::string name,
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5797 const octave_value& value, bool notify_toolkit = true);
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5798
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5799 int do_process_events (bool force = false);
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5800
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5801 void do_close_all_figures (void);
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5802
9397
394c7adb488f graphics.h.in (gh_manager::restore_gcbo): fix decl for unwind-protect
John W. Eaton <jwe@octave.org>
parents: 9347
diff changeset
5803 static void restore_gcbo (void)
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5804 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5805 if (instance_ok ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5806 instance->do_restore_gcbo ();
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5807 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5808
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5809 void do_restore_gcbo (void);
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5810
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5811 void do_post_event (const graphics_event& e);
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5812
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5813 void do_enable_event_processing (bool enable = true);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5814 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5815
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
5816 void get_children_limits (double& min_val, double& max_val,
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
5817 double& min_pos, double& max_neg,
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
5818 const Matrix& kids, char limit_type);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5819
10917
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10792
diff changeset
5820 OCTINTERP_API int calc_dimensions (const graphics_object& gh);
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10792
diff changeset
5821
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5822 // This function is NOT equivalent to the scripting language function gcf.
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
5823 OCTINTERP_API graphics_handle gcf (void);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5824
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5825 // This function is NOT equivalent to the scripting language function gca.
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
5826 OCTINTERP_API graphics_handle gca (void);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5827
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5828 OCTINTERP_API void close_all_figures (void);
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 13992
diff changeset
5829
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5830 #endif