annotate libinterp/corefcn/graphics.in.h @ 19044:4c59f69fa52c

figure: define adopted axes "currentaxes" if none is defined (bug #41573) * graphics.in.h (figure::properties::adopt): declare new custom method * graphics.cc (figure::properties::adopt): when adopting an axes, define it as currentaxes if none is already defined * graphics.cc: add %! test for currentaxes update
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sat, 23 Aug 2014 16:12:03 +0200
parents 9609f345823e
children 1288a2f27769
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
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17652
diff changeset
3 Copyright (C) 2007-2013 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
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
23 #if !defined (octave_graphics_h)
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
24 #define octave_graphics_h 1
6874
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
6890
b2b7526a5772 [project @ 2007-09-12 20:14:35 by jwe]
jwe
parents: 6874
diff changeset
41 #include "gripes.h"
17544
fc31cd1bd503 extract handle object to a separate file
John W. Eaton <jwe@octave.org>
parents: 17529
diff changeset
42 #include "oct-handle.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
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
49 // FIXME: maybe this should be a configure option?
8944
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
17544
fc31cd1bd503 extract handle object to a separate file
John W. Eaton <jwe@octave.org>
parents: 17529
diff changeset
56 typedef octave_handle graphics_handle;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
57
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
58 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
59
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
60 class base_scaler
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
61 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
62 public:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
63 base_scaler (void) { }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
64
7441
0207ba146089 [project @ 2008-02-03 04:38:58 by jwe]
jwe
parents: 7440
diff changeset
65 virtual ~base_scaler (void) { }
7440
4e3b073e910e [project @ 2008-02-02 18:23:50 by jwe]
jwe
parents: 7439
diff changeset
66
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
67 virtual Matrix scale (const Matrix& m) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
68 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
69 error ("invalid axis scale");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
70 return m;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
71 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
72
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
73 virtual NDArray scale (const NDArray& m) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
74 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
75 error ("invalid axis scale");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
76 return m;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
77 }
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
78
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
79 virtual double scale (double d) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
80 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
81 error ("invalid axis scale");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
82 return d;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
83 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
84
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
85 virtual double unscale (double d) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
86 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
87 error ("invalid axis scale");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
88 return d;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
89 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
90
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
91 virtual base_scaler* clone () const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
92 { 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
93
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
94 virtual bool is_linear (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
95 { return false; }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
96 };
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
97
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
98 class lin_scaler : public base_scaler
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
99 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
100 public:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
101 lin_scaler (void) { }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
102
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
103 Matrix scale (const Matrix& m) const { return m; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
104
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
105 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
106
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
107 double scale (double d) const { return d; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
108
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
109 double unscale (double d) const { return d; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
110
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
111 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
112
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
113 bool is_linear (void) const { return true; }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
114 };
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
115
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
116 class log_scaler : public base_scaler
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
117 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
118 public:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
119 log_scaler (void) { }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
120
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
121 Matrix scale (const Matrix& m) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
122 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
123 Matrix retval (m.rows (), m.cols ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
124
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
125 do_scale (m.data (), retval.fortran_vec (), m.numel ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
126
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
127 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
128 }
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
129
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
130 NDArray scale (const NDArray& m) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
131 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
132 NDArray retval (m.dims ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
133
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
134 do_scale (m.data (), retval.fortran_vec (), m.numel ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
135
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
136 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
137 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
138
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
139 double scale (double d) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
140 { return log10 (d); }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
141
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
142 double unscale (double d) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
143 { return pow (10.0, d); }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
144
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
145 base_scaler* clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
146 { 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
147
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
148 private:
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
149 void do_scale (const double *src, double *dest, int n) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
150 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
151 for (int i = 0; i < n; i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
152 dest[i] = log10 (src[i]);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
153 }
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
154 };
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
155
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
156 class neg_log_scaler : public base_scaler
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
157 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
158 public:
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
159 neg_log_scaler (void) { }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
160
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
161 Matrix scale (const Matrix& m) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
162 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
163 Matrix retval (m.rows (), m.cols ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
164
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
165 do_scale (m.data (), retval.fortran_vec (), m.numel ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
166
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
167 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
168 }
13756
6dfebfa334cb allow negative data log plots with OpenGL+FLTK graphics (bug #34232)
John W. Eaton <jwe@octave.org>
parents: 13722
diff changeset
169
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
170 NDArray scale (const NDArray& m) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
171 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
172 NDArray retval (m.dims ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
173
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
174 do_scale (m.data (), retval.fortran_vec (), m.numel ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
175
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
176 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
177 }
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
178
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
179 double scale (double d) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
180 { return -log10 (-d); }
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
181
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
182 double unscale (double d) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
183 { return -pow (10.0, -d); }
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
184
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
185 base_scaler* clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
186 { return new neg_log_scaler (); }
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
187
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
188 private:
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
189 void do_scale (const double *src, double *dest, int n) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
190 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
191 for (int i = 0; i < n; i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
192 dest[i] = -log10 (-src[i]);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
193 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
194 };
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
195
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
196 class scaler
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 public:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
199 scaler (void) : rep (new base_scaler ()) { }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
200
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
201 scaler (const scaler& s) : rep (s.rep->clone ()) { }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
202
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
203 scaler (const std::string& s)
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
204 : rep (s == "log"
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
205 ? new log_scaler ()
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
206 : (s == "neglog" ? new neg_log_scaler ()
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
207 : (s == "linear" ? new lin_scaler () : new base_scaler ())))
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
208 { }
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
209
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
210 ~scaler (void) { delete rep; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
211
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
212 Matrix scale (const Matrix& m) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
213 { return rep->scale (m); }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
214
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
215 NDArray scale (const NDArray& m) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
216 { return rep->scale (m); }
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
217
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
218 double scale (double d) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
219 { return rep->scale (d); }
7427
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 double unscale (double d) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
222 { return rep->unscale (d); }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
223
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
224 bool is_linear (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
225 { return rep->is_linear (); }
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
226
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
227 scaler& operator = (const scaler& s)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
228 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
229 if (rep)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
230 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
231 delete rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
232 rep = 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
233 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
234
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
235 rep = s.rep->clone ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
236
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
237 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
238 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
239
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
240 scaler& operator = (const std::string& s)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
241 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
242 if (rep)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
243 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
244 delete rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
245 rep = 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
246 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
247
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
248 if (s == "log")
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
249 rep = new log_scaler ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
250 else if (s == "neglog")
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
251 rep = new neg_log_scaler ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
252 else if (s == "linear")
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
253 rep = new lin_scaler ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
254 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
255 rep = new base_scaler ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
256
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
257 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
258 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
259
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
260 private:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
261 base_scaler *rep;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
262 };
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
263
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
264 // ---------------------------------------------------------------------
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
265
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
266 class property;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
267
13924
3b654a0753b1 Implement waitfor, uiwait and uiresume.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13868
diff changeset
268 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
269
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
270 class base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
271 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
272 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
273 friend class property;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
274
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
275 public:
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
276 base_property (void)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
277 : id (-1), count (1), name (), parent (), hidden (), listeners ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
278 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
279
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
280 base_property (const std::string& s, const graphics_handle& h)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
281 : id (-1), count (1), name (s), parent (h), hidden (false), listeners ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
282 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
283
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
284 base_property (const base_property& p)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
285 : id (-1), count (1), name (p.name), parent (p.parent),
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
286 hidden (p.hidden), listeners ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
287 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
288
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
289 virtual ~base_property (void) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
290
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
291 bool ok (void) const { return parent.ok (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
292
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
293 std::string get_name (void) const { return name; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
294
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
295 void set_name (const std::string& s) { name = s; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
296
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
297 graphics_handle get_parent (void) const { return parent; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
298
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
299 void set_parent (const graphics_handle& h) { parent = h; }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
300
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
301 bool is_hidden (void) const { return hidden; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
302
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
303 void set_hidden (bool flag) { hidden = flag; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
304
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
305 virtual bool is_radio (void) const { return false; }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
306
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
307 int get_id (void) const { return id; }
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
308
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
309 void set_id (int d) { id = d; }
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
310
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
311 // Sets property value, notifies graphics toolkit.
8058
ca39c21fa4b8 [mq]: generic_octave_to_backend_nofitication
John W. Eaton <jwe@octave.org>
parents: 8052
diff changeset
312 // If do_run is true, runs associated listeners.
13321
5ea207067ee5 Export base_property::set.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13307
diff changeset
313 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
314 bool do_notify_toolkit = true);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
315
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
316 virtual octave_value get (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
317 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
318 error ("get: invalid property \"%s\"", name.c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
319 return octave_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
320 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
321
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
322
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
323 virtual std::string values_as_string (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
324 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
325 error ("values_as_string: invalid property \"%s\"", name.c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
326 return std::string ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
327 }
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
328
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
329 virtual Cell values_as_cell (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
330 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
331 error ("values_as_cell: invalid property \"%s\"", name.c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
332 return Cell ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
333 }
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
334
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
335 base_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
336 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
337 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
338 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
339 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
340
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
341 void add_listener (const octave_value& v, listener_mode mode = POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
342 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
343 octave_value_list& l = listeners[mode];
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
344 l.resize (l.length () + 1, v);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
345 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
346
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
347 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
348 listener_mode mode = POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
349 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
350 octave_value_list& l = listeners[mode];
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
351
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
352 if (v.is_defined ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
353 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
354 bool found = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
355 int i;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
356
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
357 for (i = 0; i < l.length (); i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
358 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
359 if (v.internal_rep () == l(i).internal_rep ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
360 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
361 found = true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
362 break;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
363 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
364 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
365 if (found)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
366 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
367 for (int j = i; j < l.length () - 1; j++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
368 l(j) = l(j + 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
369
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
370 l.resize (l.length () - 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
371 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
372 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
373 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
374 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
375 if (mode == PERSISTENT)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
376 l.resize (0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
377 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
378 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
379 octave_value_list lnew (0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
380 octave_value_list& lp = listeners[PERSISTENT];
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
381 for (int i = l.length () - 1; i >= 0 ; i--)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
382 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
383 for (int j = 0; j < lp.length (); j++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
384 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
385 if (l(i).internal_rep () == lp(j).internal_rep ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
386 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
387 lnew.resize (lnew.length () + 1, l(i));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
388 break;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
389 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
390 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
391 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
392 l = lnew;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
393 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
394 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
395
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
396 }
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
397
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
398 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
399
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
400 virtual base_property* clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
401 { return new base_property (*this); }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
402
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
403 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
404 virtual bool do_set (const octave_value&)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
405 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
406 error ("set: invalid property \"%s\"", name.c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
407 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
408 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
409
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
410 private:
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
411 typedef std::map<listener_mode, octave_value_list> listener_map;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
412 typedef std::map<listener_mode, octave_value_list>::iterator
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
413 listener_map_iterator;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
414 typedef std::map<listener_mode, octave_value_list>::const_iterator
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
415 listener_map_const_iterator;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
416
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
417 private:
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
418 int id;
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13938
diff changeset
419 octave_refcount<int> count;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
420 std::string name;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
421 graphics_handle parent;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
422 bool hidden;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
423 listener_map listeners;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
424 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
425
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
426 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
427
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
428 class string_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
429 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
430 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
431 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
432 const std::string& val = "")
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
433 : base_property (s, h), str (val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
434
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
435 string_property (const string_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
436 : base_property (p), str (p.str) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
437
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
438 octave_value get (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
439 { return octave_value (str); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
440
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
441 std::string string_value (void) const { return str; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
442
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
443 string_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
444 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
445 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
446 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
447 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
448
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
449 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
450
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
451 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
452 bool do_set (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
453 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
454 if (val.is_string ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
455 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
456 std::string new_str = val.string_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
457
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
458 if (new_str != str)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
459 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
460 str = new_str;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
461 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
462 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
463 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
464 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
465 error ("set: invalid string property value for \"%s\"",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
466 get_name ().c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
467 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
468 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
469
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
470 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
471 std::string str;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
472 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
473
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
474 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
475
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
476 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
477 {
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
478 public:
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
479 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
480
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
481 string_array_property (const std::string& s, const graphics_handle& h,
16890
830f27544bb7 Accept char array inputs for linestyleorder property (bug #34906).
Rik <rik@octave.org>
parents: 16832
diff changeset
482 const std::string& val = "", const char& sep = '|',
830f27544bb7 Accept char array inputs for linestyleorder property (bug #34906).
Rik <rik@octave.org>
parents: 16832
diff changeset
483 const desired_enum& typ = string_t)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
484 : base_property (s, h), desired_type (typ), separator (sep), str ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
485 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
486 size_t pos = 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
487
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
488 while (true)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
489 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
490 size_t new_pos = val.find_first_of (separator, pos);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
491
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
492 if (new_pos == std::string::npos)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
493 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
494 str.append (val.substr (pos));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
495 break;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
496 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
497 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
498 str.append (val.substr (pos, new_pos - pos));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
499
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
500 pos = new_pos + 1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
501 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
502 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
503
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
504 string_array_property (const std::string& s, const graphics_handle& h,
16890
830f27544bb7 Accept char array inputs for linestyleorder property (bug #34906).
Rik <rik@octave.org>
parents: 16832
diff changeset
505 const Cell& c, const char& sep = '|',
830f27544bb7 Accept char array inputs for linestyleorder property (bug #34906).
Rik <rik@octave.org>
parents: 16832
diff changeset
506 const desired_enum& typ = string_t)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
507 : base_property (s, h), desired_type (typ), separator (sep), str ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
508 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
509 if (c.is_cellstr ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
510 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
511 string_vector strings (c.numel ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
512
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
513 for (octave_idx_type i = 0; i < c.numel (); i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
514 strings[i] = c(i).string_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
515
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
516 str = strings;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
517 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
518 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
519 error ("set: invalid order property value for \"%s\"",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
520 get_name ().c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
521 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
522
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
523 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
524 : 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
525 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
526
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
527 octave_value get (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
528 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
529 if (desired_type == string_t)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
530 return octave_value (string_value ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
531 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
532 return octave_value (cell_value ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
533 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
534
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
535 std::string string_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
536 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
537 std::string s;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
538
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
539 for (octave_idx_type i = 0; i < str.length (); i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
540 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
541 s += str[i];
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
542 if (i != str.length () - 1)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
543 s += separator;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
544 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
545
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
546 return s;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
547 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
548
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
549 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
550
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
551 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
552
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
553 string_array_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
554 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
555 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
556 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
557 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
558
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
559 base_property* clone (void) const
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
560 { return new string_array_property (*this); }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
561
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
562 protected:
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
563 bool do_set (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
564 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
565 if (val.is_string () && val.rows () == 1)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
566 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
567 bool replace = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
568 std::string new_str = val.string_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
569 string_vector strings;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
570 size_t pos = 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
571
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
572 // Split single string on delimiter (usually '|')
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
573 while (pos != std::string::npos)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
574 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
575 size_t new_pos = new_str.find_first_of (separator, pos);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
576
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
577 if (new_pos == std::string::npos)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
578 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
579 strings.append (new_str.substr (pos));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
580 break;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
581 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
582 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
583 strings.append (new_str.substr (pos, new_pos - pos));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
584
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
585 pos = new_pos + 1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
586 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
587
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
588 if (str.numel () == strings.numel ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
589 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
590 for (octave_idx_type i = 0; i < str.numel (); i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
591 if (strings[i] != str[i])
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
592 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
593 replace = true;
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
594 break;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
595 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
596 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
597 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
598 replace = true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
599
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
600 desired_type = string_t;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
601
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
602 if (replace)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
603 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
604 str = strings;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
605 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
606 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
607 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
608 else if (val.is_string ()) // multi-row character matrix
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
609 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
610 bool replace = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
611 charMatrix chm = val.char_matrix_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
612 octave_idx_type nel = chm.rows ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
613 string_vector strings (nel);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
614
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
615 if (nel != str.numel ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
616 replace = true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
617 for (octave_idx_type i = 0; i < nel; i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
618 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
619 strings[i] = chm.row_as_string (i);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
620 if (!replace && strings[i] != str[i])
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
621 replace = true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
622 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
623
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
624 desired_type = string_t;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
625
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
626 if (replace)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
627 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
628 str = strings;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
629 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
630 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
631 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
632 else if (val.is_cellstr ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
633 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
634 bool replace = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
635 Cell new_cell = val.cell_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
636
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
637 string_vector strings = new_cell.cellstr_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
638
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
639 octave_idx_type nel = strings.length ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
640
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
641 if (nel != str.length ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
642 replace = true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
643 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
644 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
645 for (octave_idx_type i = 0; i < nel; i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
646 {
10585
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
647 if (strings[i] != str[i])
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
648 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
649 replace = true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
650 break;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
651 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
652 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
653 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
654
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
655 desired_type = cell_t;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
656
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
657 if (replace)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
658 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
659 str = strings;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
660 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
661 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
662 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
663 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
664 error ("set: invalid string property value for \"%s\"",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
665 get_name ().c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
666 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
667 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
668
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
669 private:
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
670 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
671 char separator;
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
672 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
673 };
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
674
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
675 // ---------------------------------------------------------------------
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
676
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
677 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
678 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
679 public:
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
680 enum type { char_t, cellstr_t };
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
681
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
682 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
683 const std::string& val = "")
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
684 : 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
685 { }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
686
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
687 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
688 const NDArray& nda)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
689 : 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
690 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
691 octave_idx_type nel = nda.numel ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
692
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
693 value.resize (nel);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
694
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
695 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
696 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
697 std::ostringstream buf;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
698 buf << nda(i);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
699 value[i] = buf.str ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
700 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
701 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
702
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
703 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
704 const Cell& c)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
705 : 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
706 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
707 octave_idx_type nel = c.numel ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
708
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
709 value.resize (nel);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
710
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
711 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
712 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
713 octave_value tmp = c(i);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
714
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
715 if (tmp.is_string ())
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
716 value[i] = c(i).string_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
717 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
718 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
719 double d = c(i).double_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
720
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
721 if (! error_state)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
722 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
723 std::ostringstream buf;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
724 buf << d;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
725 value[i] = buf.str ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
726 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
727 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
728 break;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
729 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
730 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
731 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
732
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
733 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
734 : 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
735 { }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
736
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
737 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
738 {
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
739 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
740 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
741 }
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
742
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
743 octave_value get (void) const
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
744 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
745 if (stored_type == char_t)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
746 return octave_value (char_value ());
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
747 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
748 return octave_value (cell_value ());
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
749 }
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 std::string string_value (void) const
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
752 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
753 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
754 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
755
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
756 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
757
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
758 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
759
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
760 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
761
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
762 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
763 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
764 set (val);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
765 return *this;
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
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
768 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
769
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
770 protected:
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
771
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
772 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
773 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
774 if (val.is_string ())
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
775 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
776 value = val.all_strings ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
777
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
778 stored_type = char_t;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
779 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
780 else if (val.is_cell ())
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
781 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
782 Cell c = val.cell_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
783
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
784 octave_idx_type nel = c.numel ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
785
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
786 value.resize (nel);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
787
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
788 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
789 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
790 octave_value tmp = c(i);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
791
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
792 if (tmp.is_string ())
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
793 value[i] = c(i).string_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
794 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
795 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
796 double d = c(i).double_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
797
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
798 if (! error_state)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
799 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
800 std::ostringstream buf;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
801 buf << d;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
802 value[i] = buf.str ();
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 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
805 return false;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
806 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
807 }
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
808
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 stored_type = cellstr_t;
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
810 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
811 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
812 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
813 NDArray nda = val.array_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
814
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
815 if (! error_state)
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 octave_idx_type nel = nda.numel ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
818
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
819 value.resize (nel);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
820
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
821 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
822 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
823 std::ostringstream buf;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
824 buf << nda(i);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
825 value[i] = buf.str ();
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 stored_type = char_t;
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 else
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 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
833 get_name ().c_str ());
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
834
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
835 return false;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
836 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
837 }
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 return true;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
840 }
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 private:
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
843 string_vector value;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
844 type stored_type;
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
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
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
849 class radio_values
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
850 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
851 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
852 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
853
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
854 radio_values (const radio_values& a)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
855 : 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
856
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
857 radio_values& operator = (const radio_values& a)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
858 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
859 if (&a != this)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
860 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
861 default_val = a.default_val;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
862 possible_vals = a.possible_vals;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
863 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
864
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
865 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
866 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
867
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
868 std::string default_value (void) const { return default_val; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
869
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
870 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
871 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
872 bool retval = true;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
873
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
874 if (! contains (val, match))
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
875 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
876 error ("invalid value = %s", val.c_str ());
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
877 retval = false;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
878 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
879
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
880 return retval;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
881 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
882
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
883 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
884 {
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
885 size_t k = 0;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
886
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
887 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
888
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
889 std::string first_match;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
890
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
891 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
892 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
893 {
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
894 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
895 {
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
896 if (len == p->length ())
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
897 {
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
898 // 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
899 // "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
900 // "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
901 // 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
902
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
903 match = *p;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
904 return true;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
905 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
906 else
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
907 {
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
908 if (k == 0)
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
909 first_match = *p;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
910
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
911 k++;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
912 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
913 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
914 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
915
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
916 if (k == 1)
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
917 {
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
918 match = first_match;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
919 return true;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
920 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
921 else
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
922 return false;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
923 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
924
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
925 std::string values_as_string (void) const;
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
926
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
927 Cell values_as_cell (void) const;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
928
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
929 octave_idx_type nelem (void) const { return possible_vals.size (); }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
930
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
931 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
932 // Might also want to cache
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
933 std::string default_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
934 std::set<caseless_str> possible_vals;
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 class radio_property : public base_property
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 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
940 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
941 const radio_values& v = radio_values ())
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
942 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
943 vals (v), current_val (v.default_value ()) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
944
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
945 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
946 const std::string& v)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
947 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
948 vals (v), current_val (vals.default_value ()) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
949
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
950 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
951 const radio_values& v, const std::string& def)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
952 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
953 vals (v), current_val (def) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
954
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
955 radio_property (const radio_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
956 : 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
957
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
958 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
959
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
960 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
961
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
962 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
963
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
964 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
965
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
966 bool is (const caseless_str& v) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
967 { return v.compare (current_val); }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
968
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
969 bool is_radio (void) const { return true; }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
970
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
971 radio_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
972 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
973 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
974 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
975 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
976
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
977 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
978
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
979 protected:
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
980 bool do_set (const octave_value& newval)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
981 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
982 if (newval.is_string ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
983 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
984 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
985
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
986 std::string match;
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 (vals.validate (s, match))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
989 {
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
990 if (match != current_val)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
991 {
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
992 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
993 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
994 "%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
995 "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
996 match.c_str ());
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
997 current_val = match;
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
998 return true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
999 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1000 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1001 else
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1002 error ("set: invalid value for radio property \"%s\" (value = %s)",
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1003 get_name ().c_str (), s.c_str ());
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1004 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1005 else
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1006 error ("set: invalid value for radio property \"%s\"",
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1007 get_name ().c_str ());
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1008 return false;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1009 }
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 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1012 radio_values vals;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1013 std::string current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1014 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1015
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1016 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1017
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1018 class color_values
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1019 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1020 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1021 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
1022 : xrgb (1, 3)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1023 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1024 xrgb(0) = r;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1025 xrgb(1) = g;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1026 xrgb(2) = b;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1027
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1028 validate ();
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1029 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1030
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1031 color_values (const std::string& str)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1032 : xrgb (1, 3)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1033 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1034 if (! str2rgb (str))
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1035 error ("invalid color specification: %s", str.c_str ());
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1036 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1037
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1038 color_values (const color_values& c)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1039 : xrgb (c.xrgb)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1040 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1041
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1042 color_values& operator = (const color_values& c)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1043 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1044 if (&c != this)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1045 xrgb = c.xrgb;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1046
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1047 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1048 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1049
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1050 bool operator == (const color_values& c) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1051 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1052 return (xrgb(0) == c.xrgb(0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1053 && xrgb(1) == c.xrgb(1)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1054 && xrgb(2) == c.xrgb(2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1055 }
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1056
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1057 bool operator != (const color_values& c) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1058 { return ! (*this == c); }
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1059
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1060 Matrix rgb (void) const { return xrgb; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1061
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1062 operator octave_value (void) const { return xrgb; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1063
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1064 void validate (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1065 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1066 for (int i = 0; i < 3; i++)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1067 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1068 if (xrgb(i) < 0 || xrgb(i) > 1)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1069 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1070 error ("invalid RGB color specification");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1071 break;
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 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1074 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1075
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1076 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1077 Matrix xrgb;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1078
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1079 OCTINTERP_API bool str2rgb (const std::string& str);
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1080 };
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 class color_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1083 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1084 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1085 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
1086 : base_property ("", graphics_handle ()),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1087 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
1088 current_val (v.default_value ())
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
17645
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
1091 color_property (const radio_values& v, const color_values& c)
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
1092 : base_property ("", graphics_handle ()),
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
1093 current_type (radio_t), color_val (c), radio_val (v),
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
1094 current_val (v.default_value ())
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
1095 { }
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
1096
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1097 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
1098 const color_values& c = color_values (),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1099 const radio_values& v = radio_values ())
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1100 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1101 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
1102 current_val (v.default_value ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1103 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1104
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1105 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
1106 const radio_values& v)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1107 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1108 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
1109 current_val (v.default_value ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1110 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1111
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1112 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
1113 const std::string& v)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1114 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1115 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
1116 current_val (radio_val.default_value ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1117 { }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1118
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1119 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
1120 const color_property& v)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1121 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1122 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
1123 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
1124 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1125
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1126 color_property (const color_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1127 : base_property (p), current_type (p.current_type),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1128 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
1129 current_val (p.current_val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1130
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1131 octave_value get (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1132 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1133 if (current_type == color_t)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1134 return color_val.rgb ();
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 return current_val;
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
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1139 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
1140
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1141 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
1142
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1143 bool is (const std::string& v) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1144 { return (is_radio () && current_val == v); }
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 Matrix rgb (void) const
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 if (current_type != color_t)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1149 error ("color has no rgb value");
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 return color_val.rgb ();
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 const std::string& current_value (void) const
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 if (current_type != radio_t)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1157 error ("color has no radio value");
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1158
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1159 return current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1160 }
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 color_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1163 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1164 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1165 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1166 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1167
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1168 operator octave_value (void) const { return get (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1169
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1170 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
1171
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1172 std::string values_as_string (void) const
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1173 { return radio_val.values_as_string (); }
10724
f0236b444356 Allow set(h) to work if the handle includes color properties
David Bateman <dbateman@free.fr>
parents: 10722
diff changeset
1174
f0236b444356 Allow set(h) to work if the handle includes color properties
David Bateman <dbateman@free.fr>
parents: 10722
diff changeset
1175 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
1176
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1177 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1178 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
1179
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1180 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1181 enum current_enum { color_t, radio_t } current_type;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1182 color_values color_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1183 radio_values radio_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1184 std::string current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1185 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1186
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1187 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1188
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1189 class double_property : public base_property
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 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1192 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
1193 double d = 0)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1194 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1195 current_val (d) { }
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 double_property (const double_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1198 : base_property (p), current_val (p.current_val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1199
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1200 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
1201
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1202 double double_value (void) const { 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 double_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1205 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1206 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1207 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1208 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1209
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1210 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
1211
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1212 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1213 bool do_set (const octave_value& v)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1214 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1215 if (v.is_scalar_type () && v.is_real_type ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1216 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1217 double new_val = v.double_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1218
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1219 if (new_val != current_val)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1220 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1221 current_val = new_val;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1222 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1223 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1224 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1225 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1226 error ("set: invalid value for double property \"%s\"",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1227 get_name ().c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1228 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1229 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1230
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1231 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1232 double current_val;
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
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1235 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1236
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1237 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
1238 {
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1239 public:
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1240 double_radio_property (double d, const radio_values& v)
17652
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
1241 : base_property ("", graphics_handle ()),
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
1242 current_type (double_t), dval (d), radio_val (v),
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
1243 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
1244 { }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1245
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1246 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
1247 const std::string& v)
17652
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
1248 : base_property (nm, h),
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
1249 current_type (radio_t), dval (0), radio_val (v),
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
1250 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
1251 { }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1252
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1253 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
1254 const double_radio_property& v)
17652
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
1255 : base_property (nm, h),
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
1256 current_type (v.current_type), dval (v.dval),
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
1257 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
1258 { }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1259
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1260 double_radio_property (const double_radio_property& p)
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1261 : base_property (p), current_type (p.current_type),
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1262 dval (p.dval), radio_val (p.radio_val),
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1263 current_val (p.current_val) { }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1264
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1265 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
1266 {
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1267 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
1268 return dval;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1269
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1270 return current_val;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1271 }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1272
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1273 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
1274
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1275 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
1276
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1277 bool is (const std::string& v) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1278 { return (is_radio () && current_val == v); }
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1279
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1280 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
1281 {
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1282 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
1283 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
1284
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1285 return dval;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1286 }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1287
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1288 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
1289 {
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1290 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
1291 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
1292
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1293 return current_val;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1294 }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1295
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1296 double_radio_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1297 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1298 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1299 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1300 }
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1301
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1302 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
1303
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1304 base_property* clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1305 { return new double_radio_property (*this); }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1306
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1307 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1308 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
1309
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1310 private:
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1311 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
1312 double dval;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1313 radio_values radio_val;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1314 std::string current_val;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1315 };
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
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1319 class array_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1320 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1321 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
1322 array_property (void)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1323 : 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
1324 xmin (), xmax (), xminp (), xmaxp (),
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1325 type_constraints (), size_constraints ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1326 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1327 get_data_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1328 }
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
1329
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1330 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
1331 const octave_value& m)
15783
d61b92690820 coerce plot array and vector properties to full
John W. Eaton <jwe@octave.org>
parents: 15519
diff changeset
1332 : base_property (nm, h), data (m.is_sparse_type () ? m.full_value () : m),
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1333 xmin (), xmax (), xminp (), xmaxp (),
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1334 type_constraints (), size_constraints ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1335 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1336 get_data_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1337 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1338
7848
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
1339 // 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
1340 // 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
1341 // copy constraints.
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
1342 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
1343 : 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
1344 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
1345 type_constraints (), size_constraints ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1346 { }
7848
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
1347
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1348 octave_value get (void) const { return data; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1349
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1350 void add_constraint (const std::string& type)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1351 { type_constraints.insert (type); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1352
7524
a653856aa3e1 array_value::add_constraint: pass dim_vector as const reference, not value
John W. Eaton <jwe@octave.org>
parents: 7523
diff changeset
1353 void add_constraint (const dim_vector& dims)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1354 { size_constraints.push_back (dims); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1355
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
1356 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
1357 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
1358 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
1359 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
1360
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1361 Matrix get_limits (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1362 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1363 Matrix m (1, 4);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1364
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1365 m(0) = min_val ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1366 m(1) = max_val ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1367 m(2) = min_pos ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1368 m(3) = max_neg ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1369
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1370 return m;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1371 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1372
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1373 array_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1374 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1375 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1376 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1377 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1378
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1379 base_property* clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1380 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1381 array_property *p = new array_property (*this);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1382
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1383 p->type_constraints = type_constraints;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1384 p->size_constraints = size_constraints;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1385
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1386 return p;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1387 }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1388
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1389 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1390 bool do_set (const octave_value& v)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1391 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1392 octave_value tmp = v.is_sparse_type () ? v.full_value () : v;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1393
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1394 if (validate (tmp))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1395 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1396 // FIXME: should we check for actual data change?
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1397 if (! is_equal (tmp))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1398 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1399 data = tmp;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1400
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1401 get_data_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1402
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1403 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1404 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1405 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1406 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1407 error ("invalid value for array property \"%s\"",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1408 get_name ().c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1409
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1410 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1411 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1412
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1413 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1414 OCTINTERP_API bool validate (const octave_value& v);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1415
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1416 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
1417
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
1418 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
1419
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1420 protected:
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1421 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
1422 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
1423 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
1424 double xminp;
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1425 double xmaxp;
15069
7a3957ca99c3 Handle complex arguments in imagesc (bug #36866)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14861
diff changeset
1426 std::set<std::string> type_constraints;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1427 std::list<dim_vector> size_constraints;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1428 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1429
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1430 class row_vector_property : public array_property
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1431 {
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1432 public:
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1433 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
1434 const octave_value& m)
7527
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1435 : array_property (nm, h, m)
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1436 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1437 add_constraint (dim_vector (-1, 1));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1438 add_constraint (dim_vector (1, -1));
17631
94dd9bba06a0 Fix validation of array properties to set(), avoid segfaults (bug #bug #35687).
Rik <rik@octave.org>
parents: 17625
diff changeset
1439 add_constraint (dim_vector (0, 0));
7527
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1440 }
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1441
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1442 row_vector_property (const row_vector_property& p)
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1443 : array_property (p)
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1444 {
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1445 add_constraint (dim_vector (-1, 1));
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1446 add_constraint (dim_vector (1, -1));
17631
94dd9bba06a0 Fix validation of array properties to set(), avoid segfaults (bug #bug #35687).
Rik <rik@octave.org>
parents: 17625
diff changeset
1447 add_constraint (dim_vector (0, 0));
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1448 }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1449
7527
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1450 void add_constraint (const std::string& type)
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1451 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1452 array_property::add_constraint (type);
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1453 }
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1454
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1455 void add_constraint (const dim_vector& dims)
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1456 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1457 array_property::add_constraint (dims);
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1458 }
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1459
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1460 void add_constraint (octave_idx_type len)
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1461 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1462 size_constraints.remove (dim_vector (1, -1));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1463 size_constraints.remove (dim_vector (-1, 1));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1464
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1465 add_constraint (dim_vector (1, len));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1466 add_constraint (dim_vector (len, 1));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1467 }
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1468
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1469 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
1470 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1471 set (val);
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1472 return *this;
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1473 }
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1474
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1475 base_property* clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1476 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1477 row_vector_property *p = new row_vector_property (*this);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1478
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1479 p->type_constraints = type_constraints;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1480 p->size_constraints = size_constraints;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1481
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1482 return p;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1483 }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1484
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1485 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1486 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
1487 {
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1488 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
1489
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1490 if (! error_state)
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1491 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1492 dim_vector dv = data.dims ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1493
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1494 if (dv(0) > 1 && dv(1) == 1)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1495 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1496 int tmp = dv(0);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1497 dv(0) = dv(1);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1498 dv(1) = tmp;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1499
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1500 data = data.reshape (dv);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1501 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1502
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1503 return retval;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1504 }
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1505
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1506 return false;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1507 }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1508
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1509 private:
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1510 OCTINTERP_API bool validate (const octave_value& v);
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1511 };
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1512
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1513 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1514
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1515 class bool_property : public radio_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1516 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1517 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1518 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
1519 bool val)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1520 : radio_property (nm, h, radio_values (val ? "{on}|off" : "on|{off}"))
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1521 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1522
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1523 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
1524 const char* val)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1525 : radio_property (nm, h, radio_values ("on|off"), val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1526 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1527
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1528 bool_property (const bool_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1529 : radio_property (p) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1530
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1531 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
1532
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1533 bool_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1534 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1535 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1536 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1537 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1538
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1539 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
1540
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1541 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1542 bool do_set (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1543 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1544 if (val.is_bool_scalar ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1545 return radio_property::do_set (val.bool_value () ? "on" : "off");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1546 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1547 return radio_property::do_set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1548 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1549 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1550
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1551 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1552
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1553 class handle_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1554 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1555 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1556 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
1557 const graphics_handle& val = graphics_handle ())
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1558 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1559 current_val (val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1560
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1561 handle_property (const handle_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1562 : base_property (p), current_val (p.current_val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1563
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1564 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
1565
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1566 graphics_handle handle_value (void) const { return current_val; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1567
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1568 handle_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1569 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1570 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1571 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1572 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1573
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1574 handle_property& operator = (const graphics_handle& h)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1575 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1576 set (octave_value (h.value ()));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1577 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1578 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1579
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1580 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
1581
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1582 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1583 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
1584
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1585 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1586 graphics_handle current_val;
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 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1590
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1591 class any_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1592 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1593 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1594 any_property (const std::string& nm, const graphics_handle& h,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1595 const octave_value& m = Matrix ())
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1596 : base_property (nm, h), data (m) { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1597
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1598 any_property (const any_property& p)
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1599 : base_property (p), data (p.data) { }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1600
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1601 octave_value get (void) const { return data; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1602
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1603 any_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1604 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1605 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1606 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1607 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1608
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1609 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
1610
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1611 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1612 bool do_set (const octave_value& v)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1613 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1614 data = v;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1615 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1616 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1617
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1618 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1619 octave_value data;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1620 };
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 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1623
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1624 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
1625 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1626 public:
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1627 children_property (void)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1628 : base_property ("", graphics_handle ()), children_list ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1629 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1630 do_init_children (Matrix ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1631 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1632
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1633 children_property (const std::string& nm, const graphics_handle& h,
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1634 const Matrix& val)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1635 : base_property (nm, h), children_list ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1636 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1637 do_init_children (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1638 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1639
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1640 children_property (const children_property& p)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1641 : base_property (p), children_list ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1642 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1643 do_init_children (p.children_list);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1644 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1645
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1646 children_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1647 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1648 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1649 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1650 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1651
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1652 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
1653
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1654 bool remove_child (double val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1655 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1656 return do_remove_child (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1657 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1658
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1659 void adopt (double val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1660 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1661 do_adopt_child (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1662 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1663
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1664 Matrix get_children (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1665 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1666 return do_get_children (false);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1667 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1668
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1669 Matrix get_hidden (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1670 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1671 return do_get_children (true);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1672 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1673
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1674 Matrix get_all (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1675 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1676 return do_get_all_children ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1677 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1678
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1679 octave_value get (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1680 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1681 return octave_value (get_children ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1682 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1683
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1684 void delete_children (bool clear = false)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1685 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1686 do_delete_children (clear);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1687 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1688
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1689 void renumber (graphics_handle old_gh, graphics_handle new_gh)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1690 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1691 for (children_list_iterator p = children_list.begin ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1692 p != children_list.end (); p++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1693 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1694 if (*p == old_gh)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1695 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1696 *p = new_gh.value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1697 return;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1698 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1699 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1700
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1701 error ("children_list::renumber: child not found!");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1702 }
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1703
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1704 private:
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1705 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
1706 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
1707 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
1708
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1709 protected:
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1710 bool do_set (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1711 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1712 const Matrix new_kids = val.matrix_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1713
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1714 octave_idx_type nel = new_kids.numel ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1715
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1716 const Matrix new_kids_column = new_kids.reshape (dim_vector (nel, 1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1717
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1718 bool is_ok = true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1719
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1720 if (! error_state)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1721 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1722 const Matrix visible_kids = do_get_children (false);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1723
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1724 if (visible_kids.numel () == new_kids.numel ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1725 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1726 Matrix t1 = visible_kids.sort ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1727 Matrix t2 = new_kids_column.sort ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1728
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1729 if (t1 != t2)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1730 is_ok = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1731 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1732 else
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1733 is_ok = false;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1734
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1735 if (! is_ok)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1736 error ("set: new children must be a permutation of existing children");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1737 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1738 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1739 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1740 is_ok = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1741 error ("set: expecting children to be array of graphics handles");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1742 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1743
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1744 if (is_ok)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1745 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1746 Matrix tmp = new_kids_column.stack (get_hidden ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1747
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1748 children_list.clear ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1749
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1750 // Don't use do_init_children here, as that reverses the
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1751 // order of the list, and we don't want to do that if setting
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1752 // the child list directly.
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1753
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1754 for (octave_idx_type i = 0; i < tmp.numel (); i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1755 children_list.push_back (tmp.xelem (i));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1756 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1757
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1758 return is_ok;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1759 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1760
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1761 private:
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1762 void do_init_children (const Matrix& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1763 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1764 children_list.clear ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1765 for (octave_idx_type i = 0; i < val.numel (); i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1766 children_list.push_front (val.xelem (i));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1767 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1768
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1769 void do_init_children (const std::list<double>& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1770 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1771 children_list.clear ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1772 for (const_children_list_iterator p = val.begin (); p != val.end (); p++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1773 children_list.push_front (*p);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1774 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1775
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1776 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
1777
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1778 Matrix do_get_all_children (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1779 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1780 Matrix retval (children_list.size (), 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1781 octave_idx_type i = 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1782
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1783 for (const_children_list_iterator p = children_list.begin ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1784 p != children_list.end (); p++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1785 retval(i++) = *p;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1786 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1787 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1788
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1789 bool do_remove_child (double child)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1790 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1791 for (children_list_iterator p = children_list.begin ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1792 p != children_list.end (); p++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1793 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1794 if (*p == child)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1795 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1796 children_list.erase (p);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1797 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1798 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1799 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1800 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1801 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1802
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1803 void do_adopt_child (double val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1804 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1805 children_list.push_front (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1806 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1807
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1808 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
1809 };
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1810
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1811
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1812
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1813 // ---------------------------------------------------------------------
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1814
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1815 class callback_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1816 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1817 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1818 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
1819 const octave_value& m)
13323
de081abd32c6 don't execute graphics handle callback functions recursively
John W. Eaton <jwe@octave.org>
parents: 13321
diff changeset
1820 : base_property (nm, h), callback (m), executing (false) { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1821
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1822 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
1823 : base_property (p), callback (p.callback), executing (false) { }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1824
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1825 octave_value get (void) const { return callback; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1826
7367
600808df131c [project @ 2008-01-14 08:58:02 by jwe]
jwe
parents: 7366
diff changeset
1827 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
1828
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10505
diff changeset
1829 bool is_defined (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1830 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1831 return (callback.is_defined () && ! callback.is_empty ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1832 }
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10505
diff changeset
1833
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1834 callback_property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1835 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1836 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1837 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1838 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1839
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1840 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
1841
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1842 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1843 bool do_set (const octave_value& v)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1844 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1845 if (validate (v))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1846 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1847 callback = v;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1848 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1849 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1850 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1851 error ("invalid value for callback property \"%s\"",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1852 get_name ().c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1853 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1854 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1855
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1856 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1857 OCTINTERP_API bool validate (const octave_value& v) const;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1858
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1859 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1860 octave_value callback;
13323
de081abd32c6 don't execute graphics handle callback functions recursively
John W. Eaton <jwe@octave.org>
parents: 13321
diff changeset
1861
de081abd32c6 don't execute graphics handle callback functions recursively
John W. Eaton <jwe@octave.org>
parents: 13321
diff changeset
1862 // 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
1863 mutable bool executing;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1864 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1865
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1866 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1867
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1868 class property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1869 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1870 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1871 property (void) : rep (new base_property ("", graphics_handle ()))
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1872 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1873
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1874 property (base_property *bp, bool persist = false) : rep (bp)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1875 { if (persist) rep->count++; }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1876
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1877 property (const property& p) : rep (p.rep)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1878 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1879 rep->count++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1880 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1881
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1882 ~property (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1883 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1884 if (--rep->count == 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1885 delete rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1886 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1887
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1888 bool ok (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1889 { return rep->ok (); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1890
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1891 std::string get_name (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1892 { return rep->get_name (); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1893
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1894 void set_name (const std::string& name)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1895 { rep->set_name (name); }
7363
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 graphics_handle get_parent (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1898 { return rep->get_parent (); }
7363
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 void set_parent (const graphics_handle& h)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1901 { rep->set_parent (h); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1902
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1903 bool is_hidden (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1904 { return rep->is_hidden (); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1905
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1906 void set_hidden (bool flag)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1907 { rep->set_hidden (flag); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1908
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1909 bool is_radio (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1910 { return rep->is_radio (); }
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1911
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1912 int get_id (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1913 { return rep->get_id (); }
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1914
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1915 void set_id (int d)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1916 { rep->set_id (d); }
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1917
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1918 octave_value get (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1919 { return rep->get (); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1920
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
1921 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
1922 bool do_notify_toolkit = true)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1923 { 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
1924
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1925 std::string values_as_string (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1926 { return rep->values_as_string (); }
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1927
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1928 Cell values_as_cell (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1929 { return rep->values_as_cell (); }
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1930
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1931 property& operator = (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1932 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1933 *rep = val;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1934 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1935 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1936
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1937 property& operator = (const property& p)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1938 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1939 if (rep && --rep->count == 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1940 delete rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1941
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1942 rep = p.rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1943 rep->count++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1944
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1945 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1946 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1947
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1948 void add_listener (const octave_value& v, listener_mode mode = POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1949 { rep->add_listener (v, mode); }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1950
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1951 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
1952 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
1953 { 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
1954
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1955 void run_listeners (listener_mode mode = POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1956 { rep->run_listeners (mode); }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1957
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1958 OCTINTERP_API static
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1959 property create (const std::string& name, const graphics_handle& parent,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1960 const caseless_str& type,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1961 const octave_value_list& args);
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1962
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1963 property clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1964 { return property (rep->clone ()); }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1965
7363
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 const string_property& as_string_property (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1968 { return *(dynamic_cast<string_property*> (rep)); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1969
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1970 const radio_property& as_radio_property (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1971 { return *(dynamic_cast<radio_property*> (rep)); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1972
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1973 const color_property& as_color_property (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1974 { return *(dynamic_cast<color_property*> (rep)); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1975
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1976 const double_property& as_double_property (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1977 { return *(dynamic_cast<double_property*> (rep)); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1978
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1979 const bool_property& as_bool_property (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1980 { return *(dynamic_cast<bool_property*> (rep)); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1981
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1982 const handle_property& as_handle_property (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1983 { return *(dynamic_cast<handle_property*> (rep)); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1984 */
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1985
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1986 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1987 base_property *rep;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1988 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1989
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1990 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1991
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1992 class property_list
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 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1995 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
1996 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
1997
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1998 typedef pval_map_type::iterator pval_map_iterator;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1999 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
2000
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2001 typedef plist_map_type::iterator plist_map_iterator;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2002 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
2003
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2004 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
2005 : plist_map (m) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2006
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2007 ~property_list (void) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2008
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2009 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
2010
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2011 octave_value lookup (const caseless_str& name) const;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2012
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2013 plist_map_iterator begin (void) { return plist_map.begin (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2014 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
2015
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2016 plist_map_iterator end (void) { return plist_map.end (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2017 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
2018
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2019 plist_map_iterator find (const std::string& go_name)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2020 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2021 return plist_map.find (go_name);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2022 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2023
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2024 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
2025 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2026 return plist_map.find (go_name);
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
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
2029 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
2030
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2031 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2032 plist_map_type plist_map;
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
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2035 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2036
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2037 class graphics_toolkit;
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2038 class graphics_object;
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2039
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2040 class base_graphics_toolkit
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2041 {
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2042 public:
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2043 friend class graphics_toolkit;
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2044
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2045 public:
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2046 base_graphics_toolkit (const std::string& nm)
17652
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
2047 : name (nm), count (0) { }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2048
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2049 virtual ~base_graphics_toolkit (void) { }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2050
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2051 std::string get_name (void) const { return name; }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2052
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2053 virtual bool is_valid (void) const { return false; }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2054
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2055 virtual void redraw_figure (const graphics_object&) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2056 { gripe_invalid ("redraw_figure"); }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2057
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2058 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
2059 const std::string&, bool,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2060 const std::string& = "") const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2061 { gripe_invalid ("print_figure"); }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2062
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2063 virtual Matrix get_canvas_size (const graphics_handle&) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2064 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2065 gripe_invalid ("get_canvas_size");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2066 return Matrix (1, 2, 0.0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2067 }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2068
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
2069 virtual double get_screen_resolution (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2070 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2071 gripe_invalid ("get_screen_resolution");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2072 return 72.0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2073 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2074
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
2075 virtual Matrix get_screen_size (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2076 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2077 gripe_invalid ("get_screen_size");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2078 return Matrix (1, 2, 0.0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2079 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
2080
10974
c6dc5f666695 update comments for base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10973
diff changeset
2081 // Callback function executed when the given graphics object
11577
b124b83e5626 fix typo
John W. Eaton <jwe@octave.org>
parents: 11576
diff changeset
2082 // 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
2083 // changes if needed.
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2084 virtual void update (const graphics_object&, int)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2085 { 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
2086
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2087 void update (const graphics_handle&, int);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2088
10974
c6dc5f666695 update comments for base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10973
diff changeset
2089 // 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
2090 // 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
2091 // 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
2092 virtual bool initialize (const graphics_object&)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2093 { gripe_invalid ("base_graphics_toolkit::initialize"); return false; }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2094
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2095 bool initialize (const graphics_handle&);
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2096
10974
c6dc5f666695 update comments for base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10973
diff changeset
2097 // 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
2098 // 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
2099 // 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
2100 virtual void finalize (const graphics_object&)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2101 { 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
2102
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2103 void finalize (const graphics_handle&);
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2104
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
2105 // 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
2106 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
2107 { 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
2108
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2109 private:
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2110 std::string name;
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13938
diff changeset
2111 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
2112
68550ad9ee9c Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7824
diff changeset
2113 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
2114 void gripe_invalid (const std::string& fname) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2115 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2116 if (! is_valid ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2117 error ("%s: invalid graphics toolkit", fname.c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2118 }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2119 };
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2120
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2121 class graphics_toolkit
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2122 {
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2123 public:
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2124 graphics_toolkit (void)
17652
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
2125 : rep (new base_graphics_toolkit ("unknown"))
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2126 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2127 rep->count++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2128 }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2129
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2130 graphics_toolkit (base_graphics_toolkit* b)
17652
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
2131 : rep (b)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2132 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2133 rep->count++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2134 }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2135
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2136 graphics_toolkit (const graphics_toolkit& b)
17652
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
2137 : rep (b.rep)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2138 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2139 rep->count++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2140 }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2141
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2142 ~graphics_toolkit (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2143 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2144 if (--rep->count == 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2145 delete rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2146 }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2147
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2148 graphics_toolkit& operator = (const graphics_toolkit& b)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2149 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2150 if (rep != b.rep)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2151 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2152 if (--rep->count == 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2153 delete rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2154
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2155 rep = b.rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2156 rep->count++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2157 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2158
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2159 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2160 }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2161
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2162 operator bool (void) const { return rep->is_valid (); }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2163
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2164 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
2165
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2166 void redraw_figure (const graphics_object& go) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2167 { rep->redraw_figure (go); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2168
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
2169 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
2170 const std::string& file, bool mono,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2171 const std::string& debug_file = "") const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2172 { 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
2173
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2174 Matrix get_canvas_size (const graphics_handle& fh) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2175 { return rep->get_canvas_size (fh); }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2176
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
2177 double get_screen_resolution (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2178 { return rep->get_screen_resolution (); }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
2179
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
2180 Matrix get_screen_size (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2181 { return rep->get_screen_size (); }
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
2182
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2183 // 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
2184 void update (const graphics_object& go, int id)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2185 { rep->update (go, id); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2186
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2187 void update (const graphics_handle& h, int id)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2188 { rep->update (h, id); }
8058
ca39c21fa4b8 [mq]: generic_octave_to_backend_nofitication
John W. Eaton <jwe@octave.org>
parents: 8052
diff changeset
2189
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2190 // 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
2191 bool initialize (const graphics_object& go)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2192 { return rep->initialize (go); }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2193
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2194 bool initialize (const graphics_handle& h)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2195 { return rep->initialize (h); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2196
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2197 // 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
2198 // 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
2199 // 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
2200 void finalize (const graphics_object& go)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2201 { rep->finalize (go); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2202
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10949
diff changeset
2203 void finalize (const graphics_handle& h)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2204 { rep->finalize (h); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2205
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
2206 // 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
2207 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
2208
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2209 private:
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2210
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2211 base_graphics_toolkit *rep;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2212 };
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2213
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2214 class gtk_manager
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2215 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2216 public:
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2217
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2218 static graphics_toolkit get_toolkit (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2219 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2220 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
2221 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2222
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2223 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
2224 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2225 if (instance_ok ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2226 instance->do_register_toolkit (name);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2227 }
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2228
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2229 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
2230 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2231 if (instance_ok ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2232 instance->do_unregister_toolkit (name);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2233 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2234
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2235 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
2236 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2237 if (instance_ok ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2238 instance->do_load_toolkit (tk);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2239 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2240
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2241 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
2242 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2243 if (instance_ok ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2244 instance->do_unload_toolkit (name);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2245 }
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2246
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2247 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
2248 {
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2249 return instance_ok ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2250 ? instance->do_find_toolkit (name) : graphics_toolkit ();
7439
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
2251 }
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
2252
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2253 static Cell available_toolkits_list (void)
7835
ca8b97bb952c added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2254 {
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2255 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
2256 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2257
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2258 static Cell loaded_toolkits_list (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2259 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2260 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
2261 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2262
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2263 static void unload_all_toolkits (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2264 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2265 if (instance_ok ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2266 instance->do_unload_all_toolkits ();
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2267 }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2268
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2269 static std::string default_toolkit (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2270 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2271 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
2272 }
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 private:
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2275
18557
ca1648b2e673 set default toolkit when registering toolkits (bug #41665).
Michael C. Grant <mcg@cvxr.com> and John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
2276 gtk_manager (void) { }
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2277
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2278 ~gtk_manager (void) { }
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2279
14281
b4d7de953066 Export more required symbols [Win32].
Michael Goffioul <michael.goffioul@gmail.com>
parents: 14257
diff changeset
2280 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
2281
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2282 static bool instance_ok (void)
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 bool retval = true;
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)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2287 create_instance ();
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2288
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2289 if (! instance)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2290 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2291 ::error ("unable to create gh_manager!");
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2292
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2293 retval = false;
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 return retval;
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
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2299 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
2300
14281
b4d7de953066 Export more required symbols [Win32].
Michael Goffioul <michael.goffioul@gmail.com>
parents: 14257
diff changeset
2301 OCTINTERP_API static gtk_manager *instance;
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2302
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2303 // The name of the default toolkit.
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2304 std::string dtk;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2305
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2306 // 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
2307 std::set<std::string> available_toolkits;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2308
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2309 // 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
2310 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
2311
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2312 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
2313
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2314 typedef std::set<std::string>::const_iterator
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2315 const_available_toolkits_iterator;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2316
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2317 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
2318 loaded_toolkits_iterator;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2319
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2320 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
2321 const_loaded_toolkits_iterator;
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 graphics_toolkit do_get_toolkit (void) const;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2324
18557
ca1648b2e673 set default toolkit when registering toolkits (bug #41665).
Michael C. Grant <mcg@cvxr.com> and John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
2325 void do_register_toolkit (const std::string& name);
ca1648b2e673 set default toolkit when registering toolkits (bug #41665).
Michael C. Grant <mcg@cvxr.com> and John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
2326
ca1648b2e673 set default toolkit when registering toolkits (bug #41665).
Michael C. Grant <mcg@cvxr.com> and John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
2327 void do_unregister_toolkit (const std::string& name);
14021
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 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
2330 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2331 loaded_toolkits[tk.get_name ()] = tk;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2332 }
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 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
2335 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2336 loaded_toolkits.erase (name);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2337 }
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 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
2340 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2341 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
2342
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2343 if (p != loaded_toolkits.end ())
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2344 return p->second;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2345 else
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2346 return graphics_toolkit ();
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
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2349 Cell do_available_toolkits_list (void) const
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2350 {
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2351 Cell m (1 , available_toolkits.size ());
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2352
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2353 octave_idx_type i = 0;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2354 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
2355 p != available_toolkits.end (); p++)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2356 m(i++) = *p;
7835
ca8b97bb952c added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2357
ca8b97bb952c added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2358 return m;
ca8b97bb952c added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2359 }
ca8b97bb952c added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2360
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2361 Cell do_loaded_toolkits_list (void) const
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 Cell m (1 , loaded_toolkits.size ());
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2364
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2365 octave_idx_type i = 0;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2366 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
2367 p != loaded_toolkits.end (); p++)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2368 m(i++) = p->first;
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 return m;
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2371 }
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 void do_unload_all_toolkits (void)
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2374 {
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2375 while (! loaded_toolkits.empty ())
14016
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2376 {
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2377 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
2378
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2379 std::string name = p->first;
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2380
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2381 p->second.close ();
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2382
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2383 // 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
2384 // it here.
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2385 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
2386 unload_toolkit (name);
14016
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2387 }
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2388 }
8feb25ecddaf close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
2389
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
2390 std::string do_default_toolkit (void) { return dtk; }
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2391 };
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2392
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2393 // ---------------------------------------------------------------------
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2394
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2395 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
2396 class graphics_object;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2397
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
2398 class OCTINTERP_API base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2399 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2400 public:
7176
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
2401 base_properties (const std::string& ty = "unknown",
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2402 const graphics_handle& mh = graphics_handle (),
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2403 const graphics_handle& p = graphics_handle ());
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2404
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2405 virtual ~base_properties (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2406
17625
bd1dd30ed202 graphics.in.h: Correct bad spelling of "unknown" in graphics_object_name().
Rik <rik@octave.org>
parents: 17544
diff changeset
2407 virtual std::string graphics_object_name (void) const { return "unknown"; }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2408
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2409 void mark_modified (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2410
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2411 void override_defaults (base_graphics_object& obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2412
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2413 virtual void init_integerhandle (const octave_value&)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2414 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2415 panic_impossible ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2416 }
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2417
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2418 // Look through DEFAULTS for properties with given CLASS_NAME, and
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2419 // apply them to the current object with set (virtual method).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2420
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2421 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
2422
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2423 void insert_property (const std::string& name, property p)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2424 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2425 p.set_name (name);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2426 p.set_parent (__myhandle__);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2427 all_props[name] = p;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2428 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2429
9972
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2430 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
2431
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2432 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
2433
9616
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2434 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
2435 {
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2436 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
2437 }
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2438
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2439 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
2440 {
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2441 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
2442 }
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2443
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
2444 virtual octave_value get (bool all = false) const;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2445
9185
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2446 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
2447
9585
06b8b51dca48 also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents: 9582
diff changeset
2448 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
2449 {
06b8b51dca48 also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents: 9582
diff changeset
2450 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
2451 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
2452 }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2453
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2454 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
2455
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2456 virtual void remove_child (const graphics_handle& h)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2457 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2458 if (children.remove_child (h.value ()))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2459 mark_modified ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2460 }
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2461
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2462 virtual void adopt (const graphics_handle& h)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2463 {
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2464 children.adopt (h.value ());
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
2465 mark_modified ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2466 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2467
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2468 virtual graphics_toolkit get_toolkit (void) const;
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2469
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2470 virtual Matrix
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2471 get_boundingbox (bool /*internal*/ = false,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2472 const Matrix& /*parent_pix_size*/ = Matrix ()) const
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2473 { return Matrix (1, 4, 0.0); }
7447
25018e35b4cb [project @ 2008-02-05 22:38:57 by jwe]
jwe
parents: 7446
diff changeset
2474
7828
4739b6a1925c Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7827
diff changeset
2475 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
2476
12389
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
2477 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
2478
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2479 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
2480 listener_mode = POSTSET);
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2481
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2482 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
2483 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
2484
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2485 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
2486
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2487 void set_parent (const octave_value& val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2488
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2489 Matrix get_children (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2490 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2491 return children.get_children ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2492 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2493
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2494 Matrix get_all_children (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2495 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2496 return children.get_all ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2497 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2498
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2499 Matrix get_hidden_children (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2500 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2501 return children.get_hidden ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2502 }
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2503
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2504 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
2505
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2506 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
2507
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2508 void reparent (const graphics_handle& new_parent) { parent = new_parent; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2509
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2510 // 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
2511 // axes object.
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2512
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2513 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
2514
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2515 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
2516 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
2517
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2518 virtual void delete_children (bool clear = false)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2519 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2520 children.delete_children (clear);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2521 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2522
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2523 void renumber_child (graphics_handle old_gh, graphics_handle new_gh)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2524 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2525 children.renumber (old_gh, new_gh);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2526 }
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2527
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2528 void renumber_parent (graphics_handle new_gh)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2529 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2530 parent = new_gh;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2531 }
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2532
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2533 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
2534
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2535 // FIXME: these functions should be generated automatically by the
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2536 // genprops.awk script.
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2537 //
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2538 // 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
2539
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2540 virtual octave_value get_alim (void) const { return octave_value (); }
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2541 virtual octave_value get_clim (void) const { return octave_value (); }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2542 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
2543 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
2544 virtual octave_value get_zlim (void) const { return octave_value (); }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2545
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2546 virtual bool is_aliminclude (void) const { return false; }
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2547 virtual bool is_climinclude (void) const { return false; }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2548 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
2549 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
2550 virtual bool is_zliminclude (void) const { return false; }
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
2551
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
2552 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
2553
9972
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2554 std::set<std::string> dynamic_property_names (void) const;
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2555
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2556 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
2557
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2558 protected:
9972
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2559 std::set<std::string> dynamic_properties;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2560
9972
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2561 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
2562
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2563 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
2564
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2565 octave_value get_dynamic (bool all = false) const;
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2566
9185
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2567 property get_property_dynamic (const caseless_str& pname);
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2568
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2569 BEGIN_BASE_PROPERTIES
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2570 // properties common to all objects
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2571 bool_property beingdeleted , "off"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2572 radio_property busyaction , "{queue}|cancel"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2573 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
2574 children_property children gf , Matrix ()
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2575 bool_property clipping , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2576 callback_property createfcn , Matrix ()
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2577 callback_property deletefcn , Matrix ()
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2578 radio_property handlevisibility , "{on}|callback|off"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2579 bool_property hittest , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2580 bool_property interruptible , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2581 handle_property parent fs , p
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2582 bool_property selected , "off"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2583 bool_property selectionhighlight , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2584 string_property tag s , ""
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2585 string_property type frs , ty
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2586 handle_property uicontextmenu , graphics_handle ()
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2587 any_property userdata , Matrix ()
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2588 bool_property visible , "on"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2589 // additional (Octave-specific) properties
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2590 bool_property __modified__ s , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2591 graphics_handle __myhandle__ fhrs , mh
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2592 END_PROPERTIES
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2593
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2594 protected:
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2595 struct cmp_caseless_str
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2596 {
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
2597 bool operator () (const caseless_str& a, const caseless_str& b) const
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2598 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2599 std::string a1 = a;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2600 std::transform (a1.begin (), a1.end (), a1.begin (), tolower);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2601 std::string b1 = b;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2602 std::transform (b1.begin (), b1.end (), b1.begin (), tolower);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2603
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2604 return a1 < b1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2605 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2606 };
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2607
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2608 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
2609
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2610 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2611 void insert_static_property (const std::string& name, base_property& p)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2612 { insert_property (name, property (&p, true)); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2613
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2614 virtual void init (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2615 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2616
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
2617 class OCTINTERP_API base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2618 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2619 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2620 friend class graphics_object;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2621
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2622 base_graphics_object (void) : count (1), toolkit_flag (false) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2623
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2624 virtual ~base_graphics_object (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2625
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2626 virtual void mark_modified (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2627 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2628 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2629 get_properties ().mark_modified ();
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2630 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2631 error ("base_graphics_object::mark_modified: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2632 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2633
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2634 virtual void override_defaults (base_graphics_object& obj)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2635 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2636 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2637 get_properties ().override_defaults (obj);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2638 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2639 error ("base_graphics_object::override_defaults: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2640 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2641
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2642 virtual void set_from_list (property_list& plist)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2643 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2644 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2645 get_properties ().set_from_list (*this, plist);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2646 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2647 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
2648 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2649
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2650 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
2651 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2652 if (valid_object ())
9188
9646be3a59c4 make changeset 1e5c11890f85 work
John W. Eaton <jwe@octave.org>
parents: 9185
diff changeset
2653 get_properties ().set (pname, pval);
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2654 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2655 error ("base_graphics_object::set: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2656 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2657
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2658 virtual void set_defaults (const std::string&)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2659 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2660 error ("base_graphics_object::set_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2661 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2662
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
2663 virtual octave_value get (bool all = false) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2664 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2665 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2666 return get_properties ().get (all);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2667 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2668 {
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2669 error ("base_graphics_object::get: invalid graphics object");
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2670 return octave_value ();
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2671 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2672 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2673
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2674 virtual octave_value get (const caseless_str& pname) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2675 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2676 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2677 return get_properties ().get (pname);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2678 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2679 {
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2680 error ("base_graphics_object::get: invalid graphics object");
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2681 return octave_value ();
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2682 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2683 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2684
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2685 virtual octave_value get_default (const caseless_str&) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2686
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2687 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
2688
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2689 virtual octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2690 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2691 error ("base_graphics_object::get_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2692 return octave_value ();
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2695 virtual octave_value get_factory_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2696 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2697 error ("base_graphics_object::get_factory_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2698 return octave_value ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2699 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2700
18963
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2701 virtual property_list get_factory_defaults_list (void) const
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2702 {
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2703 error ("base_graphics_object::get_factory_defaults_list: invalid graphics object");
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2704 return property_list ();
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2705 }
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2706
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2707 virtual bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2708 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2709 return base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2710 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2711
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2712 virtual std::string values_as_string (void);
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2713
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
2714 virtual std::string value_as_string (const std::string& prop);
18118
ca84d3c9dc24 set: allow retrieving allowed values for individual properties
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17822
diff changeset
2715
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
2716 virtual octave_scalar_map values_as_struct (void);
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2717
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2718 virtual graphics_handle get_parent (void) const
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 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2721 return get_properties ().get_parent ();
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2722 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2723 {
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2724 error ("base_graphics_object::get_parent: invalid graphics object");
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2725 return graphics_handle ();
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2726 }
6874
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
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2729 graphics_handle get_handle (void) const
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2730 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2731 if (valid_object ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2732 return get_properties ().get___myhandle__ ();
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2733 else
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2734 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2735 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
2736 return graphics_handle ();
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2737 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2738 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2739
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2740 virtual void remove_child (const graphics_handle& h)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2741 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2742 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2743 get_properties ().remove_child (h);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2744 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2745 error ("base_graphics_object::remove_child: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2746 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2747
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2748 virtual void adopt (const graphics_handle& h)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2749 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2750 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2751 get_properties ().adopt (h);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2752 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2753 error ("base_graphics_object::adopt: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2754 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2755
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2756 virtual void reparent (const graphics_handle& np)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2757 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2758 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2759 get_properties ().reparent (np);
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2760 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2761 error ("base_graphics_object::reparent: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2762 }
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 virtual void defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2765 {
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2766 if (valid_object ())
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2767 {
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2768 std::string msg = (type () + "::defaults");
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2769 gripe_not_implemented (msg.c_str ());
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2770 }
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2771 else
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2772 error ("base_graphics_object::default: invalid graphics object");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2773 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2774
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2775 virtual base_properties& get_properties (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2776 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2777 static base_properties properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2778 error ("base_graphics_object::get_properties: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2779 return properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2780 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2781
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2782 virtual const base_properties& get_properties (void) const
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2783 {
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2784 static base_properties properties;
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2785 error ("base_graphics_object::get_properties: invalid graphics object");
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2786 return properties;
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2787 }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2788
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2789 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
2790
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2791 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
2792 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
2793
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2794 virtual bool valid_object (void) const { return false; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2795
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2796 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
2797
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2798 virtual std::string type (void) const
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2799 {
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2800 return (valid_object () ? get_properties ().graphics_object_name ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2801 : "unknown");
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2802 }
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 bool isa (const std::string& go_name) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2805 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2806 return type () == go_name;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2807 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2808
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2809 virtual graphics_toolkit get_toolkit (void) const
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2810 {
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2811 if (valid_object ())
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2812 return get_properties ().get_toolkit ();
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2813 else
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2814 {
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2815 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
2816 return graphics_toolkit ();
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2817 }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2818 }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2819
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2820 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
2821 const octave_value& v,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2822 listener_mode mode = POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2823 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2824 if (valid_object ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2825 get_properties ().add_listener (nm, v, mode);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2826 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2827
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2828 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
2829 const octave_value& v,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2830 listener_mode mode = POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2831 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2832 if (valid_object ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2833 get_properties ().delete_listener (nm, v, mode);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2834 }
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2835
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2836 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
2837
18963
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2838 virtual void reset_default_properties (void);
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2839
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2840 protected:
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2841 virtual void initialize (const graphics_object& go)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2842 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2843 if (! toolkit_flag)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2844 toolkit_flag = get_toolkit ().initialize (go);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2845 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2846
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2847 virtual void finalize (const graphics_object& go)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2848 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2849 if (toolkit_flag)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2850 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2851 get_toolkit ().finalize (go);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2852 toolkit_flag = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2853 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2854 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2855
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2856 virtual void update (const graphics_object& go, int id)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2857 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2858 if (toolkit_flag)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2859 get_toolkit ().update (go, id);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2860 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2861
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2862 protected:
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2863 // A reference count.
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13938
diff changeset
2864 octave_refcount<int> count;
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
2865
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2866 // 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
2867 // 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
2868 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
2869
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
2870 // No copying!
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
2871
13722
ecff4c684b89 Provide dummy implementations of ctor and assign of base_graphics_object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13714
diff changeset
2872 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
2873
ecff4c684b89 Provide dummy implementations of ctor and assign of base_graphics_object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13714
diff changeset
2874 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
2875 {
ecff4c684b89 Provide dummy implementations of ctor and assign of base_graphics_object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13714
diff changeset
2876 return *this;
ecff4c684b89 Provide dummy implementations of ctor and assign of base_graphics_object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13714
diff changeset
2877 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2878 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2879
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
2880 class OCTINTERP_API graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2881 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2882 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2883 graphics_object (void) : rep (new base_graphics_object ()) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2884
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2885 graphics_object (base_graphics_object *new_rep)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2886 : rep (new_rep) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2887
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
2888 graphics_object (const graphics_object& obj) : rep (obj.rep)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2889 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2890 rep->count++;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2891 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2892
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2893 graphics_object& operator = (const graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2894 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2895 if (rep != obj.rep)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2896 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2897 if (--rep->count == 0)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2898 delete rep;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2899
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2900 rep = obj.rep;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
2901 rep->count++;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2902 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2903
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2904 return *this;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2905 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2906
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2907 ~graphics_object (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2908 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2909 if (--rep->count == 0)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2910 delete rep;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2911 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2912
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2913 void mark_modified (void) { rep->mark_modified (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2914
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2915 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2916 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2917 rep->override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2918 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2919
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2920 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
2921
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2922 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
2923 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2924 rep->set (name, val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2925 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2926
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2927 void set (const octave_value_list& args);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2928
10056
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
2929 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
2930 octave_idx_type row);
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
2931
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
2932 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
2933
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
2934 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
2935 const octave_value& val);
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
2936
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2937 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
2938
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
2939 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
2940
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2941 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2942 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2943 return name.compare ("default")
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2944 ? get_defaults ()
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2945 : (name.compare ("factory")
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2946 ? get_factory_defaults () : rep->get (name));
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
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
2949 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
2950 {
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
2951 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
2952 }
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
2953
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
2954 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
2955 {
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
2956 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
2957 }
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
2958
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2959 octave_value get_default (const caseless_str& name) const
6874
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 return rep->get_default (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2962 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2963
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2964 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
2965 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2966 return rep->get_factory_default (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2967 }
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 octave_value get_defaults (void) const { return rep->get_defaults (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2970
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2971 octave_value get_factory_defaults (void) const
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 return rep->get_factory_defaults ();
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
18963
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2976 property_list get_factory_defaults_list (void) const
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2977 {
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2978 return rep->get_factory_defaults_list ();
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2979 }
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2980
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2981 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2982 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2983 return rep->has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2984 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2985
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2986 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
2987
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
2988 std::string value_as_string (const std::string& prop)
18118
ca84d3c9dc24 set: allow retrieving allowed values for individual properties
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17822
diff changeset
2989 {
ca84d3c9dc24 set: allow retrieving allowed values for individual properties
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17822
diff changeset
2990 return rep->value_as_string (prop);
ca84d3c9dc24 set: allow retrieving allowed values for individual properties
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17822
diff changeset
2991 }
ca84d3c9dc24 set: allow retrieving allowed values for individual properties
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17822
diff changeset
2992
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
2993 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
2994
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2995 graphics_handle get_parent (void) const { return rep->get_parent (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2996
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2997 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
2998
11250
830b940e7ff4 Turn xget_ancestor into regular API
Michael Goffioul <michael.goffioul@gmail.com>
parents: 11247
diff changeset
2999 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
3000
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3001 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
3002
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3003 void adopt (const graphics_handle& h) { rep->adopt (h); }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3004
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3005 void reparent (const graphics_handle& h) { rep->reparent (h); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3006
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3007 void defaults (void) const { rep->defaults (); }
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 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
3010
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3011 base_properties& get_properties (void) { return rep->get_properties (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3012
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3013 const base_properties& get_properties (void) const
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3014 {
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3015 return rep->get_properties ();
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3016 }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3017
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3018 void update_axis_limits (const std::string& axis_type)
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3019 {
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3020 rep->update_axis_limits (axis_type);
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3021 }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
3022
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
3023 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
3024 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
3025 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
3026 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
3027 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
3028
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3029 bool valid_object (void) const { return rep->valid_object (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3030
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
3031 std::string type (void) const { return rep->type (); }
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
3032
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3033 operator bool (void) const { return rep->valid_object (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3034
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3035 // FIXME: these functions should be generated automatically by the
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3036 // genprops.awk script.
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3037 //
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3038 // 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
3039
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3040 octave_value get_alim (void) const
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3041 { return get_properties ().get_alim (); }
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3042
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3043 octave_value get_clim (void) const
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3044 { return get_properties ().get_clim (); }
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3045
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3046 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
3047 { 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
3048
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3049 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
3050 { return get_properties ().get_ylim (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3051
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3052 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
3053 { return get_properties ().get_zlim (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3054
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3055 bool is_aliminclude (void) const
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3056 { return get_properties ().is_aliminclude (); }
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3057
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3058 bool is_climinclude (void) const
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3059 { return get_properties ().is_climinclude (); }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3060
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3061 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
3062 { return get_properties ().is_xliminclude (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3063
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3064 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
3065 { return get_properties ().is_yliminclude (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3066
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
3067 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
3068 { return get_properties ().is_zliminclude (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3069
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3070 bool is_handle_visible (void) const
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3071 { return get_properties ().is_handle_visible (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3072
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3073 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
3074
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
3075 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
3076 listener_mode mode = POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3077 { rep->add_property_listener (nm, v, mode); }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
3078
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
3079 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
3080 listener_mode mode = POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3081 { rep->delete_property_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
3082
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3083 void initialize (void) { rep->initialize (*this); }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3084
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3085 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
3086
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3087 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
3088
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3089 void reset_default_properties (void)
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3090 { rep->reset_default_properties (); }
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3091
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3092 private:
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
3093 base_graphics_object *rep;
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3094 };
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3095
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3096 // ---------------------------------------------------------------------
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3097
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
3098 class OCTINTERP_API root_figure : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3099 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3100 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
3101 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3102 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3103 public:
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
3104 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
3105
14357
e7c74f56cd03 fltk toolkit requires figure units to be "pixels". Bug # 35430.
Ben Abbott <bpabbott@mac.com>
parents: 14324
diff changeset
3106 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
3107 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
3108
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3109 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3110 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3111
18764
89448a7523b2 Add some more callbacks for root properties (bug #42347).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18737
diff changeset
3112 // FIXME: Properties that still dont have callbacks are:
89448a7523b2 Add some more callbacks for root properties (bug #42347).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18737
diff changeset
3113 // language, monitorpositions, pointerlocation, pointerwindow.
89448a7523b2 Add some more callbacks for root properties (bug #42347).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18737
diff changeset
3114 // Note that these properties are not yet used by Octave, so setting
89448a7523b2 Add some more callbacks for root properties (bug #42347).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18737
diff changeset
3115 // them will have no effect.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3116
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3117 // Programming note: Keep property list sorted if new ones are added.
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3118
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
3119 BEGIN_PROPERTIES (root_figure, root)
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3120 handle_property callbackobject Sr , graphics_handle ()
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3121 array_property commandwindowsize r , Matrix (1, 2, 0)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3122 handle_property currentfigure S , graphics_handle ()
18764
89448a7523b2 Add some more callbacks for root properties (bug #42347).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18737
diff changeset
3123 bool_property diary GS , "off"
89448a7523b2 Add some more callbacks for root properties (bug #42347).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18737
diff changeset
3124 string_property diaryfile GS , "diary"
89448a7523b2 Add some more callbacks for root properties (bug #42347).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18737
diff changeset
3125 bool_property echo GS , "off"
89448a7523b2 Add some more callbacks for root properties (bug #42347).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18737
diff changeset
3126 string_property errormessage Gr , ""
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3127 string_property fixedwidthfontname , "Courier"
18737
9fbb254c09e6 build: Fix compiling with new graphic root properties (cset 28eab2d84190).
Rik <rik@octave.org>
parents: 18736
diff changeset
3128 radio_property format GS , "+|bank|bit|hex|long|longe|longeng|longg|native-bit|native-hex|none|rat|{short}|shorte|shorteng|shortg"
9fbb254c09e6 build: Fix compiling with new graphic root properties (cset 28eab2d84190).
Rik <rik@octave.org>
parents: 18736
diff changeset
3129 radio_property formatspacing GS , "compact|{loose}"
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3130 string_property language , "ascii"
10949
848f3a13b7cf Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents: 10948
diff changeset
3131 array_property monitorpositions , Matrix (1, 4, 0)
848f3a13b7cf Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents: 10948
diff changeset
3132 array_property pointerlocation , Matrix (1, 2, 0)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3133 double_property pointerwindow r , 0.0
18764
89448a7523b2 Add some more callbacks for root properties (bug #42347).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18737
diff changeset
3134 double_property recursionlimit GS , 256.0
8560
5cc594679cdc get display characteristics from system
John W. Eaton <jwe@octave.org>
parents: 8465
diff changeset
3135 double_property screendepth r , default_screendepth ()
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3136 double_property screenpixelsperinch r , default_screenpixelsperinch ()
10949
848f3a13b7cf Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents: 10948
diff changeset
3137 array_property screensize r , default_screensize ()
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
3138 bool_property showhiddenhandles , "off"
8560
5cc594679cdc get display characteristics from system
John W. Eaton <jwe@octave.org>
parents: 8465
diff changeset
3139 radio_property units U , "inches|centimeters|normalized|points|{pixels}"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3140 END_PROPERTIES
7822
edbaa13397ee Implement callbackobject property in root object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7821
diff changeset
3141
edbaa13397ee Implement callbackobject property in root object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7821
diff changeset
3142 private:
edbaa13397ee Implement callbackobject property in root object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7821
diff changeset
3143 std::list<graphics_handle> cbo_stack;
18735
28eab2d84190 Add callbacks for root properties format and formatspacing (bug #42135).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18667
diff changeset
3144
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3145 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3146
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3147 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3148 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3149
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3150 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3151
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3152 root_figure (void)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3153 : xproperties (0, graphics_handle ()), default_properties () { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3154
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
3155 ~root_figure (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3156
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3157 void mark_modified (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3158
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3159 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3160 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3161 // Now override with our defaults. If the default_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3162 // list includes the properties for all defaults (line,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3163 // 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
3164 // 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
3165 // properties from the list to use.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3166 obj.set_from_list (default_properties);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3167 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3168
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3169 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
3170 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3171 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3172 // strip "default", pass rest to function that will
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3173 // parse the remainder and add the element to the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3174 // default_properties map.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3175 default_properties.set (name.substr (7), value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3176 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3177 xproperties.set (name, value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3178 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3179
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3180 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3181 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3182 octave_value retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3183
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3184 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3185 return get_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3186 else if (name.compare ("factory", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3187 return get_factory_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3188 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3189 retval = xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3190
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3191 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3192 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3193
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3194 octave_value get_default (const caseless_str& name) const
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 octave_value retval = default_properties.lookup (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3197
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3198 if (retval.is_undefined ())
7847
40b16e04172a Make backend switching work.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7846
diff changeset
3199 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3200 // no default property found, use factory default
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3201 retval = factory_properties.lookup (name);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3202
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3203 if (retval.is_undefined ())
15468
6437fa7263dd use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
3204 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
3205 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3206
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3207 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3208 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3209
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3210 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
3211 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3212 octave_value retval = factory_properties.lookup (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3213
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3214 if (retval.is_undefined ())
15468
6437fa7263dd use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
3215 error ("get: invalid factory default property '%s'", name.c_str ());
6874
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 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3218 }
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 octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3221 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3222 return default_properties.as_struct ("default");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3223 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3224
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3225 octave_value get_factory_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3226 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3227 return factory_properties.as_struct ("factory");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3228 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3229
18963
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
3230 property_list get_factory_defaults_list (void) const
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
3231 {
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
3232 return factory_properties;
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
3233 }
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
3234
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3235 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3236
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3237 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3238
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3239 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3240
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3241 void reset_default_properties (void);
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3242
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3243 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3244 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3245 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3246 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3247 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3248 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3249 }
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3250
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3251 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3252 property_list default_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3253
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3254 static property_list factory_properties;
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 static property_list::plist_map_type init_factory_properties (void);
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3259 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3260
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
3261 class OCTINTERP_API figure : public base_graphics_object
6874
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 public:
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3264 class OCTINTERP_API properties : public base_properties
6874
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 public:
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
3267 void init_integerhandle (const octave_value& val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3268 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3269 integerhandle = val;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3270 }
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
3271
8266
81b124f463f9 properly update currentaxes when axes are deleted
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
3272 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
3273
7366
2a2115742cb5 [project @ 2008-01-13 06:46:39 by jwe]
jwe
parents: 7365
diff changeset
3274 void set_visible (const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3275
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3276 graphics_toolkit get_toolkit (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3277 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3278 if (! toolkit)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3279 toolkit = gtk_manager::get_toolkit ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3280
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3281 return toolkit;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3282 }
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3283
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3284 void set_toolkit (const graphics_toolkit& b);
7439
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
3285
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3286 void set___graphics_toolkit__ (const octave_value& val)
7439
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
3287 {
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
3288 if (! error_state)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3289 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3290 if (val.is_string ())
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3291 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3292 std::string nm = val.string_value ();
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14016
diff changeset
3293 graphics_toolkit b = gtk_manager::find_toolkit (nm);
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3294 if (b.get_name () != nm)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3295 {
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3296 error ("set___graphics_toolkit__: invalid graphics toolkit");
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3297 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3298 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3299 {
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3300 set_toolkit (b);
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3301 mark_modified ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3302 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3303 }
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3304 else
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3305 error ("set___graphics_toolkit__ must be a string");
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3306 }
7439
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
3307 }
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3308
19044
4c59f69fa52c figure: define adopted axes "currentaxes" if none is defined (bug #41573)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19021
diff changeset
3309 void adopt (const graphics_handle& h);
4c59f69fa52c figure: define adopted axes "currentaxes" if none is defined (bug #41573)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19021
diff changeset
3310
13713
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3311 void set_position (const octave_value& val,
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3312 bool do_notify_toolkit = true);
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3313
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3314 void set_outerposition (const octave_value& val,
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3315 bool do_notify_toolkit = true);
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3316
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3317 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
3318 const Matrix& parent_pix_size = Matrix ()) const;
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3319
13713
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3320 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
3321 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
3322
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3323 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
3324
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3325 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
3326
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
3327 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
3328
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3329 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
3330
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
3331 std::string get_title (void) const;
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
3332
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3333 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3334 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3335 // Programming note: Keep property list sorted if new ones are added.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3336
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
3337 BEGIN_PROPERTIES (figure)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3338 array_property alphamap , Matrix (64, 1, 1)
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3339 callback_property buttondownfcn , Matrix ()
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3340 callback_property closerequestfcn , "closereq"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3341 color_property color , color_property (color_values (1, 1, 1), radio_values ("none"))
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3342 array_property colormap , jet_colormap ()
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3343 handle_property currentaxes S , graphics_handle ()
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3344 string_property currentcharacter r , ""
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3345 handle_property currentobject r , graphics_handle ()
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10505
diff changeset
3346 array_property currentpoint r , Matrix (2, 1, 0)
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3347 bool_property dockcontrols , "off"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3348 bool_property doublebuffer , "on"
11247
29b1f7d68665 make filename property of figure objects writable
John W. Eaton <jwe@octave.org>
parents: 11175
diff changeset
3349 string_property filename , ""
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
3350 bool_property integerhandle S , "on"
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3351 bool_property inverthardcopy , "off"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3352 callback_property keypressfcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3353 callback_property keyreleasefcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3354 radio_property menubar , "none|{figure}"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3355 double_property mincolormap , 64
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3356 string_property name , ""
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3357 radio_property nextplot , "new|{add}|replacechildren|replace"
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3358 bool_property numbertitle , "on"
13713
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3359 array_property outerposition s , Matrix (1, 4, -1.0)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3360 radio_property paperorientation U , "{portrait}|landscape|rotated"
18773
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3361 array_property paperposition m , default_figure_paperposition ()
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3362 radio_property paperpositionmode au , "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
3363 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
3364 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>"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3365 radio_property paperunits Su , "{inches}|centimeters|normalized|points"
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3366 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
3367 array_property pointershapecdata , Matrix (16, 16, 0)
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3368 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
3369 array_property position s , default_figure_position ()
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3370 radio_property renderer , "{painters}|zbuffer|opengl|none"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3371 radio_property renderermode , "{auto}|manual"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3372 bool_property resize , "on"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3373 callback_property resizefcn , Matrix ()
19021
9609f345823e Implement figure property SelectionType for FLTK
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18963
diff changeset
3374 radio_property selectiontype , "{normal}|open|alternate|extend"
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3375 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
3376 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
3377 callback_property windowbuttondownfcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3378 callback_property windowbuttonmotionfcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3379 callback_property windowbuttonupfcn , Matrix ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3380 callback_property windowkeypressfcn , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3381 callback_property windowkeyreleasefcn , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3382 callback_property windowscrollwheelfcn , Matrix ()
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3383 radio_property windowstyle , "{normal}|modal|docked"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3384 string_property wvisual , ""
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3385 radio_property wvisualmode , "{auto}|manual"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3386 string_property xdisplay , ""
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3387 string_property xvisual , ""
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3388 radio_property xvisualmode , "{auto}|manual"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3389 // Octave-specific properties
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3390 bool_property __enhanced__ h , "on"
17501
55680de6a897 make fltk the default graphics toolkit
John W. Eaton <jwe@octave.org>
parents: 17382
diff changeset
3391 string_property __graphics_toolkit__ s , gtk_manager::default_toolkit ()
13699
dd9b32af0a01 Implement guidata/guihandles.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13324
diff changeset
3392 any_property __guidata__ h , Matrix ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3393 any_property __plot_stream__ h , Matrix ()
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3394 END_PROPERTIES
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3395
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3396 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3397 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3398 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3399 alphamap.add_constraint (dim_vector (-1, 1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3400 colormap.add_constraint (dim_vector (-1, 3));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3401 outerposition.add_constraint (dim_vector (1, 4));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3402 paperposition.add_constraint (dim_vector (1, 4));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3403 papersize.add_constraint (dim_vector (1, 2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3404 pointershapecdata.add_constraint (dim_vector (16, 16));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3405 pointershapehotspot.add_constraint (dim_vector (1, 2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3406 position.add_constraint (dim_vector (1, 4));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3407 }
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3408
18773
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3409 private:
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3410 Matrix get_auto_paperposition (void);
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3411
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3412 void update_paperpositionmode (void)
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3413 {
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3414 if (paperpositionmode.is ("auto"))
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3415 paperposition.set (get_auto_paperposition ());
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3416 }
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3417
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3418 mutable graphics_toolkit toolkit;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3419 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3420
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3421 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3422 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3423
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3424 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3425 figure (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3426 : base_graphics_object (), xproperties (mh, p), default_properties ()
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3427 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3428 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3429 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3430
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
3431 ~figure (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3432
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3433 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3434 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3435 // Allow parent (root figure) to override first (properties knows how
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3436 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3437 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3438
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3439 // Now override with our defaults. If the default_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3440 // list includes the properties for all defaults (line,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3441 // 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
3442 // 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
3443 // properties from the list to use.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3444 obj.set_from_list (default_properties);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3445 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3446
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3447 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
3448 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3449 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3450 // strip "default", pass rest to function that will
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3451 // parse the remainder and add the element to the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3452 // default_properties map.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3453 default_properties.set (name.substr (7), value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3454 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3455 xproperties.set (name, value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3456 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3457
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3458 octave_value get (const caseless_str& name) const
6874
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 octave_value retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3461
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3462 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3463 retval = get_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3464 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3465 retval = xproperties.get (name);
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 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3468 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3469
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3470 octave_value get_default (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3471
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3472 octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3473 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3474 return default_properties.as_struct ("default");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3475 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3476
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3477 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3478
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3479 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3480
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3481 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3482
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3483 void reset_default_properties (void);
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3484
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3485 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3486 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3487 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3488 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3489 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3490 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3491 }
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3492
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3493 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3494 property_list default_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3495 };
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
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3499 class OCTINTERP_API graphics_xform
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3500 {
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3501 public:
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3502 graphics_xform (void)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
3503 : xform (xform_eye ()), xform_inv (xform_eye ()),
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
3504 sx ("linear"), sy ("linear"), sz ("linear"), zlim (1, 2, 0.0)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3505 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3506 zlim(1) = 1.0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3507 }
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3508
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3509 graphics_xform (const Matrix& xm, const Matrix& xim,
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3510 const scaler& x, const scaler& y, const scaler& z,
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3511 const Matrix& zl)
17652
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
3512 : 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
3513
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3514 graphics_xform (const graphics_xform& g)
17652
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
3515 : xform (g.xform), xform_inv (g.xform_inv), sx (g.sx),
57750dc54ab6 maint: Correct indentation in graphics.cc, graphics.in.h. No code changes.
Rik <rik@octave.org>
parents: 17646
diff changeset
3516 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
3517
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3518 ~graphics_xform (void) { }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3519
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3520 graphics_xform& operator = (const graphics_xform& g)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3521 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3522 xform = g.xform;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3523 xform_inv = g.xform_inv;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3524 sx = g.sx;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3525 sy = g.sy;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3526 sz = g.sz;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3527 zlim = g.zlim;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3528
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3529 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3530 }
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3531
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3532 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
3533
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3534 static Matrix xform_eye (void);
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3535
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3536 ColumnVector transform (double x, double y, double z,
10553
f88e3d5d88e2 avoid GCC warnings
John W. Eaton <jwe@octave.org>
parents: 10517
diff changeset
3537 bool use_scale = true) const;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3538
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3539 ColumnVector untransform (double x, double y, double z,
10553
f88e3d5d88e2 avoid GCC warnings
John W. Eaton <jwe@octave.org>
parents: 10517
diff changeset
3540 bool use_scale = true) const;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3541
10553
f88e3d5d88e2 avoid GCC warnings
John W. Eaton <jwe@octave.org>
parents: 10517
diff changeset
3542 ColumnVector untransform (double x, double y, bool use_scale = true) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3543 { 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
3544
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3545 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
3546 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
3547 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
3548
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3549 Matrix scale (const Matrix& m) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3550 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3551 bool has_z = (m.columns () > 2);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3552
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3553 if (sx.is_linear () && sy.is_linear ()
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3554 && (! has_z || sz.is_linear ()))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3555 return m;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3556
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3557 Matrix retval (m.dims ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3558
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3559 int r = m.rows ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3560
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3561 for (int i = 0; i < r; i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3562 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3563 retval(i,0) = sx.scale (m(i,0));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3564 retval(i,1) = sy.scale (m(i,1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3565 if (has_z)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3566 retval(i,2) = sz.scale (m(i,2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3567 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3568
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3569 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3570 }
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3571
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3572 private:
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3573 Matrix xform;
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3574 Matrix xform_inv;
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3575 scaler sx, sy, sz;
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3576 Matrix zlim;
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3577 };
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3578
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3579 enum
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3580 {
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3581 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
3582 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
3583 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
3584 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
3585 };
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3586
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
3587 class OCTINTERP_API axes : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3588 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3589 public:
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3590 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3591 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3592 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3593 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
3594
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3595 void remove_child (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3596
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3597 const scaler& get_x_scaler (void) const { return sx; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3598 const scaler& get_y_scaler (void) const { return sy; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3599 const scaler& get_z_scaler (void) const { return sz; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3600
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3601 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
3602 const Matrix& parent_pix_size = Matrix ()) const;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3603 Matrix get_extent (bool with_text = false,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3604 bool only_text_height=false) const;
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3605
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3606 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
3607
7828
4739b6a1925c Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7827
diff changeset
3608 void update_boundingbox (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3609 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3610 if (units_is ("normalized"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3611 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3612 sync_positions ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3613 base_properties::update_boundingbox ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3614 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3615 }
7828
4739b6a1925c Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7827
diff changeset
3616
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3617 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
3618 void update_axes_layout (void);
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3619 void update_aspectratios (void);
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3620 void update_transform (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3621 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3622 update_aspectratios ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3623 update_camera ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3624 update_axes_layout ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3625 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3626
17098
786bcce466e9 Initialize the tightinset during initialization of axes.
Ben Abbott <bpabbott@mac.com>
parents: 17011
diff changeset
3627 void sync_positions (void);
786bcce466e9 Initialize the tightinset during initialization of axes.
Ben Abbott <bpabbott@mac.com>
parents: 17011
diff changeset
3628
12389
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3629 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
3630 void update_xlabel_position (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3631 void update_ylabel_position (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3632 void update_zlabel_position (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3633 void update_title_position (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3634
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3635 graphics_xform get_transform (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3636 { 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
3637
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3638 Matrix get_transform_matrix (void) const { return x_render; }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3639 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
3640 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
3641 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
3642 Matrix get_transform_zlim (void) const { return x_zlim; }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3643
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3644 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
3645 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
3646 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
3647 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
3648 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
3649 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
3650 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
3651 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
3652 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
3653 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
3654 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
3655 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
3656 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
3657 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
3658 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
3659 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
3660 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
3661 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
3662 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
3663 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
3664 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
3665 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
3666 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
3667 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
3668 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
3669 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
3670 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
3671 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
3672 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
3673 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
3674 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
3675 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
3676 bool get_layer2Dtop (void) const { return layer2Dtop; }
18667
e42843ceff48 Fix axes bounding box not obeying 'layer' property.
Rik <rik@octave.org>
parents: 18646
diff changeset
3677 bool get_is2D (void) const { return is2D; }
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3678 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
3679 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
3680 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
3681 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
3682
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
3683 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
3684 { 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
3685
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7836
diff changeset
3686 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
3687 { 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
3688
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
3689 void zoom_about_point (double x, double y, double factor,
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
3690 bool push_to_zoom_stack = true);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3691 void zoom (const Matrix& xl, const Matrix& yl,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3692 bool push_to_zoom_stack = true);
14314
17de694961f5 make panning work for logscale axes
John W. Eaton <jwe@octave.org>
parents: 14281
diff changeset
3693 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
3694 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
3695 void unzoom (void);
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
3696 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
3697
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
3698 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
3699
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3700 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
3701
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3702 private:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3703 scaler sx, sy, sz;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3704 Matrix x_render, x_render_inv;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3705 Matrix x_gl_mat1, x_gl_mat2;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3706 Matrix x_zlim;
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
3707 std::list<octave_value> zoom_stack;
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3708
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3709 // Axes layout data
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3710 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
3711 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
3712 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
3713 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
3714 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
3715 double xtickoffset, ytickoffset, ztickoffset;
18667
e42843ceff48 Fix axes bounding box not obeying 'layer' property.
Rik <rik@octave.org>
parents: 18646
diff changeset
3716 bool x2Dtop, y2Dright, layer2Dtop, is2D;
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3717 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
3718
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3719 #if HAVE_FREETYPE
18736
333901476119 maint: Use "FreeType" rather than "freetype" in messages and comments.
Rik <rik@octave.org>
parents: 18735
diff changeset
3720 // FreeType renderer, used for calculation of text (tick labels) size
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3721 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
3722 #endif
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3723
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3724 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
3725 const octave_value& v);
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3726
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
3727 void delete_text_child (handle_property& h);
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
3728
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18901
diff changeset
3729 void set_pan (const octave_value& val)
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18901
diff changeset
3730 {
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18901
diff changeset
3731 pan.set (val, false, false);
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18901
diff changeset
3732 if (pan_is ("on") || pan_is ("xon") || pan_is ("yon"))
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18901
diff changeset
3733 rotate3d.set ("off", false, false);
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18901
diff changeset
3734 }
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18901
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.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3738 // Programming note: Keep property list sorted if new ones are added.
8222
11badf6c9e9f __go_draw_axes__.m: Support axes interpreter poperty for tick labels.
Ben Abbott <bpabbott@mac.com>
parents: 8210
diff changeset
3739
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
3740 BEGIN_PROPERTIES (axes)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3741 radio_property activepositionproperty , "{outerposition}|position"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3742 row_vector_property alim m , default_lim ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3743 radio_property alimmode , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3744 color_property ambientlightcolor , color_values (1, 1, 1)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3745 bool_property box , "on"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3746 array_property cameraposition m , Matrix (1, 3, 0.0)
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3747 radio_property camerapositionmode , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3748 array_property cameratarget m , Matrix (1, 3, 0.0)
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3749 radio_property cameratargetmode , "{auto}|manual"
18646
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
3750 array_property cameraupvector m , Matrix (1, 3, 0.0)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3751 radio_property cameraupvectormode , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3752 double_property cameraviewangle m , 10.0
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3753 radio_property cameraviewanglemode , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3754 row_vector_property clim m , default_lim ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3755 radio_property climmode al , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3756 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
3757 array_property colororder , default_colororder ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3758 array_property currentpoint , Matrix (2, 3, 0.0)
11167
51ac3a08e53c Fix {d,pb}aspectratios for OpenGL backends.
Konstantinos Poulios <logari81@googlemail.com>
parents: 11163
diff changeset
3759 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
3760 radio_property dataaspectratiomode u , "{auto}|manual"
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3761 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
3762 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
3763 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
3764 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
3765 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
3766 radio_property fontweight u , "{normal}|light|demi|bold"
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3767 radio_property gridlinestyle , "-|--|{:}|-.|none"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3768 // NOTE: interpreter is not a Matlab axis property, but it makes
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3769 // more sense to have it so that axis ticklabels can use it.
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3770 radio_property interpreter , "tex|{none}|latex"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3771 radio_property layer u , "{bottom}|top"
17382
50b2863d10a6 Create Matlab compatible linestyleorder char matrices (bug #34906)
Rik <rik@octave.org>
parents: 17104
diff changeset
3772 // FIXME: should be kind of string array.
50b2863d10a6 Create Matlab compatible linestyleorder char matrices (bug #34906)
Rik <rik@octave.org>
parents: 17104
diff changeset
3773 any_property linestyleorder S , "-"
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3774 double_property linewidth , 0.5
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3775 radio_property minorgridlinestyle , "-|--|{:}|-.|none"
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18901
diff changeset
3776 double_property mouse_wheel_zoom , 0.05
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3777 radio_property nextplot , "add|replacechildren|{replace}"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3778 array_property outerposition u , default_axes_outerposition ()
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18901
diff changeset
3779 radio_property pan s , "{on}|xon|yon|off"
11167
51ac3a08e53c Fix {d,pb}aspectratios for OpenGL backends.
Konstantinos Poulios <logari81@googlemail.com>
parents: 11163
diff changeset
3780 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
3781 radio_property plotboxaspectratiomode u , "{auto}|manual"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3782 array_property position u , default_axes_position ()
18819
92e9d4710f78 Fix typo in graphics.in.h (bug #42535).
Michael Godfrey <michaeldgodfrey@gmail.com>
parents: 17822
diff changeset
3783 radio_property projection , "{orthographic}|perspective"
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18901
diff changeset
3784 radio_property rotate3d S , "{off}|on"
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3785 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
3786 radio_property tickdirmode u , "{auto}|manual"
14391
c9ec21bef97a Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
3787 array_property ticklength u , default_axes_ticklength ()
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3788 array_property tightinset r , Matrix (1, 4, 0.0)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3789 handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3790 // 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
3791 radio_property units SU , "{normalized}|inches|centimeters|points|pixels|characters"
18646
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
3792 array_property view u , default_axes_view ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3793 radio_property xaxislocation u , "{bottom}|top|zero"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3794 color_property xcolor , color_values (0, 0, 0)
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3795 radio_property xdir u , "{normal}|reverse"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3796 bool_property xgrid , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3797 handle_property xlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3798 row_vector_property xlim mu , default_lim ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3799 radio_property xlimmode al , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3800 bool_property xminorgrid , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3801 bool_property xminortick , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3802 radio_property xscale alu , "{linear}|log"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3803 row_vector_property xtick mu , default_axes_tick ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3804 // FIXME: should be kind of string array.
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3805 any_property xticklabel S , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3806 radio_property xticklabelmode u , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3807 radio_property xtickmode u , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3808 radio_property yaxislocation u , "{left}|right|zero"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3809 color_property ycolor , color_values (0, 0, 0)
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3810 radio_property ydir u , "{normal}|reverse"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3811 bool_property ygrid , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3812 handle_property ylabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3813 row_vector_property ylim mu , default_lim ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3814 radio_property ylimmode al , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3815 bool_property yminorgrid , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3816 bool_property yminortick , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3817 radio_property yscale alu , "{linear}|log"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3818 row_vector_property ytick mu , default_axes_tick ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3819 any_property yticklabel S , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3820 radio_property yticklabelmode u , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3821 radio_property ytickmode u , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3822 color_property zcolor , color_values (0, 0, 0)
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3823 radio_property zdir u , "{normal}|reverse"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3824 bool_property zgrid , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3825 handle_property zlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3826 row_vector_property zlim mu , default_lim ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3827 radio_property zlimmode al , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3828 bool_property zminorgrid , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3829 bool_property zminortick , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3830 radio_property zscale alu , "{linear}|log"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3831 row_vector_property ztick mu , default_axes_tick ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3832 any_property zticklabel S , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3833 radio_property zticklabelmode u , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3834 radio_property ztickmode u , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3835 // Octave-specific properties
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3836 bool_property __hold_all__ h , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3837 // hidden properties for alignment of subplots
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3838 radio_property autopos_tag h , "{none}|subplot"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3839 // hidden properties for inset
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3840 array_property looseinset hu , Matrix (1, 4, 0.0)
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3841 // hidden properties for transformation computation
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3842 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
3843 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
3844 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
3845 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
3846 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
3847 // 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
3848 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
3849 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
3850 row_vector_property zmtick h , Matrix ()
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3851 END_PROPERTIES
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3852
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3853 protected:
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3854 void init (void);
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3855
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3856 private:
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3857
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3858 std::string
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3859 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
3860 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3861 std::string retval = scale;
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 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
3864 retval = "neglog";
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3865
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3866 return retval;
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
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3869 void update_xscale (void)
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3870 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3871 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
3872 }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3873
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3874 void update_yscale (void)
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3875 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3876 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
3877 }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3878
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3879 void update_zscale (void)
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3880 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3881 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
3882 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3883
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3884 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
3885 void update_dataaspectratio (void) { sync_positions (); }
b932ae4381da improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12440
diff changeset
3886 void update_dataaspectratiomode (void) { sync_positions (); }
b932ae4381da improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12440
diff changeset
3887 void update_plotboxaspectratio (void) { sync_positions (); }
b932ae4381da improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12440
diff changeset
3888 void update_plotboxaspectratiomode (void) { sync_positions (); }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3889
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3890 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
3891 void update_yaxislocation (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3892 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3893 update_axes_layout ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3894 update_ylabel_position ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3895 }
12503
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3896 void update_xaxislocation (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3897 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3898 update_axes_layout ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3899 update_xlabel_position ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3900 }
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3901
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3902 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
3903 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
3904 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
3905
14391
c9ec21bef97a Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
3906 void update_ticklength (void);
c9ec21bef97a Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
3907 void update_tickdir (void) { update_ticklength (); }
c9ec21bef97a Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
3908 void update_tickdirmode (void) { update_ticklength (); }
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
3909
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3910 void update_xtick (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3911 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3912 if (xticklabelmode.is ("auto"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3913 calc_ticklabels (xtick, xticklabel, xscale.is ("log"));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3914 }
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3915 void update_ytick (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3916 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3917 if (yticklabelmode.is ("auto"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3918 calc_ticklabels (ytick, yticklabel, yscale.is ("log"));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3919 }
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3920 void update_ztick (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3921 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3922 if (zticklabelmode.is ("auto"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3923 calc_ticklabels (ztick, zticklabel, zscale.is ("log"));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3924 }
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3925
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3926 void update_xtickmode (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3927 {
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3928 if (xtickmode.is ("auto"))
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3929 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3930 calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3931 xscale.is ("log"));
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3932 update_xtick ();
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3933 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3934 }
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3935 void update_ytickmode (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3936 {
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3937 if (ytickmode.is ("auto"))
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3938 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3939 calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3940 yscale.is ("log"));
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3941 update_ytick ();
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3942 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3943 }
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3944 void update_ztickmode (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3945 {
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3946 if (ztickmode.is ("auto"))
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3947 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3948 calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3949 zscale.is ("log"));
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3950 update_ztick ();
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3951 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3952 }
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3953
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3954 void update_xticklabelmode (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3955 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3956 if (xticklabelmode.is ("auto"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3957 calc_ticklabels (xtick, xticklabel, xscale.is ("log"));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3958 }
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3959 void update_yticklabelmode (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3960 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3961 if (yticklabelmode.is ("auto"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3962 calc_ticklabels (ytick, yticklabel, yscale.is ("log"));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3963 }
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3964 void update_zticklabelmode (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3965 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3966 if (zticklabelmode.is ("auto"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3967 calc_ticklabels (ztick, zticklabel, zscale.is ("log"));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3968 }
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3969
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
3970 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
3971 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
3972 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
3973 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
3974 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
3975
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3976 void update_outerposition (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 ("outerposition");
17011
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3979 caseless_str old_units = get_units ();
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3980 set_units ("normalized");
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3981 Matrix outerbox = outerposition.get ().matrix_value ();
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3982 Matrix innerbox = position.get ().matrix_value ();
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3983 Matrix linset = looseinset.get ().matrix_value ();
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3984 Matrix tinset = tightinset.get ().matrix_value ();
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3985 outerbox(2) = outerbox(2) + outerbox(0);
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3986 outerbox(3) = outerbox(3) + outerbox(1);
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3987 innerbox(0) = outerbox(0) + std::max (linset(0), tinset(0));
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3988 innerbox(1) = outerbox(1) + std::max (linset(1), tinset(1));
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3989 innerbox(2) = outerbox(2) - std::max (linset(2), tinset(2));
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3990 innerbox(3) = outerbox(3) - std::max (linset(3), tinset(3));
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3991 innerbox(2) = innerbox(2) - innerbox(0);
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3992 innerbox(3) = innerbox(3) - innerbox(1);
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3993 position = innerbox;
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3994 set_units (old_units);
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
3995 update_transform ();
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3996 }
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3997
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3998 void update_position (void)
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3999 {
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
4000 set_activepositionproperty ("position");
17011
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4001 caseless_str old_units = get_units ();
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4002 set_units ("normalized");
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4003 Matrix outerbox = outerposition.get ().matrix_value ();
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4004 Matrix innerbox = position.get ().matrix_value ();
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4005 Matrix linset = looseinset.get ().matrix_value ();
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4006 Matrix tinset = tightinset.get ().matrix_value ();
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4007 innerbox(2) = innerbox(2) + innerbox(0);
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4008 innerbox(3) = innerbox(3) + innerbox(1);
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4009 outerbox(0) = innerbox(0) - std::max (linset(0), tinset(0));
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4010 outerbox(1) = innerbox(1) - std::max (linset(1), tinset(1));
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4011 outerbox(2) = innerbox(2) + std::max (linset(2), tinset(2));
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4012 outerbox(3) = innerbox(3) + std::max (linset(3), tinset(3));
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4013 outerbox(2) = outerbox(2) - outerbox(0);
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4014 outerbox(3) = outerbox(3) - outerbox(1);
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4015 outerposition = outerbox;
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4016 set_units (old_units);
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4017 update_transform ();
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
4018 }
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
4019
17011
350cad34b0f8 Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents: 16892
diff changeset
4020 void update_looseinset (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4021 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4022 caseless_str old_units = get_units ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4023 set_units ("normalized");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4024 Matrix innerbox = position.get ().matrix_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4025 innerbox(2) = innerbox(2) + innerbox(0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4026 innerbox(3) = innerbox(3) + innerbox(1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4027 Matrix outerbox = outerposition.get ().matrix_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4028 outerbox(2) = outerbox(2) + outerbox(0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4029 outerbox(3) = outerbox(3) + outerbox(1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4030 Matrix linset = looseinset.get ().matrix_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4031 Matrix tinset = tightinset.get ().matrix_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4032 if (activepositionproperty.is ("position"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4033 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4034 outerbox(0) = innerbox(0) - std::max (linset(0), tinset(0));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4035 outerbox(1) = innerbox(1) - std::max (linset(1), tinset(1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4036 outerbox(2) = innerbox(2) + std::max (linset(2), tinset(2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4037 outerbox(3) = innerbox(3) + std::max (linset(3), tinset(3));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4038 outerbox(2) = outerbox(2) - outerbox(0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4039 outerbox(3) = outerbox(3) - outerbox(1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4040 outerposition = outerbox;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4041 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4042 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4043 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4044 innerbox(0) = outerbox(0) + std::max (linset(0), tinset(0));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4045 innerbox(1) = outerbox(1) + std::max (linset(1), tinset(1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4046 innerbox(2) = outerbox(2) - std::max (linset(2), tinset(2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4047 innerbox(3) = outerbox(3) - std::max (linset(3), tinset(3));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4048 innerbox(2) = innerbox(2) - innerbox(0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4049 innerbox(3) = innerbox(3) - innerbox(1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4050 position = innerbox;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4051 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4052 set_units (old_units);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4053 update_transform ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4054 }
12467
2f83974d5a6d implement looseinset property for axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12443
diff changeset
4055
7827
3584f37eac69 better tick and limit handling, still missing logscale support
Shai Ayal <shaiay@sourceforge.net>
parents: 7826
diff changeset
4056 double calc_tick_sep (double minval, double maxval);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4057 void calc_ticks_and_lims (array_property& lims, array_property& ticks,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4058 array_property& mticks,
12126
85f9a5b211fd restructuring draw_axes, enabling minor ticks/grid in fltk, closing bug 31800
Konstantinos Poulios <logari81@googlemail.com>
parents: 11586
diff changeset
4059 bool limmode_is_auto, bool is_logscale);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4060 void calc_ticklabels (const array_property& ticks, any_property& labels,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4061 bool is_logscale);
12334
63dc132a1000 Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents: 12327
diff changeset
4062 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
4063 const string_vector& ticklabels,
63dc132a1000 Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents: 12327
diff changeset
4064 const Matrix& limits);
63dc132a1000 Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents: 12327
diff changeset
4065
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4066 void fix_limits (array_property& lims)
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4067 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4068 if (lims.get ().is_empty ())
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4069 return;
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4070
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4071 Matrix l = lims.get ().matrix_value ();
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4072 if (l(0) > l(1))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4073 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4074 l(0) = 0;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4075 l(1) = 1;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4076 lims = l;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4077 }
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4078 else if (l(0) == l(1))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4079 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4080 l(0) -= 0.5;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4081 l(1) += 0.5;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4082 lims = l;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4083 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4084 }
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4085
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
4086 Matrix calc_tightbox (const Matrix& init_pos);
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
4087
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4088 public:
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
4089 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
4090 double min_pos, double max_neg,
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
4091 bool logscale);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4092
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4093 void update_xlim (bool do_clr_zoom = true)
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4094 {
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4095 if (xtickmode.is ("auto"))
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4096 calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4097 xscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
4098 if (xticklabelmode.is ("auto"))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4099 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
4100
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4101 fix_limits (xlim);
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4102
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4103 update_xscale ();
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4104
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4105 if (do_clr_zoom)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4106 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
4107
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
4108 update_axes_layout ();
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4109 }
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4110
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4111 void update_ylim (bool do_clr_zoom = true)
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4112 {
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4113 if (ytickmode.is ("auto"))
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4114 calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4115 yscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
4116 if (yticklabelmode.is ("auto"))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4117 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
4118
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4119 fix_limits (ylim);
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4120
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4121 update_yscale ();
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4122
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4123 if (do_clr_zoom)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4124 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
4125
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
4126 update_axes_layout ();
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4127 }
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4128
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4129 void update_zlim (void)
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4130 {
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4131 if (ztickmode.is ("auto"))
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4132 calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4133 zscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
4134 if (zticklabelmode.is ("auto"))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4135 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
4136
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4137 fix_limits (zlim);
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4138
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4139 update_zscale ();
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4140
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4141 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
4142
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
4143 update_axes_layout ();
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4144 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4145
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4146 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4147
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4148 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4149 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4150
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4151 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4152 axes (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4153 : base_graphics_object (), xproperties (mh, p), default_properties ()
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 xproperties.override_defaults (*this);
7830
61aee739a4da Make sure to initialize axes xform data.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7829
diff changeset
4156 xproperties.update_transform ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4157 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4158
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
4159 ~axes (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4160
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4161 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4162 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4163 // Allow parent (figure) to override first (properties knows how
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4164 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4165 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4166
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4167 // Now override with our defaults. If the default_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4168 // list includes the properties for all defaults (line,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4169 // 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
4170 // 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
4171 // properties from the list to use.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4172 obj.set_from_list (default_properties);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4173 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4174
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
4175 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
4176 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4177 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4178 // strip "default", pass rest to function that will
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4179 // parse the remainder and add the element to the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4180 // default_properties map.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4181 default_properties.set (name.substr (7), value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4182 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4183 xproperties.set (name, value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4184 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4185
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4186 void set_defaults (const std::string& mode)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4187 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4188 xproperties.set_defaults (*this, mode);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4189 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4190
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
4191 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4192 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4193 octave_value retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4194
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4195 // FIXME: finish this.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4196 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4197 retval = get_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4198 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4199 retval = xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4200
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4201 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4202 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4203
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
4204 octave_value get_default (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4205
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4206 octave_value get_defaults (void) const
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 return default_properties.as_struct ("default");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4209 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4210
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4211 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4212
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4213 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4214
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
4215 void update_axis_limits (const std::string& axis_type);
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
4216
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4217 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
4218 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
4219
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4220 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4221
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
4222 void reset_default_properties (void);
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
4223
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4224 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4225 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4226 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4227 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4228 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4229 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4230 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4231
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4232 protected:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4233 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
4234
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4235 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4236 property_list default_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4237 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4238
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4239 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4240
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4241 class OCTINTERP_API line : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4242 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4243 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4244 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4245 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4246 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4247 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4248 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4249 // Programming note: Keep property list sorted if new ones are added.
7366
2a2115742cb5 [project @ 2008-01-13 06:46:39 by jwe]
jwe
parents: 7365
diff changeset
4250
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4251 BEGIN_PROPERTIES (line)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4252 color_property color , color_values (0, 0, 0)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4253 string_property displayname , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4254 radio_property erasemode , "{normal}|none|xor|background"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4255 // FIXME: interpreter is not a property of Matlab line objects.
17104
d4dcf3820688 graphics.in.h: Add note about why "interpreter" property is required for surf,line,patch.
Rik <rik@octave.org>
parents: 17099
diff changeset
4256 // Octave uses this for legend() with the string displayname.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4257 radio_property interpreter , "{tex}|none|latex"
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4258 radio_property linestyle , "{-}|--|:|-.|none"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4259 double_property linewidth , 0.5
17529
ec5bd610a11f Add support for long form marker styles such as "square", "diamond", etc.
Rik <rik@octave.org>
parents: 17501
diff changeset
4260 radio_property marker , "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram"
17645
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
4261 color_property markeredgecolor , color_property (radio_values ("{auto}|none"), color_values (0, 0, 0))
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
4262 color_property markerfacecolor , color_property (radio_values ("auto|{none}"), color_values (0, 0, 0))
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4263 double_property markersize , 6
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4264 row_vector_property xdata u , default_data ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4265 string_property xdatasource , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4266 row_vector_property ydata u , default_data ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4267 string_property ydatasource , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4268 row_vector_property zdata u , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4269 string_property zdatasource , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4270
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4271 // 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
4272 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
4273 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
4274 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
4275 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
4276 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
4277 bool_property zliminclude hl , "off"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4278 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
4279
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4280 private:
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4281 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
4282 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
4283
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4284 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
4285
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4286 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
4287
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4288 void update_zdata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4289 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4290 set_zlim (zdata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4291 set_zliminclude (get_zdata ().numel () > 0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4292 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4293 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4294
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4295 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4296 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4297
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4298 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4299 line (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4300 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4301 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4302 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4303 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4304
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
4305 ~line (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4306
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4307 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4308
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4309 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4310
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4311 bool valid_object (void) const { return true; }
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4312
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4313 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4314 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4315 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4316 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4317 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4318 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4319 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4320 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4321
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4322 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4323
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4324 class OCTINTERP_API text : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4325 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4326 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4327 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4328 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4329 public:
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4330 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
4331
14448
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4332 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
4333 {
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4334 if (! error_state)
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4335 {
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4336 octave_value new_val (val);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4337
14448
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4338 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
4339 {
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4340 dim_vector dv (1, 3);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4341
14448
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4342 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
4343 }
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4344
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4345 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
4346 {
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4347 set_positionmode ("manual");
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4348 update_position ();
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4349 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
4350 mark_modified ();
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4351 }
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4352 else
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4353 set_positionmode ("manual");
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4354 }
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4355 }
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4356
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4357 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4358 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4359
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4360 BEGIN_PROPERTIES (text)
17646
993ea21b7e03 graphics.in.h: Text "edgecolor" property should default to "none".
Rik <rik@octave.org>
parents: 17645
diff changeset
4361 color_property backgroundcolor , color_property (radio_values ("{none}"), color_values (1, 1, 1))
12443
24b38afd6a45 fix plotyy bugs #31800, #32211
Konstantinos Poulios <logari81@googlemail.com>
parents: 12441
diff changeset
4362 color_property color u , color_values (0, 0, 0)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4363 string_property displayname , ""
17645
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
4364 color_property edgecolor , color_property (radio_values ("{none}"), color_values (0, 0, 0))
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4365 bool_property editing , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4366 radio_property erasemode , "{normal}|none|xor|background"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4367 array_property extent rG , Matrix (1, 4, 0.0)
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4368 radio_property fontangle u , "{normal}|italic|oblique"
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4369 string_property fontname u , OCTAVE_DEFAULT_FONTNAME
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4370 double_property fontsize u , 10
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4371 radio_property fontunits , "inches|centimeters|normalized|{points}|pixels"
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4372 radio_property fontweight u , "light|{normal}|demi|bold"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4373 radio_property horizontalalignment mu , "{left}|center|right"
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4374 radio_property interpreter u , "{tex}|none|latex"
7377
46b58515067d [project @ 2008-01-15 06:57:15 by jwe]
jwe
parents: 7370
diff changeset
4375 radio_property linestyle , "{-}|--|:|-.|none"
46b58515067d [project @ 2008-01-15 06:57:15 by jwe]
jwe
parents: 7370
diff changeset
4376 double_property linewidth , 0.5
18646
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
4377 double_property margin , 2
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4378 array_property position smu , Matrix (1, 3, 0.0)
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4379 double_property rotation mu , 0
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4380 text_label_property string u , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4381 radio_property units u , "{data}|pixels|normalized|inches|centimeters|points"
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4382 radio_property verticalalignment mu , "top|cap|{middle}|baseline|bottom"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4383
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4384 // 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
4385 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
4386 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
4387 row_vector_property zlim hlr , Matrix ()
11281
3f952c6973f7 graphics.h.in: Change intended for 11272.
Ben Abbott <bpabbott@mac.com>
parents: 11250
diff changeset
4388 bool_property xliminclude hl , "off"
3f952c6973f7 graphics.h.in: Change intended for 11272.
Ben Abbott <bpabbott@mac.com>
parents: 11250
diff changeset
4389 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
4390 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
4391 // hidden properties for auto-positioning
12389
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4392 radio_property positionmode hu , "{auto}|manual"
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4393 radio_property rotationmode hu , "{auto}|manual"
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4394 radio_property horizontalalignmentmode hu , "{auto}|manual"
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4395 radio_property verticalalignmentmode hu , "{auto}|manual"
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4396 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
4397 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4398
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4399 Matrix get_data_position (void) const;
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4400 Matrix get_extent_matrix (void) const;
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4401 const uint8NDArray& get_pixels (void) const { return pixels; }
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4402 #if HAVE_FREETYPE
18736
333901476119 maint: Use "FreeType" rather than "freetype" in messages and comments.
Rik <rik@octave.org>
parents: 18735
diff changeset
4403 // FreeType renderer, used for calculation of text size
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4404 ft_render renderer;
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4405 #endif
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4406
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4407 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4408 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4409 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4410 position.add_constraint (dim_vector (1, 3));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4411 cached_units = get_units ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4412 update_font ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4413 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4414
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4415 private:
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4416 void update_position (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4417 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4418 Matrix pos = get_data_position ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4419 Matrix lim;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4420
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4421 lim = Matrix (1, 3, pos(0));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4422 lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4423 set_xlim (lim);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4424
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4425 lim = Matrix (1, 3, pos(1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4426 lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4427 set_ylim (lim);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4428
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4429 if (pos.numel () == 3)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4430 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4431 lim = Matrix (1, 3, pos(2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4432 lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4433 set_zliminclude ("on");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4434 set_zlim (lim);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4435 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4436 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4437 set_zliminclude ("off");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4438 }
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4439
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4440 void update_text_extent (void);
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4441
12389
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4442 void request_autopos (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4443 void update_positionmode (void) { request_autopos (); }
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4444 void update_rotationmode (void) { request_autopos (); }
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4445 void update_horizontalalignmentmode (void) { request_autopos (); }
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4446 void update_verticalalignmentmode (void) { request_autopos (); }
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4447
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
4448 void update_font (void);
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
4449 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
4450 void update_rotation (void) { update_text_extent (); }
16830
4c51eaffa9e4 Update Text object color after property value has changed (bug #37007).
Rik <rik@octave.org>
parents: 16750
diff changeset
4451 void update_color (void) { update_font (); 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
4452 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
4453 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
4454 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
4455 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
4456 void update_interpreter (void) { update_text_extent (); }
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4457 void update_horizontalalignment (void) { update_text_extent (); }
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4458 void update_verticalalignment (void) { update_text_extent (); }
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4459
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4460 void update_units (void);
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4461
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4462 private:
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4463 std::string cached_units;
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4464 uint8NDArray pixels;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4465 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4466
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4467 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4468 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4469
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4470 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4471 text (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4472 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4473 {
12433
02669a1aa070 regexp.cc: avoid deprecated Array<T>:resize function
John W. Eaton <jwe@octave.org>
parents: 12389
diff changeset
4474 xproperties.set_clipping ("off");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4475 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4476 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4477
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
4478 ~text (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4479
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4480 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4481
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4482 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4483
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4484 bool valid_object (void) const { return true; }
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4485
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4486 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4487 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4488 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4489 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4490 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4491 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4492 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4493 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4494
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
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4497 class OCTINTERP_API image : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4498 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4499 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4500 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4501 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4502 public:
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4503 bool is_aliminclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4504 { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4505 std::string get_aliminclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4506 { return aliminclude.current_value (); }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4507
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4508 bool is_climinclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4509 { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4510 std::string get_climinclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4511 { return climinclude.current_value (); }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4512
9680
73153525df9a initial implementation of OpenGL image rendering
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9620
diff changeset
4513 octave_value get_color_data (void) const;
73153525df9a initial implementation of OpenGL image rendering
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9620
diff changeset
4514
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4515 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4516 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4517 // Programming note: Keep property list sorted if new ones are added.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4518
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4519 BEGIN_PROPERTIES (image)
18646
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
4520 array_property alphadata u , Matrix (1, 1, 1.0)
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
4521 radio_property alphadatamapping al , "{none}|direct|scaled"
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
4522 array_property cdata u , default_image_cdata ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4523 radio_property cdatamapping al , "scaled|{direct}"
18646
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
4524 string_property displayname , ""
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4525 radio_property erasemode , "{normal}|none|xor|background"
18899
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4526 row_vector_property xdata mu , Matrix ()
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4527 row_vector_property ydata mu , 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
4528 // hidden properties for limit computation
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4529 row_vector_property alim hlr , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4530 row_vector_property clim hlr , 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
4531 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
4532 row_vector_property ylim hlr , Matrix ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4533 bool_property aliminclude hlg , "on"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4534 bool_property climinclude hlg , "on"
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4535 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
4536 bool_property yliminclude hl , "on"
18899
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4537 radio_property xdatamode ha , "{auto}|manual"
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4538 radio_property ydatamode ha , "{auto}|manual"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4539 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4540
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4541 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4542 void init (void)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4543 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4544 xdata.add_constraint (2);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4545 ydata.add_constraint (2);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4546 cdata.add_constraint ("double");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4547 cdata.add_constraint ("single");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4548 cdata.add_constraint ("logical");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4549 cdata.add_constraint ("uint8");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4550 cdata.add_constraint ("uint16");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4551 cdata.add_constraint ("int16");
15069
7a3957ca99c3 Handle complex arguments in imagesc (bug #36866)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14861
diff changeset
4552 cdata.add_constraint ("real");
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4553 cdata.add_constraint (dim_vector (-1, -1));
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4554 cdata.add_constraint (dim_vector (-1, -1, 3));
17631
94dd9bba06a0 Fix validation of array properties to set(), avoid segfaults (bug #bug #35687).
Rik <rik@octave.org>
parents: 17625
diff changeset
4555 alphadata.add_constraint (dim_vector (-1, -1));
94dd9bba06a0 Fix validation of array properties to set(), avoid segfaults (bug #bug #35687).
Rik <rik@octave.org>
parents: 17625
diff changeset
4556 alphadata.add_constraint ("double");
94dd9bba06a0 Fix validation of array properties to set(), avoid segfaults (bug #bug #35687).
Rik <rik@octave.org>
parents: 17625
diff changeset
4557 alphadata.add_constraint ("uint8");
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4558 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4559
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4560 private:
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4561 void update_alphadata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4562 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4563 if (alphadatamapping_is ("scaled"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4564 set_alim (alphadata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4565 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4566 alim = alphadata.get_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4567 }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4568
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4569 void update_cdata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4570 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4571 if (cdatamapping_is ("scaled"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4572 set_clim (cdata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4573 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4574 clim = cdata.get_limits ();
18899
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4575
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4576 if (xdatamode.is ("auto"))
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4577 update_xdata ();
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4578
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4579 if (ydatamode.is ("auto"))
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4580 update_ydata ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4581 }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4582
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4583 void update_xdata (void)
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4584 {
18899
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4585 if (xdata.get ().is_empty ())
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4586 set_xdatamode ("auto");
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4587
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4588 if (xdatamode.is ("auto"))
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4589 {
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4590 set_xdata (get_auto_xdata ());
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4591 set_xdatamode ("auto");
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4592 }
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4593
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4594 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
4595 float dp = pixel_xsize ();
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4596
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4597 limits(0) = limits(0) - dp;
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4598 limits(1) = limits(1) + dp;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4599 set_xlim (limits);
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4600 }
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4601
7862
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_ydata (void)
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4603 {
18899
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4604 if (ydata.get ().is_empty ())
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4605 set_ydatamode ("auto");
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4606
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4607 if (ydatamode.is ("auto"))
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4608 {
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4609 set_ydata (get_auto_ydata ());
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4610 set_ydatamode ("auto");
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4611 }
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4612
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4613 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
4614 float dp = pixel_ysize ();
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4615
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4616 limits(0) = limits(0) - dp;
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4617 limits(1) = limits(1) + dp;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4618 set_ylim (limits);
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4619 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4620
18899
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4621 Matrix get_auto_xdata (void)
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4622 {
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4623 dim_vector dv = get_cdata ().dims ();
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4624 Matrix data;
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4625 if (dv(1) > 0.)
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4626 {
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4627 data = Matrix (1, 2, 1);
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4628 data(1) = dv(1);
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4629 }
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4630 return data;
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4631 }
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4632
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4633 Matrix get_auto_ydata (void)
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4634 {
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4635 dim_vector dv = get_cdata ().dims ();
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4636 Matrix data;
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4637 if (dv(0) > 0.)
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4638 {
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4639 data = Matrix (1, 2, 1);
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4640 data(1) = dv(0);
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4641 }
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4642 return data;
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4643 }
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4644
11076
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4645 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
4646 {
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4647 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
4648 float dp;
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4649
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
4650 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
4651 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
4652 else
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4653 {
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4654 if (limits(1) == limits(2))
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4655 dp = 0.5;
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4656 else
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4657 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
4658 }
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4659 return dp;
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4660 }
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4661
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4662 public:
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4663 float pixel_xsize (void)
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4664 {
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4665 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
4666 }
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4667
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4668 float pixel_ysize (void)
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4669 {
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4670 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
4671 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4672 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4673
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4674 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4675 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4676
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4677 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4678 image (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4679 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4680 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4681 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4682 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4683
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
4684 ~image (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4685
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4686 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4687
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4688 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4689
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4690 bool valid_object (void) const { return true; }
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4691
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4692 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4693 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4694 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4695 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4696 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4697 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4698 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4699 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4700
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4701 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4702
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4703 class OCTINTERP_API patch : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4704 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4705 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4706 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4707 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4708 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
4709 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
4710
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4711 // Matlab allows incoherent data to be stored into patch properties.
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4712 // The patch should then be ignored by the renderer.
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4713 bool has_bad_data (std::string &msg) const
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4714 {
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4715 msg = bad_data_msg;
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4716 return ! msg.empty ();
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4717 }
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4718
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4719 bool is_aliminclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4720 { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4721 std::string get_aliminclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4722 { return aliminclude.current_value (); }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4723
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4724 bool is_climinclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4725 { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4726 std::string get_climinclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4727 { return climinclude.current_value (); }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4728
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4729 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4730 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4731 // Programming note: Keep property list sorted if new ones are added.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4732
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4733 BEGIN_PROPERTIES (patch)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4734 radio_property alphadatamapping l , "none|{scaled}|direct"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4735 double_property ambientstrength , 0.3
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4736 radio_property backfacelighting , "unlit|lit|{reverselit}"
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 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
4738 radio_property cdatamapping l , "{scaled}|direct"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4739 double_property diffusestrength , 0.6
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4740 string_property displayname , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4741 double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp"))
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4742 color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp"))
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4743 radio_property edgelighting , "{none}|flat|gouraud|phong"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4744 radio_property erasemode , "{normal}|background|xor|none"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4745 double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp"))
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4746 color_property facecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp"))
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4747 radio_property facelighting , "{none}|flat|gouraud|phong"
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4748 array_property faces u , default_patch_faces ()
7848
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
4749 array_property facevertexalphadata , Matrix ()
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4750 array_property facevertexcdata u , Matrix ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4751 // FIXME: interpreter is not a property of a Matlab patch.
17104
d4dcf3820688 graphics.in.h: Add note about why "interpreter" property is required for surf,line,patch.
Rik <rik@octave.org>
parents: 17099
diff changeset
4752 // Octave uses this for legend() with the string displayname.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4753 radio_property interpreter , "{tex}|none|latex"
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4754 radio_property linestyle , "{-}|--|:|-.|none"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4755 double_property linewidth , 0.5
17529
ec5bd610a11f Add support for long form marker styles such as "square", "diamond", etc.
Rik <rik@octave.org>
parents: 17501
diff changeset
4756 radio_property marker , "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram"
17645
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
4757 color_property markeredgecolor , color_property (radio_values ("none|{auto}|flat"), color_values (0, 0, 0))
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
4758 color_property markerfacecolor , color_property (radio_values ("{none}|auto|flat"), color_values (0, 0, 0))
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4759 double_property markersize , 6
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4760 radio_property normalmode , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4761 double_property specularcolorreflectance , 1.0
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4762 double_property specularexponent , 10.0
18646
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
4763 double_property specularstrength , 0.9
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4764 array_property vertexnormals , Matrix ()
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4765 array_property vertices u , default_patch_vertices ()
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4766 array_property xdata u , default_patch_xdata ()
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4767 array_property ydata u , default_patch_ydata ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4768 array_property zdata u , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4769
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4770 // hidden properties for limit computation
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4771 row_vector_property alim hlr , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4772 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
4773 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
4774 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
4775 row_vector_property zlim hlr , Matrix ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4776 bool_property aliminclude hlg , "on"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4777 bool_property climinclude hlg , "on"
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4778 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
4779 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
4780 bool_property zliminclude hl , "on"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4781 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4782
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4783 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4784 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4785 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4786 xdata.add_constraint (dim_vector (-1, -1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4787 ydata.add_constraint (dim_vector (-1, -1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4788 zdata.add_constraint (dim_vector (-1, -1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4789 faces.add_constraint (dim_vector (-1, -1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4790 vertices.add_constraint (dim_vector (-1, 2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4791 vertices.add_constraint (dim_vector (-1, 3));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4792 cdata.add_constraint (dim_vector (-1, -1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4793 cdata.add_constraint (dim_vector (-1, -1, 3));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4794 facevertexcdata.add_constraint (dim_vector (-1, 1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4795 facevertexcdata.add_constraint (dim_vector (-1, 3));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4796 facevertexalphadata.add_constraint (dim_vector (-1, 1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4797 vertexnormals.add_constraint (dim_vector (-1, -1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4798 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4799
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4800 private:
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4801 std::string bad_data_msg;
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4802
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4803 void update_faces (void) { update_data ();}
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4804
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4805 void update_vertices (void) { update_data ();}
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4806
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4807 void update_facevertexcdata (void) { update_data ();}
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4808
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4809 void update_fvc (void);
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4810
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4811 void update_xdata (void)
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4812 {
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4813 if (get_xdata ().is_empty ())
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4814 {
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4815 // For compatibility with matlab behavior,
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4816 // if x/ydata are set empty, silently empty other *data and
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4817 // faces properties while vertices remain unchanged.
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4818 set_ydata (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4819 set_zdata (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4820 set_cdata (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4821 set_faces (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4822 }
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4823 else
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4824 update_fvc ();
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4825
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4826 set_xlim (xdata.get_limits ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4827 }
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4828
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4829 void update_ydata (void)
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4830 {
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4831 if (get_ydata ().is_empty ())
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4832 {
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4833 set_xdata (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4834 set_zdata (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4835 set_cdata (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4836 set_faces (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4837 }
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4838 else
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4839 update_fvc ();
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4840
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4841 set_ylim (ydata.get_limits ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4842 }
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4843
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4844 void update_zdata (void)
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4845 {
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4846 update_fvc ();
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4847 set_zlim (zdata.get_limits ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4848 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4849
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4850 void update_cdata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4851 {
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4852 update_fvc ();
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4853
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4854 if (cdatamapping_is ("scaled"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4855 set_clim (cdata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4856 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4857 clim = cdata.get_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4858 }
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4859
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4860
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4861 void update_data (void);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4862 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4863
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4864 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4865 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4866
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4867 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4868 patch (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4869 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4870 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4871 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4872 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4873
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
4874 ~patch (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4875
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4876 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4877
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4878 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4879
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4880 bool valid_object (void) const { return true; }
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4881
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4882 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4883 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4884 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4885 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4886 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4887 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4888 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4889 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4890
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4891 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4892
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4893 class OCTINTERP_API surface : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4894 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4895 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4896 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4897 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4898 public:
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4899 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
4900
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4901 bool is_aliminclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4902 { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4903 std::string get_aliminclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4904 { return aliminclude.current_value (); }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4905
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4906 bool is_climinclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4907 { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4908 std::string get_climinclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4909 { return climinclude.current_value (); }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4910
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4911 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4912 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4913 // Programming note: Keep property list sorted if new ones are added.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4914
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4915 BEGIN_PROPERTIES (surface)
18646
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
4916 array_property alphadata u , Matrix (1, 1, 1.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
4917 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
4918 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
4919 radio_property backfacelighting , "unlit|lit|{reverselit}"
18646
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
4920 array_property cdata u , default_surface_cdata ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4921 radio_property cdatamapping al , "{scaled}|direct"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4922 string_property cdatasource , ""
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4923 double_property diffusestrength , 0.6
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4924 string_property displayname , ""
7846
d7737a4268b7 Fix typos in property names (edgealpha/facealpha).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7844
diff changeset
4925 double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp"))
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4926 color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp"))
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4927 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
4928 radio_property erasemode , "{normal}|none|xor|background"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4929 double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp|texturemap"))
17645
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
4930 color_property facecolor , color_property (radio_values ("none|{flat}|interp|texturemap"), color_values (0, 0, 0))
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4931 radio_property facelighting , "{none}|flat|gouraud|phong"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4932 // FIXME: interpreter is not a Matlab surface property
17104
d4dcf3820688 graphics.in.h: Add note about why "interpreter" property is required for surf,line,patch.
Rik <rik@octave.org>
parents: 17099
diff changeset
4933 // Octave uses this for legend() with the string displayname.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4934 radio_property interpreter , "{tex}|none|latex"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4935 radio_property linestyle , "{-}|--|:|-.|none"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4936 double_property linewidth , 0.5
17529
ec5bd610a11f Add support for long form marker styles such as "square", "diamond", etc.
Rik <rik@octave.org>
parents: 17501
diff changeset
4937 radio_property marker , "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram"
17645
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
4938 color_property markeredgecolor , color_property (radio_values ("none|{auto}|flat"), color_values (0, 0, 0))
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
4939 color_property markerfacecolor , color_property (radio_values ("{none}|auto|flat"), color_values (0, 0, 0))
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4940 double_property markersize , 6
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4941 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
4942 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
4943 double_property specularcolorreflectance , 1
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4944 double_property specularexponent , 10
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4945 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
4946 array_property vertexnormals u , Matrix ()
18646
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
4947 array_property xdata u , default_surface_xdata ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4948 string_property xdatasource , ""
18646
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
4949 array_property ydata u , default_surface_ydata ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4950 string_property ydatasource , ""
18646
2deed6538c72 Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents: 18645
diff changeset
4951 array_property zdata u , default_surface_zdata ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4952 string_property zdatasource , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4953
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4954 // hidden properties for limit computation
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4955 row_vector_property alim hlr , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4956 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
4957 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
4958 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
4959 row_vector_property zlim hlr , Matrix ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4960 bool_property aliminclude hlg , "on"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4961 bool_property climinclude hlg , "on"
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4962 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
4963 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
4964 bool_property zliminclude hl , "on"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4965 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4966
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4967 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4968 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4969 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4970 xdata.add_constraint (dim_vector (-1, -1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4971 ydata.add_constraint (dim_vector (-1, -1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4972 zdata.add_constraint (dim_vector (-1, -1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4973 cdata.add_constraint ("double");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4974 cdata.add_constraint ("single");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4975 cdata.add_constraint (dim_vector (-1, -1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4976 cdata.add_constraint (dim_vector (-1, -1, 3));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4977 alphadata.add_constraint ("double");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4978 alphadata.add_constraint ("uint8");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4979 alphadata.add_constraint (dim_vector (-1, -1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4980 vertexnormals.add_constraint (dim_vector (-1, -1, 3));
18645
ce144b2ab46c Allow empty matrices as "vertexnormals" value (bug #42083).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18576
diff changeset
4981 vertexnormals.add_constraint (dim_vector (0, 0));
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4982 }
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4983
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
4984 private:
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4985 void update_alphadata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4986 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4987 if (alphadatamapping_is ("scaled"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4988 set_alim (alphadata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4989 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4990 alim = alphadata.get_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4991 }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4992
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4993 void update_cdata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4994 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4995 if (cdatamapping_is ("scaled"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4996 set_clim (cdata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4997 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4998 clim = cdata.get_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4999 }
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
5000
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
5001 void update_xdata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5002 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5003 update_normals ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5004 set_xlim (xdata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5005 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
5006
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
5007 void update_ydata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5008 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5009 update_normals ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5010 set_ylim (ydata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5011 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
5012
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
5013 void update_zdata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5014 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5015 update_normals ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5016 set_zlim (zdata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5017 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
5018
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5019 void update_normals (void);
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
5020
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
5021 void update_normalmode (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5022 { update_normals (); }
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
5023
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
5024 void update_vertexnormals (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5025 { set_normalmode ("manual"); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5026 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5027
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5028 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5029 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5030
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5031 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5032 surface (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5033 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5034 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5035 xproperties.override_defaults (*this);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5036 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5037
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
5038 ~surface (void) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5039
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5040 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5041
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
5042 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
5043
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5044 bool valid_object (void) const { return true; }
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5045
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5046 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5047 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5048 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5049 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5050 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5051 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5052 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5053 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5054
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5055 // ---------------------------------------------------------------------
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5056
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5057 class OCTINTERP_API hggroup : public base_graphics_object
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5058 {
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5059 public:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5060 class OCTINTERP_API properties : public base_properties
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5061 {
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5062 public:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5063 void remove_child (const graphics_handle& h)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5064 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5065 base_properties::remove_child (h);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5066 update_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5067 }
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5068
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5069 void adopt (const graphics_handle& h)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5070 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5071
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5072 base_properties::adopt (h);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5073 update_limits (h);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5074 }
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5075
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5076 // 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
5077 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5078 // Programming note: Keep property list sorted if new ones are added.
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5079
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
5080 BEGIN_PROPERTIES (hggroup)
15519
f915996325b7 Add missing DisplayName and EraseMode properties to hggroups (bug #37442)
Ben Abbott <bpabbott@mac.com>
parents: 15468
diff changeset
5081 string_property displayname , ""
f915996325b7 Add missing DisplayName and EraseMode properties to hggroups (bug #37442)
Ben Abbott <bpabbott@mac.com>
parents: 15468
diff changeset
5082 radio_property erasemode , "{normal}|none|xor|background"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5083
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5084 // hidden properties for limit computation
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5085 row_vector_property alim hr , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5086 row_vector_property clim hr , 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
5087 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
5088 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
5089 row_vector_property zlim hr , Matrix ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5090 bool_property aliminclude h , "on"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5091 bool_property climinclude h , "on"
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5092 bool_property xliminclude h , "on"
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5093 bool_property yliminclude h , "on"
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5094 bool_property zliminclude h , "on"
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5095 END_PROPERTIES
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5096
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5097 private:
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5098 void update_limits (void) const;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5099
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5100 void update_limits (const graphics_handle& h) const;
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5101
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5102 protected:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5103 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5104 { }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
5105
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5106 };
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5107
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5108 private:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5109 properties xproperties;
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5110
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5111 public:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5112 hggroup (const graphics_handle& mh, const graphics_handle& p)
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5113 : base_graphics_object (), xproperties (mh, p)
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5114 {
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5115 xproperties.override_defaults (*this);
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5116 }
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5117
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
5118 ~hggroup (void) { }
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5119
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5120 base_properties& get_properties (void) { return xproperties; }
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5121
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5122 const base_properties& get_properties (void) const { return xproperties; }
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5123
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5124 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
5125
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5126 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
5127
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
5128 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
5129 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
5130
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5131 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5132 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5133 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5134 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5135 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5136 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5137 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5138
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5139 };
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5140
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5141 // ---------------------------------------------------------------------
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5142
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5143 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
5144 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5145 public:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5146 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
5147 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5148 public:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5149 void remove_child (const graphics_handle& h)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5150 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5151 base_properties::remove_child (h);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5152 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5153
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5154 void adopt (const graphics_handle& h)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5155 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5156 base_properties::adopt (h);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5157 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5158
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5159 // 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
5160 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5161 // Programming note: Keep property list sorted if new ones are added.
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5162
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5163 BEGIN_PROPERTIES (uimenu)
13307
cbdefe0ec514 Add __object__ property to uimenu.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13281
diff changeset
5164 any_property __object__ , Matrix ()
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5165 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
5166 callback_property callback , Matrix ()
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5167 bool_property checked , "off"
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5168 bool_property enable , "on"
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5169 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
5170 string_property label , ""
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5171 double_property position , 9
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5172 bool_property separator , "off"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5173 // Octave-specific properties
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5174 string_property fltk_label h , ""
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5175 END_PROPERTIES
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5176
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5177 protected:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5178 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5179 { }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5180 };
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5181
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5182 private:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5183 properties xproperties;
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5184
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5185 public:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5186 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
5187 : base_graphics_object (), xproperties (mh, p)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5188 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5189 xproperties.override_defaults (*this);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5190 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5191
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
5192 ~uimenu (void) { }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5193
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5194 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
5195
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5196 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
5197
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5198 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
5199
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5200 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5201 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5202 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5203 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5204 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5205 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5206 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5207
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5208 };
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5209
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5210 // ---------------------------------------------------------------------
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5211
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5212 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
5213 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5214 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5215 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
5216 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5217 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5218 // 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
5219 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5220 // Programming note: Keep property list sorted if new ones are added.
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5221
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5222 BEGIN_PROPERTIES (uicontextmenu)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5223 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
5224 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
5225 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
5226 END_PROPERTIES
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5227
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5228 protected:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5229 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5230 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5231 position.add_constraint (dim_vector (1, 2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5232 position.add_constraint (dim_vector (2, 1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5233 visible.set (octave_value (true));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5234 }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5235 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5236
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5237 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5238 properties xproperties;
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 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5241 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
5242 : 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
5243 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5244 xproperties.override_defaults (*this);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5245 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5246
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
5247 ~uicontextmenu (void) { }
13703
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 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
5250
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5251 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
5252
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5253 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
5254
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5255 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5256 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5257 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5258 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5259 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5260 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5261 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5262
13703
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
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
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5267 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
5268 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5269 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5270 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
5271 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5272 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5273 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
5274 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
5275
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5276 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
5277
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5278 // 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
5279 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5280 // Programming note: Keep property list sorted if new ones are added.
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5282 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
5283 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
5284 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
5285 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
5286 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
5287 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
5288 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
5289 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
5290 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
5291 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
5292 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
5293 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
5294 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
5295 color_property foregroundcolor , color_values (0, 0, 0)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5296 radio_property horizontalalignment , "left|{center}|right"
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5297 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
5298 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
5299 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
5300 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
5301 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
5302 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
5303 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
5304 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
5305 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
5306 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
5307 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
5308 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
5309 END_PROPERTIES
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5310
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5311 private:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5312 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
5313
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5314 protected:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5315 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5316 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5317 cdata.add_constraint ("double");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5318 cdata.add_constraint ("single");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5319 cdata.add_constraint (dim_vector (-1, -1, 3));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5320 position.add_constraint (dim_vector (1, 4));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5321 sliderstep.add_constraint (dim_vector (1, 2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5322 cached_units = get_units ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5323 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5324
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5325 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
5326
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5327 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
5328 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
5329 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
5330 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
5331 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
5332 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
5333
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5334 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
5335
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5336 };
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5337
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5338 private:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5339 properties xproperties;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5340
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5341 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5342 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
5343 : 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
5344 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5345 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
5346 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5347
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
5348 ~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
5349
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5350 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
5351
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5352 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
5353
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5354 bool valid_object (void) const { return true; }
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5355
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5356 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5357 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5358 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5359 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5360 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5361 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5362 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5363 };
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5364
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5365 // ---------------------------------------------------------------------
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5366
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5367 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
5368 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5369 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5370 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
5371 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5372 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5373 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
5374 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
5375
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5376 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
5377
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5378 // 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
5379 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5380 // Programming note: Keep property list sorted if new ones are added.
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5381
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5382 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
5383 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
5384 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
5385 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
5386 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
5387 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
5388 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
5389 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
5390 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
5391 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
5392 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
5393 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
5394 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
5395 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
5396 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
5397 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
5398 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
5399 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
5400 END_PROPERTIES
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5401
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5402 protected:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5403 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
5404 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5405 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
5406 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5407
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5408 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
5409 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
5410
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5411 };
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5412
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5413 private:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5414 properties xproperties;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5415
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5416 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5417 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
5418 : 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
5419 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5420 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
5421 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5422
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
5423 ~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
5424
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5425 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
5426
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5427 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
5428
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5429 bool valid_object (void) const { return true; }
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5430
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5431 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5432 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5433 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5434 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5435 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5436 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5437 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5438 };
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5439
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5440 // ---------------------------------------------------------------------
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5441
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5442 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
5443 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5444 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5445 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
5446 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5447 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5448 // 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
5449 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5450 // Programming note: Keep property list sorted if new ones are added.
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5451
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5452 BEGIN_PROPERTIES (uitoolbar)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5453 any_property __object__ , Matrix ()
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5454 END_PROPERTIES
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5455
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5456 protected:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5457 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5458 { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5459 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5460
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5461 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5462 properties xproperties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5463
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5464 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5465 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
5466 : 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
5467 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5468 xproperties.override_defaults (*this);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5469 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5470
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
5471 ~uitoolbar (void) { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5472
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5473 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
5474 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5475 // 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
5476 // 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
5477 xproperties.override_defaults (obj);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5478
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5479 // 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
5480 // 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
5481 // 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
5482 // 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
5483 // 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
5484 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
5485 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5486
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5487 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
5488 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5489 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
5490 // 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
5491 // 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
5492 // default_properties map.
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5493 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
5494 else
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5495 xproperties.set (name, value);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5496 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5497
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5498 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
5499 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5500 octave_value retval;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5501
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5502 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
5503 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
5504 else
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5505 retval = xproperties.get (name);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5506
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5507 return retval;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5508 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5509
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5510 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
5511
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5512 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
5513 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5514 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
5515 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5516
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5517 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
5518
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5519 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
5520
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5521 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
5522
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5523 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
5524
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5525 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5526 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5527 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5528 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5529 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5530 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5531 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5532
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5533 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5534 property_list default_properties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5535 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5536
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5537 // ---------------------------------------------------------------------
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5538
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5539 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
5540 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5541 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5542 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
5543 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5544 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5545 // 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
5546 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5547 // Programming note: Keep property list sorted if new ones are added.
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5548
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5549 BEGIN_PROPERTIES (uipushtool)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5550 any_property __object__ , Matrix ()
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5551 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
5552 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
5553 bool_property enable , "on"
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5554 bool_property separator , "off"
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5555 string_property tooltipstring , ""
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5556 END_PROPERTIES
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5557
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5558 protected:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5559 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5560 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5561 cdata.add_constraint ("double");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5562 cdata.add_constraint ("single");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5563 cdata.add_constraint (dim_vector (-1, -1, 3));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5564 }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5565 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5566
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5567 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5568 properties xproperties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5569
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5570 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5571 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
5572 : 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
5573 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5574 xproperties.override_defaults (*this);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5575 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5576
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
5577 ~uipushtool (void) { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5578
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5579 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
5580
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5581 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
5582
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5583 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
5584
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5585 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5586 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5587 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5588 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5589 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5590 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5591 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5592
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5593 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5594
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5595 // ---------------------------------------------------------------------
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5596
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5597 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
5598 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5599 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5600 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
5601 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5602 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5603 // 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
5604 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5605 // Programming note: Keep property list sorted if new ones are added.
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5606
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5607 BEGIN_PROPERTIES (uitoggletool)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5608 any_property __object__ , Matrix ()
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5609 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
5610 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
5611 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
5612 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
5613 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
5614 bool_property separator , "off"
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5615 bool_property state , "off"
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5616 string_property tooltipstring , ""
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5617 END_PROPERTIES
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5618
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5619 protected:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5620 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5621 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5622 cdata.add_constraint ("double");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5623 cdata.add_constraint ("single");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5624 cdata.add_constraint (dim_vector (-1, -1, 3));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5625 }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5626 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5627
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5628 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5629 properties xproperties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5630
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5631 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5632 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
5633 : 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
5634 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5635 xproperties.override_defaults (*this);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5636 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5637
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
5638 ~uitoggletool (void) { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5639
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5640 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
5641
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5642 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
5643
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5644 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
5645
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5646 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5647 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5648 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5649 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5650 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5651 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5652 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5653
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5654 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5655
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5656 // ---------------------------------------------------------------------
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5657
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5658 octave_value
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
5659 get_property_from_handle (double handle, const std::string& property,
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
5660 const std::string& func);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5661 bool
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
5662 set_property_in_handle (double handle, const std::string& property,
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
5663 const octave_value& arg, const std::string& func);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5664
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5665 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5666
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5667 class graphics_event;
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5668
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5669 class
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5670 base_graphics_event
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5671 {
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5672 public:
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5673 friend class graphics_event;
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5674
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5675 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
5676
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5677 virtual ~base_graphics_event (void) { }
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5678
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5679 virtual void execute (void) = 0;
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5680
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5681 private:
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13938
diff changeset
5682 octave_refcount<int> count;
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5683 };
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5684
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5685 class
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5686 graphics_event
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5687 {
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5688 public:
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5689 typedef void (*event_fcn) (void*);
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5690
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5691 graphics_event (void) : rep (0) { }
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5692
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
5693 graphics_event (const graphics_event& e) : rep (e.rep)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5694 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5695 rep->count++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5696 }
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5697
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5698 ~graphics_event (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5699 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5700 if (rep && --rep->count == 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5701 delete rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5702 }
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5703
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5704 graphics_event& operator = (const graphics_event& e)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5705 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5706 if (rep != e.rep)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5707 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5708 if (rep && --rep->count == 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5709 delete rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5710
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5711 rep = e.rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5712 if (rep)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5713 rep->count++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5714 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5715
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5716 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5717 }
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5718
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5719 void execute (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5720 { if (rep) rep->execute (); }
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5721
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5722 bool ok (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5723 { return (rep != 0); }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5724
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5725 static graphics_event
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5726 create_callback_event (const graphics_handle& h,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5727 const std::string& name,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5728 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
5729
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5730 static graphics_event
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5731 create_callback_event (const graphics_handle& h,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5732 const octave_value& cb,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5733 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
5734
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5735 static graphics_event
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5736 create_function_event (event_fcn fcn, void *data = 0);
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5737
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5738 static graphics_event
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5739 create_set_event (const graphics_handle& h, const std::string& name,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5740 const octave_value& value,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5741 bool notify_toolkit = true);
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5742 private:
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5743 base_graphics_event *rep;
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5744 };
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5745
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
5746 class OCTINTERP_API gh_manager
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5747 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5748 protected:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5749
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5750 gh_manager (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5751
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5752 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5753
13992
e1f76bfe0452 apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents: 13985
diff changeset
5754 static void create_instance (void);
e1f76bfe0452 apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents: 13985
diff changeset
5755
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5756 static bool instance_ok (void)
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 bool retval = true;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5759
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5760 if (! instance)
13992
e1f76bfe0452 apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents: 13985
diff changeset
5761 create_instance ();
6874
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 if (! instance)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5764 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5765 ::error ("unable to create gh_manager!");
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5766
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5767 retval = false;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5768 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5769
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5770 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5771 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5772
13992
e1f76bfe0452 apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents: 13985
diff changeset
5773 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
5774
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5775 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
5776 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5777 return instance_ok ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5778 ? instance->do_get_handle (integer_figure_handle)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5779 : graphics_handle ();
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5780 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5781
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5782 static void free (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5783 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5784 if (instance_ok ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5785 instance->do_free (h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5786 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5787
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5788 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
5789 const graphics_handle& new_gh)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5790 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5791 if (instance_ok ())
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5792 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
5793 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
5794
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5795 static graphics_handle lookup (double val)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5796 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5797 return instance_ok () ? instance->do_lookup (val) : graphics_handle ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5798 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5799
10265
8c583af2cf64 validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents: 10161
diff changeset
5800 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
5801 {
8c583af2cf64 validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents: 10161
diff changeset
5802 return val.is_real_scalar ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5803 ? lookup (val.double_value ()) : graphics_handle ();
10265
8c583af2cf64 validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents: 10161
diff changeset
5804 }
8c583af2cf64 validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents: 10161
diff changeset
5805
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
5806 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
5807 {
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
5808 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
5809 }
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
5810
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5811 static graphics_object get_object (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5812 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5813 return instance_ok () ? instance->do_get_object (h) : graphics_object ();
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5816 static graphics_handle
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5817 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
5818 const graphics_handle& parent,
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5819 bool integer_figure_handle = false,
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5820 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
5821 bool do_notify_toolkit = true)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5822 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5823 return instance_ok ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5824 ? instance->do_make_graphics_handle (go_name, parent,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5825 integer_figure_handle,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5826 do_createfcn, do_notify_toolkit)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5827 : graphics_handle ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5828 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5829
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5830 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
5831 bool do_notify_toolkit = true)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5832 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5833 return instance_ok ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5834 ? instance->do_make_figure_handle (val, do_notify_toolkit)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5835 : graphics_handle ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5836 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5837
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5838 static void push_figure (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5839 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5840 if (instance_ok ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5841 instance->do_push_figure (h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5842 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5843
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5844 static void pop_figure (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5845 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5846 if (instance_ok ())
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5847 instance->do_pop_figure (h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5848 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5849
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5850 static graphics_handle current_figure (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5851 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5852 return instance_ok ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5853 ? instance->do_current_figure () : graphics_handle ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5854 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5855
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5856 static Matrix handle_list (bool show_hidden = false)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5857 {
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5858 return instance_ok ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5859 ? instance->do_handle_list (show_hidden) : Matrix ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5860 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5861
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5862 static void lock (void)
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5863 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5864 if (instance_ok ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5865 instance->do_lock ();
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5866 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5867
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5868 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
5869 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5870 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
5871 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
5872 else
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5873 return false;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5874 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5875
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5876 static void unlock (void)
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5877 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5878 if (instance_ok ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5879 instance->do_unlock ();
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5880 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5881
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5882 static Matrix figure_handle_list (bool show_hidden = false)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5883 {
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
5884 return instance_ok ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5885 ? instance->do_figure_handle_list (show_hidden) : Matrix ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5886 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5887
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5888 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
5889 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
5890 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5891 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
5892 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
5893 }
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5894
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5895 static void execute_callback (const graphics_handle& h,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5896 const std::string& name,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5897 const octave_value& data = Matrix ())
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5898 {
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5899 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
5900
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5901 if (true)
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5902 {
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5903 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
5904
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5905 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
5906
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5907 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
5908 cb = go.get (name);
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5909 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5910
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5911 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
5912 execute_callback (h, cb, data);
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5913 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5914
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5915 static void execute_callback (const graphics_handle& h,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5916 const octave_value& cb,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5917 const octave_value& data = Matrix ())
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5918 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5919 if (instance_ok ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5920 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
5921 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5922
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5923 static void post_callback (const graphics_handle& h,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5924 const std::string& name,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
5925 const octave_value& data = Matrix ())
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5926 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5927 if (instance_ok ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5928 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
5929 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5930
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
5931 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
5932 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5933 if (instance_ok ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5934 instance->do_post_function (fcn, data);
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5935 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5936
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5937 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
5938 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
5939 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5940 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
5941 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
5942 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5943
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5944 static int process_events (void)
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5945 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5946 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
5947 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5948
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5949 static int flush_events (void)
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5950 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5951 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
5952 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5953
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5954 static void enable_event_processing (bool enable = true)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5955 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5956 if (instance_ok ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5957 instance->do_enable_event_processing (enable);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5958 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5959
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5960 static bool is_handle_visible (const graphics_handle& h)
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5961 {
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5962 bool retval = false;
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5963
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5964 graphics_object go = get_object (h);
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5965
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5966 if (go.valid_object ())
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5967 retval = go.is_handle_visible ();
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5968
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5969 return retval;
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5970 }
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
5971
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
5972 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
5973 {
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
5974 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
5975 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
5976 }
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
5977
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5978 public:
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5979 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
5980 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5981 public:
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5982 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
5983 : 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
5984 ? 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
5985 : octave_mutex (),
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5986 wait)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5987 { }
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5988
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5989 private:
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5990
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5991 // 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
5992 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
5993 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
5994 };
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
5995
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5996 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5997
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5998 static gh_manager *instance;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5999
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6000 typedef std::map<graphics_handle, graphics_object>::iterator iterator;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6001 typedef std::map<graphics_handle, graphics_object>::const_iterator
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6002 const_iterator;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6003
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6004 typedef std::set<graphics_handle>::iterator free_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6005 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
6006
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6007 typedef std::list<graphics_handle>::iterator figure_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6008 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
6009
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6010 // A map of handles to graphics objects.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6011 std::map<graphics_handle, graphics_object> handle_map;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6012
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6013 // The available graphics handles.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6014 std::set<graphics_handle> handle_free_list;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6015
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6016 // 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
6017 double next_handle;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6018
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6019 // 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
6020 // created.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6021 std::list<graphics_handle> figure_list;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6022
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
6023 // 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
6024 octave_mutex graphics_lock;
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6025
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
6026 // 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
6027 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
6028
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
6029 // The stack of callback objects.
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6030 std::list<graphics_object> callback_objects;
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6031
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
6032 // 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
6033 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
6034
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
6035 graphics_handle do_get_handle (bool integer_figure_handle);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6036
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6037 void do_free (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6038
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
6039 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
6040 const graphics_handle& new_gh);
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
6041
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6042 graphics_handle do_lookup (double val)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6043 {
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
6044 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
6045
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6046 return (p != handle_map.end ()) ? p->first : graphics_handle ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6047 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6048
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6049 graphics_object do_get_object (const graphics_handle& h)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6050 {
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
6051 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
6052
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6053 return (p != handle_map.end ()) ? p->second : graphics_object ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6054 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6055
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6056 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
6057 const graphics_handle& p,
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6058 bool integer_figure_handle,
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6059 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
6060 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
6061
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
6062 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
6063
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6064 Matrix do_handle_list (bool show_hidden)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6065 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6066 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
6067
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6068 octave_idx_type i = 0;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6069 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
6070 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
6071 graphics_handle h = p->first;
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6072
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6073 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
6074 retval(i++) = h.value ();
7056
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
6075 }
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6076
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6077 retval.resize (1, i);
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6078
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6079 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6080 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6081
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6082 Matrix do_figure_handle_list (bool show_hidden)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6083 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6084 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
6085
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6086 octave_idx_type i = 0;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6087 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
6088 p != figure_list.end ();
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
6089 p++)
7056
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
6090 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
6091 graphics_handle h = *p;
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6092
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6093 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
6094 retval(i++) = h.value ();
7056
2002804df782 [project @ 2007-10-24 00:32:44 by jwe]
jwe
parents: 7020
diff changeset
6095 }
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6096
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6097 retval.resize (1, i);
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6098
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6099 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6100 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6101
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6102 void do_push_figure (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6103
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6104 void do_pop_figure (const graphics_handle& h);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6105
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6106 graphics_handle do_current_figure (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6107 {
13801
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6108 graphics_handle retval;
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6109
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6110 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
6111 p != figure_list.end ();
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6112 p++)
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6113 {
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6114 graphics_handle h = *p;
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6115
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6116 if (is_handle_visible (h))
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6117 retval = h;
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6118 }
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6119
195ff3561152 allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
6120 return retval;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6121 }
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6122
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6123 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
6124
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
6125 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
6126
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6127 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
6128
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
6129 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
6130
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6131 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
6132 const octave_value& data);
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6133
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
6134 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
6135 const octave_value& data);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6136
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6137 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
6138
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
6139 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
6140 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
6141
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6142 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
6143
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
6144 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
6145
9397
394c7adb488f graphics.h.in (gh_manager::restore_gcbo): fix decl for unwind-protect
John W. Eaton <jwe@octave.org>
parents: 9347
diff changeset
6146 static void restore_gcbo (void)
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6147 {
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6148 if (instance_ok ())
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6149 instance->do_restore_gcbo ();
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6150 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6151
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6152 void do_restore_gcbo (void);
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6153
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6154 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
6155
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
6156 void do_enable_event_processing (bool enable = true);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6157 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6158
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
6159 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
6160 double& min_pos, double& max_neg,
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
6161 const Matrix& kids, char limit_type);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6162
10917
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10792
diff changeset
6163 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
6164
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6165 // 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
6166 OCTINTERP_API graphics_handle gcf (void);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6167
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6168 // 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
6169 OCTINTERP_API graphics_handle gca (void);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6170
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
6171 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
6172
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6173 #endif