Mercurial > octave
annotate libinterp/corefcn/graphics.in.h @ 23012:27e4ec3b0b49
move octave_refcount inside octave namespace
* oct-refcount.h (refcount): Move inside octave namespace and rename
from octave_refcount. Change all uses.
(octave_refcount): Provide (deprecated) backward-compatible using
declaration.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 06 Jan 2017 18:06:31 -0500 |
parents | b69e39c3e200 |
children | bb7513d73673 |
rev | line source |
---|---|
6874 | 1 /* |
2 | |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
22319
diff
changeset
|
3 Copyright (C) 2007-2016 John W. Eaton |
6874 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22723
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22723
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22723
diff
changeset
|
10 (at your option) any later version. |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22723
diff
changeset
|
11 |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22723
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22723
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22723
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22723
diff
changeset
|
15 GNU General Public License for more details. |
6874 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
6874 | 20 |
21 */ | |
22 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
20785
diff
changeset
|
23 #if ! defined (octave_graphics_h) |
17822
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 | 25 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21209
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21209
diff
changeset
|
27 |
6874 | 28 #include <cctype> |
29 | |
30 #include <algorithm> | |
31 #include <list> | |
32 #include <map> | |
33 #include <set> | |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
34 #include <sstream> |
6874 | 35 #include <string> |
36 | |
11075
4e31d44a9763
extract caseless_str class to separate header file
John W. Eaton <jwe@octave.org>
parents:
11074
diff
changeset
|
37 #include "caseless-str.h" |
9004
17ba311ef110
add one more missing include
Jaroslav Hajek <highegg@gmail.com>
parents:
8944
diff
changeset
|
38 |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21055
diff
changeset
|
39 #include "errwarn.h" |
17544
fc31cd1bd503
extract handle object to a separate file
John W. Eaton <jwe@octave.org>
parents:
17529
diff
changeset
|
40 #include "oct-handle.h" |
6874 | 41 #include "oct-map.h" |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
42 #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
|
43 #include "oct-refcount.h" |
6874 | 44 #include "ov.h" |
21209
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
45 #include "text-renderer.h" |
6874 | 46 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
47 // 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
|
48 // 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
|
49 // gnuplot users. |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
20785
diff
changeset
|
50 #if ! defined (OCTAVE_DEFAULT_FONTNAME) |
8944
cb0e9facc342
make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
51 #define OCTAVE_DEFAULT_FONTNAME "*" |
cb0e9facc342
make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
52 #endif |
cb0e9facc342
make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
53 |
17544
fc31cd1bd503
extract handle object to a separate file
John W. Eaton <jwe@octave.org>
parents:
17529
diff
changeset
|
54 typedef octave_handle graphics_handle; |
6874 | 55 |
56 // --------------------------------------------------------------------- | |
57 | |
7427 | 58 class base_scaler |
59 { | |
60 public: | |
61 base_scaler (void) { } | |
62 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
63 virtual ~base_scaler (void) = default; |
7440 | 64 |
20893
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
65 virtual Matrix scale (const Matrix&) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
67 error ("invalid axis scale"); |
20893
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
68 } |
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
69 |
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
70 virtual NDArray scale (const NDArray&) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
71 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
72 error ("invalid axis scale"); |
20893
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
73 } |
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
74 |
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
75 virtual double scale (double) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
76 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
77 error ("invalid axis scale"); |
20893
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
78 } |
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
79 |
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
80 virtual double unscale (double) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
81 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
82 error ("invalid axis scale"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
83 } |
7427 | 84 |
85 virtual base_scaler* clone () const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
86 { 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
|
87 |
e06fdf7ea647
Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7830
diff
changeset
|
88 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
|
89 { return false; } |
7427 | 90 }; |
91 | |
92 class lin_scaler : public base_scaler | |
93 { | |
94 public: | |
95 lin_scaler (void) { } | |
96 | |
97 Matrix scale (const Matrix& m) const { return m; } | |
98 | |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
99 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
|
100 |
7427 | 101 double scale (double d) const { return d; } |
102 | |
103 double unscale (double d) const { return d; } | |
104 | |
105 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
|
106 |
e06fdf7ea647
Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7830
diff
changeset
|
107 bool is_linear (void) const { return true; } |
7427 | 108 }; |
109 | |
110 class log_scaler : public base_scaler | |
111 { | |
112 public: | |
113 log_scaler (void) { } | |
114 | |
115 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
|
116 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
117 Matrix retval (m.rows (), m.cols ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
118 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
119 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
|
120 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
121 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
122 } |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
123 |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
124 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
|
125 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
126 NDArray retval (m.dims ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
127 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
128 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
|
129 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
130 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
131 } |
7427 | 132 |
133 double scale (double d) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
134 { return log10 (d); } |
7427 | 135 |
136 double unscale (double d) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
137 { return pow (10.0, d); } |
7427 | 138 |
139 base_scaler* clone (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
140 { 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
|
141 |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
142 private: |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
143 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
|
144 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
145 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
|
146 dest[i] = log10 (src[i]); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
147 } |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
148 }; |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
149 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
150 class neg_log_scaler : public base_scaler |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
151 { |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
152 public: |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
153 neg_log_scaler (void) { } |
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 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
|
156 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
157 Matrix retval (m.rows (), m.cols ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
158 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
159 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
|
160 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
161 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
162 } |
13756
6dfebfa334cb
allow negative data log plots with OpenGL+FLTK graphics (bug #34232)
John W. Eaton <jwe@octave.org>
parents:
13722
diff
changeset
|
163 |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
164 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
|
165 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
166 NDArray retval (m.dims ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
167 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
168 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
|
169 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
170 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
171 } |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
172 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
173 double scale (double d) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
174 { return -log10 (-d); } |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
175 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
176 double unscale (double d) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
177 { return -pow (10.0, -d); } |
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 base_scaler* clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
180 { return new neg_log_scaler (); } |
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 private: |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
183 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
|
184 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
185 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
|
186 dest[i] = -log10 (-src[i]); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
187 } |
7427 | 188 }; |
189 | |
190 class scaler | |
191 { | |
192 public: | |
193 scaler (void) : rep (new base_scaler ()) { } | |
194 | |
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
|
195 scaler (const scaler& s) : rep (s.rep->clone ()) { } |
7427 | 196 |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
197 scaler (const std::string& s) |
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
198 : rep (s == "log" |
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
199 ? new log_scaler () |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
200 : (s == "neglog" ? new neg_log_scaler () |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
201 : (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
|
202 { } |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
203 |
7427 | 204 ~scaler (void) { delete rep; } |
205 | |
206 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
|
207 { return rep->scale (m); } |
7427 | 208 |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
209 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
|
210 { 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
|
211 |
7427 | 212 double scale (double d) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
213 { return rep->scale (d); } |
7427 | 214 |
215 double unscale (double d) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
216 { return rep->unscale (d); } |
7427 | 217 |
7832
e06fdf7ea647
Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7830
diff
changeset
|
218 bool is_linear (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
219 { 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
|
220 |
7427 | 221 scaler& operator = (const scaler& s) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
222 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
223 if (rep) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
224 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
225 delete rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
226 rep = 0; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
227 } |
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 rep = s.rep->clone (); |
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 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
232 } |
7427 | 233 |
234 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
|
235 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
236 if (rep) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
237 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
238 delete rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
239 rep = 0; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
240 } |
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 (s == "log") |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
243 rep = new log_scaler (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
244 else if (s == "neglog") |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
245 rep = new neg_log_scaler (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
246 else if (s == "linear") |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
247 rep = new lin_scaler (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
248 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
249 rep = new base_scaler (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
250 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
251 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
252 } |
7427 | 253 |
254 private: | |
255 base_scaler *rep; | |
256 }; | |
257 | |
258 // --------------------------------------------------------------------- | |
259 | |
7363 | 260 class property; |
261 | |
13924
3b654a0753b1
Implement waitfor, uiwait and uiresume.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13868
diff
changeset
|
262 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
|
263 |
7363 | 264 class base_property |
265 { | |
266 public: | |
267 friend class property; | |
268 | |
269 public: | |
12174 | 270 base_property (void) |
271 : 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
|
272 { } |
7363 | 273 |
274 base_property (const std::string& s, const graphics_handle& h) | |
12174 | 275 : 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
|
276 { } |
7363 | 277 |
278 base_property (const base_property& p) | |
12174 | 279 : id (-1), count (1), name (p.name), parent (p.parent), |
280 hidden (p.hidden), listeners () | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
281 { } |
7363 | 282 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
283 virtual ~base_property (void) = default; |
7363 | 284 |
285 bool ok (void) const { return parent.ok (); } | |
286 | |
287 std::string get_name (void) const { return name; } | |
288 | |
289 void set_name (const std::string& s) { name = s; } | |
290 | |
291 graphics_handle get_parent (void) const { return parent; } | |
292 | |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
293 void set_parent (const graphics_handle& h) { parent = h; } |
7363 | 294 |
295 bool is_hidden (void) const { return hidden; } | |
296 | |
297 void set_hidden (bool flag) { hidden = flag; } | |
298 | |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
299 virtual bool is_radio (void) const { return false; } |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
300 |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
301 int get_id (void) const { return id; } |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
302 |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
303 void set_id (int d) { id = d; } |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
304 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
305 // Sets property value, notifies graphics toolkit. |
8058
ca39c21fa4b8
[mq]: generic_octave_to_backend_nofitication
John W. Eaton <jwe@octave.org>
parents:
8052
diff
changeset
|
306 // If do_run is true, runs associated listeners. |
13321
5ea207067ee5
Export base_property::set.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13307
diff
changeset
|
307 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
|
308 bool do_notify_toolkit = true); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
309 |
7363 | 310 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
|
311 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
312 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
|
313 } |
7363 | 314 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
315 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
|
316 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
317 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
|
318 } |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
319 |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
320 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
|
321 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
322 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
|
323 } |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
324 |
7363 | 325 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
|
326 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
327 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
328 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
329 } |
7363 | 330 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
331 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
|
332 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
333 octave_value_list& l = listeners[mode]; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
334 l.resize (l.length () + 1, v); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
335 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
336 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
337 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
|
338 listener_mode mode = POSTSET) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
339 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
340 octave_value_list& l = listeners[mode]; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
341 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
342 if (v.is_defined ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
343 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
344 bool found = false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
345 int i; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
346 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
347 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
|
348 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
349 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
|
350 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
351 found = true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
352 break; |
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 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
355 if (found) |
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 (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
|
358 l(j) = l(j + 1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
359 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
360 l.resize (l.length () - 1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
361 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
362 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
363 else |
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 (mode == PERSISTENT) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
366 l.resize (0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
367 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
368 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
369 octave_value_list lnew (0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
370 octave_value_list& lp = listeners[PERSISTENT]; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
371 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
|
372 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
373 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
|
374 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
375 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
|
376 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
377 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
|
378 break; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
379 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
380 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
381 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
382 l = lnew; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
383 } |
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 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
386 } |
8299
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
387 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
388 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
|
389 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
390 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
|
391 { return new base_property (*this); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
392 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
393 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
394 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
|
395 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
396 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
|
397 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
398 |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
399 private: |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
400 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
|
401 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
|
402 listener_map_iterator; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
403 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
|
404 listener_map_const_iterator; |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
405 |
7363 | 406 private: |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
407 int id; |
23012
27e4ec3b0b49
move octave_refcount inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23002
diff
changeset
|
408 octave::refcount<int> count; |
7363 | 409 std::string name; |
410 graphics_handle parent; | |
411 bool hidden; | |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
412 listener_map listeners; |
7363 | 413 }; |
414 | |
415 // --------------------------------------------------------------------- | |
416 | |
417 class string_property : public base_property | |
418 { | |
419 public: | |
420 string_property (const std::string& s, const graphics_handle& h, | |
421 const std::string& val = "") | |
422 : base_property (s, h), str (val) { } | |
423 | |
424 string_property (const string_property& p) | |
425 : base_property (p), str (p.str) { } | |
426 | |
427 octave_value get (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
428 { return octave_value (str); } |
7363 | 429 |
430 std::string string_value (void) const { return str; } | |
431 | |
432 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
|
433 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
434 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
435 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
436 } |
7363 | 437 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
438 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
|
439 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
440 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
441 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
|
442 { |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
443 if (! val.is_string ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
444 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
|
445 get_name ().c_str ()); |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
446 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
447 std::string new_str = val.string_value (); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
448 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
449 if (new_str != str) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
450 { |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
451 str = new_str; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
452 return true; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
453 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
454 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
455 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
456 |
7363 | 457 private: |
458 std::string str; | |
459 }; | |
460 | |
461 // --------------------------------------------------------------------- | |
462 | |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
463 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
|
464 { |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
465 public: |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
466 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
|
467 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
468 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
|
469 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
|
470 const desired_enum& typ = string_t) |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
471 : 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
|
472 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
473 size_t pos = 0; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
474 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
475 while (true) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
476 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
477 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
|
478 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
479 if (new_pos == std::string::npos) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
480 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
481 str.append (val.substr (pos)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
482 break; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
483 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
484 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
485 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
|
486 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
487 pos = new_pos + 1; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
488 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
489 } |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
490 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
491 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
|
492 const Cell& c, const char& sep = '|', |
830f27544bb7
Accept char array inputs for linestyleorder property (bug #34906).
Rik <rik@octave.org>
parents:
16832
diff
changeset
|
493 const desired_enum& typ = string_t) |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
494 : 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
|
495 { |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
496 if (! c.is_cellstr ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
497 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
|
498 get_name ().c_str ()); |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
499 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
500 string_vector strings (c.numel ()); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
501 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
502 for (octave_idx_type i = 0; i < c.numel (); i++) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
503 strings[i] = c(i).string_value (); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
504 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
505 str = strings; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
506 } |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
507 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
508 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
|
509 : 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
|
510 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
|
511 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
512 octave_value get (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
513 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
514 if (desired_type == string_t) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
515 return octave_value (string_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
516 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
517 return octave_value (cell_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
518 } |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
519 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
520 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
|
521 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
522 std::string s; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
523 |
20232
a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents:
20181
diff
changeset
|
524 for (octave_idx_type i = 0; i < str.numel (); i++) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
525 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
526 s += str[i]; |
20232
a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents:
20181
diff
changeset
|
527 if (i != str.numel () - 1) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
528 s += separator; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
529 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
530 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
531 return s; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
532 } |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
533 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
534 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
|
535 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
536 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
|
537 |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
538 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
|
539 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
540 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
541 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
542 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
543 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
544 base_property* clone (void) const |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
545 { 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
|
546 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
547 protected: |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
548 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
|
549 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
550 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
|
551 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
552 bool replace = false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
553 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
|
554 string_vector strings; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
555 size_t pos = 0; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
556 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
557 // Split single string on delimiter (usually '|') |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
558 while (pos != std::string::npos) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
559 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
560 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
|
561 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
562 if (new_pos == std::string::npos) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
563 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
564 strings.append (new_str.substr (pos)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
565 break; |
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 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
568 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
|
569 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
570 pos = new_pos + 1; |
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 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
573 if (str.numel () == strings.numel ()) |
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 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
|
576 if (strings[i] != str[i]) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
577 { |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
578 replace = true; |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
579 break; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
580 } |
17787
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 replace = true; |
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 desired_type = string_t; |
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 if (replace) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
588 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
589 str = strings; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
590 return true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
591 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
592 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
593 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
|
594 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
595 bool replace = false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
596 charMatrix chm = val.char_matrix_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
597 octave_idx_type nel = chm.rows (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
598 string_vector strings (nel); |
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 if (nel != str.numel ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
601 replace = true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
602 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
|
603 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
604 strings[i] = chm.row_as_string (i); |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20946
diff
changeset
|
605 if (! replace && strings[i] != str[i]) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
606 replace = true; |
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 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
609 desired_type = string_t; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
610 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
611 if (replace) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
612 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
613 str = strings; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
614 return true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
615 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
616 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
617 else if (val.is_cellstr ()) |
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 bool replace = false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
620 Cell new_cell = val.cell_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
621 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
622 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
|
623 |
20232
a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents:
20181
diff
changeset
|
624 octave_idx_type nel = strings.numel (); |
a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents:
20181
diff
changeset
|
625 |
a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents:
20181
diff
changeset
|
626 if (nel != str.numel ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
627 replace = true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
628 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
629 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
630 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
|
631 { |
10585
9f55d3ce490a
avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents:
10566
diff
changeset
|
632 if (strings[i] != str[i]) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
633 { |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
634 replace = true; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
635 break; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
636 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
637 } |
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 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
640 desired_type = cell_t; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
641 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
642 if (replace) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
643 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
644 str = strings; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
645 return true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
646 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
647 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
648 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
649 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
|
650 get_name ().c_str ()); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
651 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
652 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
653 } |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
654 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
655 private: |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
656 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
|
657 char separator; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
658 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
|
659 }; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
660 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
661 // --------------------------------------------------------------------- |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
662 |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
663 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
|
664 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
665 public: |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
666 enum type { char_t, cellstr_t }; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
667 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
668 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
|
669 const std::string& val = "") |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
670 : 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
|
671 { } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
672 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
673 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
|
674 const NDArray& nda) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
675 : 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
|
676 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
677 octave_idx_type nel = nda.numel (); |
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 value.resize (nel); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
680 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
681 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
|
682 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
683 std::ostringstream buf; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
684 buf << nda(i); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
685 value[i] = buf.str (); |
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 } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
688 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
689 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
|
690 const Cell& c) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
691 : 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
|
692 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
693 octave_idx_type nel = c.numel (); |
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 value.resize (nel); |
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 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
|
698 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
699 octave_value tmp = c(i); |
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 if (tmp.is_string ()) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
702 value[i] = c(i).string_value (); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
703 else |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
704 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
705 double d = c(i).double_value (); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
706 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
707 std::ostringstream buf; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
708 buf << d; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
709 value[i] = buf.str (); |
12959
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 } |
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 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
714 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
|
715 : 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
|
716 { } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
717 |
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
|
718 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
|
719 { |
22bc9ec80c2c
allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents:
12959
diff
changeset
|
720 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
|
721 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
|
722 } |
22bc9ec80c2c
allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents:
12959
diff
changeset
|
723 |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
724 octave_value get (void) const |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
725 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
726 if (stored_type == char_t) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
727 return octave_value (char_value ()); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
728 else |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
729 return octave_value (cell_value ()); |
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 std::string string_value (void) const |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
733 { |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
734 return value.empty () ? "" : value[0]; |
12959
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 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
737 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
|
738 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
739 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
|
740 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
741 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
|
742 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
743 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
|
744 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
745 set (val); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
746 return *this; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
747 } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
748 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
749 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
|
750 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
751 protected: |
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 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
|
754 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
755 if (val.is_string ()) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
756 { |
20990
fc9cca99b2de
Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents:
20976
diff
changeset
|
757 value = val.string_vector_value (); |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
758 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
759 stored_type = char_t; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
760 } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
761 else if (val.is_cell ()) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
762 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
763 Cell c = val.cell_value (); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
764 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
765 octave_idx_type nel = c.numel (); |
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 value.resize (nel); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
768 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
769 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
|
770 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
771 octave_value tmp = c(i); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
772 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
773 if (tmp.is_string ()) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
774 value[i] = c(i).string_value (); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
775 else |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
776 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
777 double d = c(i).double_value (); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
778 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
779 std::ostringstream buf; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
780 buf << d; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
781 value[i] = buf.str (); |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
782 } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
783 } |
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
|
784 |
22bc9ec80c2c
allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents:
12959
diff
changeset
|
785 stored_type = cellstr_t; |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
786 } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
787 else |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
788 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
789 NDArray nda; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
790 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
791 try |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
792 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
793 nda = val.array_value (); |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
794 } |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
795 catch (octave::execution_exception& e) |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
796 { |
20756
200ae1d650b7
propagate octave_execution_exception objects through try/catch blocks
John W. Eaton <jwe@octave.org>
parents:
20738
diff
changeset
|
797 error (e, "set: invalid string property value for \"%s\"", |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
798 get_name ().c_str ()); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
799 } |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
800 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
801 octave_idx_type nel = nda.numel (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
802 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
803 value.resize (nel); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
804 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
805 for (octave_idx_type i = 0; i < nel; i++) |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
806 { |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
807 std::ostringstream buf; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
808 buf << nda(i); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
809 value[i] = buf.str (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
810 } |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
811 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
812 stored_type = char_t; |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
813 } |
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 return true; |
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 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
818 private: |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
819 string_vector value; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
820 type stored_type; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
821 }; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
822 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
823 // --------------------------------------------------------------------- |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
824 |
7363 | 825 class radio_values |
826 { | |
827 public: | |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
828 OCTINTERP_API radio_values (const std::string& opt_string = ""); |
7363 | 829 |
830 radio_values (const radio_values& a) | |
831 : default_val (a.default_val), possible_vals (a.possible_vals) { } | |
832 | |
833 radio_values& operator = (const radio_values& a) | |
834 { | |
835 if (&a != this) | |
836 { | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
837 default_val = a.default_val; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
838 possible_vals = a.possible_vals; |
7363 | 839 } |
840 | |
841 return *this; | |
842 } | |
843 | |
844 std::string default_value (void) const { return default_val; } | |
845 | |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
846 bool validate (const std::string& val, std::string& match) |
7363 | 847 { |
848 bool retval = true; | |
849 | |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
850 if (! contains (val, match)) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
851 error ("invalid value = %s", val.c_str ()); |
7363 | 852 |
853 return retval; | |
854 } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
855 |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
856 bool contains (const std::string& val, std::string& match) |
7363 | 857 { |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
858 size_t k = 0; |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
859 |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
860 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
|
861 |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
862 std::string first_match; |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
863 |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
864 for (const auto& possible_val : possible_vals) |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
865 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
866 if (possible_val.compare (val, len)) |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
867 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
868 if (len == possible_val.length ()) |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
869 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
870 // We found a full match (consider the case of val == "replace" |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
871 // with possible values "replace" and "replacechildren"). Any |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
872 // other matches are irrelevant, so set match and return now. |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
873 match = possible_val; |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
874 return true; |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
875 } |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
876 else |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
877 { |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
878 if (k == 0) |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
879 first_match = possible_val; |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
880 |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
881 k++; |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
882 } |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
883 } |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
884 } |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
885 |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
886 if (k == 1) |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
887 { |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
888 match = first_match; |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
889 return true; |
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 else |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
892 return false; |
7363 | 893 } |
894 | |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
895 std::string values_as_string (void) const; |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
896 |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
897 Cell values_as_cell (void) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
898 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
899 octave_idx_type nelem (void) const { return possible_vals.size (); } |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
900 |
7363 | 901 private: |
902 // Might also want to cache | |
903 std::string default_val; | |
904 std::set<caseless_str> possible_vals; | |
905 }; | |
906 | |
907 class radio_property : public base_property | |
908 { | |
909 public: | |
7364 | 910 radio_property (const std::string& nm, const graphics_handle& h, |
7363 | 911 const radio_values& v = radio_values ()) |
7364 | 912 : base_property (nm, h), |
7363 | 913 vals (v), current_val (v.default_value ()) { } |
914 | |
7364 | 915 radio_property (const std::string& nm, const graphics_handle& h, |
7363 | 916 const std::string& v) |
7364 | 917 : base_property (nm, h), |
7363 | 918 vals (v), current_val (vals.default_value ()) { } |
919 | |
7364 | 920 radio_property (const std::string& nm, const graphics_handle& h, |
7363 | 921 const radio_values& v, const std::string& def) |
7364 | 922 : base_property (nm, h), |
7363 | 923 vals (v), current_val (def) { } |
924 | |
925 radio_property (const radio_property& p) | |
926 : base_property (p), vals (p.vals), current_val (p.current_val) { } | |
927 | |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
928 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
|
929 |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
930 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
|
931 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
932 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
|
933 |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
934 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
|
935 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
936 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
|
937 { return v.compare (current_val); } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
938 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
939 bool is_radio (void) const { return true; } |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
940 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
941 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
|
942 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
943 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
944 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
945 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
946 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
947 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
|
948 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
949 protected: |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
950 bool do_set (const octave_value& newval) |
7363 | 951 { |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
952 if (! newval.is_string ()) |
7363 | 953 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
|
954 get_name ().c_str ()); |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
955 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
956 std::string s = newval.string_value (); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
957 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
958 std::string match; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
959 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
960 if (! vals.validate (s, match)) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
961 error ("set: invalid value for radio property \"%s\" (value = %s)", |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
962 get_name ().c_str (), s.c_str ()); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
963 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
964 if (match != current_val) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
965 { |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
966 if (s.length () != match.length ()) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
967 warning_with_id ("Octave:abbreviated-property-match", |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
968 "%s: allowing %s to match %s value %s", |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
969 "set", s.c_str (), get_name ().c_str (), |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
970 match.c_str ()); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
971 current_val = match; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
972 return true; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
973 } |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
974 return false; |
7363 | 975 } |
976 | |
977 private: | |
978 radio_values vals; | |
979 std::string current_val; | |
980 }; | |
981 | |
982 // --------------------------------------------------------------------- | |
983 | |
984 class color_values | |
985 { | |
986 public: | |
987 color_values (double r = 0, double g = 0, double b = 1) | |
988 : xrgb (1, 3) | |
989 { | |
990 xrgb(0) = r; | |
991 xrgb(1) = g; | |
992 xrgb(2) = b; | |
993 | |
994 validate (); | |
995 } | |
996 | |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
997 color_values (const std::string& str) |
7363 | 998 : xrgb (1, 3) |
999 { | |
1000 if (! str2rgb (str)) | |
1001 error ("invalid color specification: %s", str.c_str ()); | |
1002 } | |
1003 | |
1004 color_values (const color_values& c) | |
1005 : xrgb (c.xrgb) | |
1006 { } | |
1007 | |
1008 color_values& operator = (const color_values& c) | |
1009 { | |
1010 if (&c != this) | |
1011 xrgb = c.xrgb; | |
1012 | |
1013 return *this; | |
1014 } | |
1015 | |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1016 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
|
1017 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1018 return (xrgb(0) == c.xrgb(0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1019 && xrgb(1) == c.xrgb(1) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1020 && xrgb(2) == c.xrgb(2)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1021 } |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1022 |
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1023 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
|
1024 { return ! (*this == c); } |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1025 |
7363 | 1026 Matrix rgb (void) const { return xrgb; } |
1027 | |
1028 operator octave_value (void) const { return xrgb; } | |
1029 | |
1030 void validate (void) const | |
1031 { | |
1032 for (int i = 0; i < 3; i++) | |
1033 { | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
1034 if (xrgb(i) < 0 || xrgb(i) > 1) |
20730
948f45a2931e
don't check error_state after creating color object
John W. Eaton <jwe@octave.org>
parents:
20726
diff
changeset
|
1035 error ("invalid RGB color specification"); |
7363 | 1036 } |
1037 } | |
1038 | |
1039 private: | |
1040 Matrix xrgb; | |
1041 | |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1042 OCTINTERP_API bool str2rgb (const std::string& str); |
7363 | 1043 }; |
1044 | |
1045 class color_property : public base_property | |
1046 { | |
1047 public: | |
1048 color_property (const color_values& c, const radio_values& v) | |
1049 : base_property ("", graphics_handle ()), | |
1050 current_type (color_t), color_val (c), radio_val (v), | |
1051 current_val (v.default_value ()) | |
1052 { } | |
1053 | |
17645
85a057ad1ba6
Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents:
17631
diff
changeset
|
1054 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
|
1055 : base_property ("", graphics_handle ()), |
85a057ad1ba6
Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents:
17631
diff
changeset
|
1056 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
|
1057 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
|
1058 { } |
85a057ad1ba6
Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents:
17631
diff
changeset
|
1059 |
7364 | 1060 color_property (const std::string& nm, const graphics_handle& h, |
7363 | 1061 const color_values& c = color_values (), |
1062 const radio_values& v = radio_values ()) | |
7364 | 1063 : base_property (nm, h), |
7363 | 1064 current_type (color_t), color_val (c), radio_val (v), |
1065 current_val (v.default_value ()) | |
1066 { } | |
1067 | |
7364 | 1068 color_property (const std::string& nm, const graphics_handle& h, |
7363 | 1069 const radio_values& v) |
7364 | 1070 : base_property (nm, h), |
7363 | 1071 current_type (radio_t), color_val (color_values ()), radio_val (v), |
1072 current_val (v.default_value ()) | |
1073 { } | |
1074 | |
7364 | 1075 color_property (const std::string& nm, const graphics_handle& h, |
7363 | 1076 const std::string& v) |
7364 | 1077 : base_property (nm, h), |
7363 | 1078 current_type (radio_t), color_val (color_values ()), radio_val (v), |
1079 current_val (radio_val.default_value ()) | |
1080 { } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1081 |
7364 | 1082 color_property (const std::string& nm, const graphics_handle& h, |
7363 | 1083 const color_property& v) |
7364 | 1084 : base_property (nm, h), |
7363 | 1085 current_type (v.current_type), color_val (v.color_val), |
1086 radio_val (v.radio_val), current_val (v.current_val) | |
1087 { } | |
1088 | |
1089 color_property (const color_property& p) | |
1090 : base_property (p), current_type (p.current_type), | |
1091 color_val (p.color_val), radio_val (p.radio_val), | |
1092 current_val (p.current_val) { } | |
1093 | |
1094 octave_value get (void) const | |
1095 { | |
1096 if (current_type == color_t) | |
1097 return color_val.rgb (); | |
1098 | |
1099 return current_val; | |
1100 } | |
1101 | |
1102 bool is_rgb (void) const { return (current_type == color_t); } | |
1103 | |
1104 bool is_radio (void) const { return (current_type == radio_t); } | |
1105 | |
1106 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
|
1107 { return (is_radio () && current_val == v); } |
7363 | 1108 |
1109 Matrix rgb (void) const | |
1110 { | |
1111 if (current_type != color_t) | |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
1112 error ("color has no RGB value"); |
7363 | 1113 |
1114 return color_val.rgb (); | |
1115 } | |
1116 | |
1117 const std::string& current_value (void) const | |
1118 { | |
1119 if (current_type != radio_t) | |
1120 error ("color has no radio value"); | |
1121 | |
1122 return current_val; | |
1123 } | |
1124 | |
1125 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
|
1126 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1127 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1128 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1129 } |
7363 | 1130 |
1131 operator octave_value (void) const { return get (); } | |
1132 | |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1133 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
|
1134 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1135 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
|
1136 { 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
|
1137 |
f0236b444356
Allow set(h) to work if the handle includes color properties
David Bateman <dbateman@free.fr>
parents:
10722
diff
changeset
|
1138 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
|
1139 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1140 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1141 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
|
1142 |
7363 | 1143 private: |
1144 enum current_enum { color_t, radio_t } current_type; | |
1145 color_values color_val; | |
1146 radio_values radio_val; | |
1147 std::string current_val; | |
1148 }; | |
1149 | |
1150 // --------------------------------------------------------------------- | |
1151 | |
1152 class double_property : public base_property | |
1153 { | |
1154 public: | |
7364 | 1155 double_property (const std::string& nm, const graphics_handle& h, |
7363 | 1156 double d = 0) |
7364 | 1157 : base_property (nm, h), |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1158 current_val (d), |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1159 minval (std::pair<double, bool> (octave_NaN, true)), |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1160 maxval (std::pair<double, bool> (octave_NaN, true)) { } |
7363 | 1161 |
1162 double_property (const double_property& p) | |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1163 : base_property (p), current_val (p.current_val), |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1164 minval (std::pair<double, bool> (octave_NaN, true)), |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1165 maxval (std::pair<double, bool> (octave_NaN, true)) { } |
7363 | 1166 |
1167 octave_value get (void) const { return octave_value (current_val); } | |
1168 | |
1169 double double_value (void) const { return current_val; } | |
1170 | |
1171 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
|
1172 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1173 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1174 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1175 } |
7363 | 1176 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1177 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
|
1178 |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1179 void add_constraint (const std::string& type, double val, bool inclusive) |
22910
23847979b91e
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
1180 { |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1181 if (type == "min") |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1182 minval = std::pair<double, bool> (val, inclusive); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1183 else if (type == "max") |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1184 maxval = std::pair<double, bool> (val, inclusive); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1185 } |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1186 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1187 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1188 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
|
1189 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1190 if (! v.is_scalar_type () || ! v.is_real_type ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1191 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
|
1192 get_name ().c_str ()); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1193 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1194 double new_val = v.double_value (); |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1195 |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1196 // Check min and max |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1197 if (! octave::math::isnan (minval.first)) |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1198 { |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1199 if (minval.second && minval.first > new_val) |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1200 error ("set: \"%s\" must be greater than or equal to %g", |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1201 get_name ().c_str (), minval.first); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1202 else if (! minval.second && minval.first >= new_val) |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1203 error ("set: \"%s\" must be greater than %g", |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1204 get_name ().c_str (), minval.first); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1205 } |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1206 |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1207 if (! octave::math::isnan (maxval.first)) |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1208 { |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1209 if (maxval.second && maxval.first < new_val) |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1210 error ("set: \"%s\" must be less than or equal to %g", |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1211 get_name ().c_str (), maxval.first); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1212 else if (! maxval.second && maxval.first <= new_val) |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1213 error ("set: \"%s\" must be less than %g", |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1214 get_name ().c_str (), maxval.first); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1215 } |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1216 |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1217 if (new_val != current_val) |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1218 { |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1219 current_val = new_val; |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1220 return true; |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1221 } |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1222 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1223 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1224 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1225 |
7363 | 1226 private: |
1227 double current_val; | |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1228 std::pair<double, bool> minval, maxval; |
7363 | 1229 }; |
1230 | |
1231 // --------------------------------------------------------------------- | |
1232 | |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1233 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
|
1234 { |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1235 public: |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1236 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
|
1237 : 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
|
1238 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
|
1239 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
|
1240 { } |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1241 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1242 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
|
1243 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
|
1244 : 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
|
1245 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
|
1246 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
|
1247 { } |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1248 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1249 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
|
1250 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
|
1251 : 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
|
1252 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
|
1253 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
|
1254 { } |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1255 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1256 double_radio_property (const double_radio_property& p) |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1257 : base_property (p), current_type (p.current_type), |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1258 dval (p.dval), radio_val (p.radio_val), |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1259 current_val (p.current_val) { } |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1260 |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1261 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
|
1262 { |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1263 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
|
1264 return dval; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1265 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1266 return current_val; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1267 } |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1268 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1269 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
|
1270 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1271 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
|
1272 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1273 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
|
1274 { 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
|
1275 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1276 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
|
1277 { |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1278 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
|
1279 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
|
1280 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1281 return dval; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1282 } |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1283 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1284 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
|
1285 { |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1286 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
|
1287 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
|
1288 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1289 return current_val; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1290 } |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1291 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1292 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
|
1293 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1294 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1295 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1296 } |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1297 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1298 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
|
1299 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1300 base_property* clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1301 { return new double_radio_property (*this); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1302 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1303 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1304 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
|
1305 |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1306 private: |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1307 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
|
1308 double dval; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1309 radio_values radio_val; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1310 std::string current_val; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1311 }; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1312 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1313 // --------------------------------------------------------------------- |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1314 |
7363 | 1315 class array_property : public base_property |
1316 { | |
1317 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
|
1318 array_property (void) |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
1319 : 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
|
1320 xmin (), xmax (), xminp (), xmaxp (), |
e3e8ca96f923
Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents:
12965
diff
changeset
|
1321 type_constraints (), size_constraints () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1322 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1323 get_data_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1324 } |
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
|
1325 |
7364 | 1326 array_property (const std::string& nm, const graphics_handle& h, |
7363 | 1327 const octave_value& m) |
15783
d61b92690820
coerce plot array and vector properties to full
John W. Eaton <jwe@octave.org>
parents:
15519
diff
changeset
|
1328 : 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
|
1329 xmin (), xmax (), xminp (), xmaxp (), |
e3e8ca96f923
Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents:
12965
diff
changeset
|
1330 type_constraints (), size_constraints () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1331 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1332 get_data_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1333 } |
7363 | 1334 |
7848
6bb2bbc2bf45
Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7847
diff
changeset
|
1335 // 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
|
1336 // 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
|
1337 // copy constraints. |
6bb2bbc2bf45
Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7847
diff
changeset
|
1338 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
|
1339 : 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
|
1340 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
|
1341 type_constraints (), size_constraints () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1342 { } |
7848
6bb2bbc2bf45
Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7847
diff
changeset
|
1343 |
7363 | 1344 octave_value get (void) const { return data; } |
1345 | |
1346 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
|
1347 { type_constraints.insert (type); } |
7363 | 1348 |
7524
a653856aa3e1
array_value::add_constraint: pass dim_vector as const reference, not value
John W. Eaton <jwe@octave.org>
parents:
7523
diff
changeset
|
1349 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
|
1350 { size_constraints.push_back (dims); } |
7363 | 1351 |
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
|
1352 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
|
1353 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
|
1354 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
|
1355 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
|
1356 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
1357 Matrix get_limits (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1358 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1359 Matrix m (1, 4); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1360 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1361 m(0) = min_val (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1362 m(1) = max_val (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1363 m(2) = min_pos (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1364 m(3) = max_neg (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1365 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1366 return m; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1367 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
1368 |
7363 | 1369 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
|
1370 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1371 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1372 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1373 } |
7363 | 1374 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1375 base_property* clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1376 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1377 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
|
1378 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1379 p->type_constraints = type_constraints; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1380 p->size_constraints = size_constraints; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1381 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1382 return p; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1383 } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1384 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1385 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1386 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
|
1387 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1388 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
|
1389 |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1390 if (! validate (tmp)) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1391 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
|
1392 get_name ().c_str ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1393 |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1394 // FIXME: should we check for actual data change? |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1395 if (! is_equal (tmp)) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1396 { |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1397 data = tmp; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1398 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1399 get_data_limits (); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1400 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1401 return true; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1402 } |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1403 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1404 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1405 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1406 |
7363 | 1407 private: |
1408 OCTINTERP_API bool validate (const octave_value& v); | |
1409 | |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1410 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
|
1411 |
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
|
1412 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
|
1413 |
7523
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1414 protected: |
7363 | 1415 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
|
1416 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
|
1417 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
|
1418 double xminp; |
13132
e3e8ca96f923
Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents:
12965
diff
changeset
|
1419 double xmaxp; |
15069
7a3957ca99c3
Handle complex arguments in imagesc (bug #36866)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14861
diff
changeset
|
1420 std::set<std::string> type_constraints; |
7363 | 1421 std::list<dim_vector> size_constraints; |
1422 }; | |
1423 | |
7523
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1424 class row_vector_property : public array_property |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1425 { |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1426 public: |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1427 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
|
1428 const octave_value& m) |
7527
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1429 : array_property (nm, h, m) |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1430 { |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1431 add_constraint (dim_vector (-1, 1)); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1432 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
|
1433 add_constraint (dim_vector (0, 0)); |
7527
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1434 } |
7523
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1435 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1436 row_vector_property (const row_vector_property& p) |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1437 : array_property (p) |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1438 { |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1439 add_constraint (dim_vector (-1, 1)); |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1440 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
|
1441 add_constraint (dim_vector (0, 0)); |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1442 } |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1443 |
7527
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1444 void add_constraint (const std::string& type) |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1445 { |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1446 array_property::add_constraint (type); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1447 } |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1448 |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1449 void add_constraint (const dim_vector& dims) |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1450 { |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1451 array_property::add_constraint (dims); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1452 } |
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 void add_constraint (octave_idx_type len) |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1455 { |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1456 size_constraints.remove (dim_vector (1, -1)); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1457 size_constraints.remove (dim_vector (-1, 1)); |
20273
b8c1b3e9aa91
Fix segfault when '[]' used for row_vector_property.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
1458 size_constraints.remove (dim_vector (0, 0)); |
7527
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 add_constraint (dim_vector (1, len)); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1461 add_constraint (dim_vector (len, 1)); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1462 } |
7523
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1463 |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1464 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
|
1465 { |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1466 set (val); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1467 return *this; |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1468 } |
7523
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1469 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1470 base_property* clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1471 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1472 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
|
1473 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1474 p->type_constraints = type_constraints; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1475 p->size_constraints = size_constraints; |
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 return p; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1478 } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1479 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1480 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1481 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
|
1482 { |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1483 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
|
1484 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1485 dim_vector dv = data.dims (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1486 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1487 if (dv(0) > 1 && dv(1) == 1) |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1488 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1489 int tmp = dv(0); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1490 dv(0) = dv(1); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1491 dv(1) = tmp; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1492 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1493 data = data.reshape (dv); |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1494 } |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1495 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1496 return retval; |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1497 } |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1498 |
7523
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1499 private: |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1500 OCTINTERP_API bool validate (const octave_value& v); |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1501 }; |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1502 |
7363 | 1503 // --------------------------------------------------------------------- |
1504 | |
1505 class bool_property : public radio_property | |
1506 { | |
1507 public: | |
7364 | 1508 bool_property (const std::string& nm, const graphics_handle& h, |
7363 | 1509 bool val) |
7364 | 1510 : 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
|
1511 { } |
7363 | 1512 |
7364 | 1513 bool_property (const std::string& nm, const graphics_handle& h, |
7363 | 1514 const char* val) |
7364 | 1515 : 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
|
1516 { } |
7363 | 1517 |
1518 bool_property (const bool_property& p) | |
1519 : radio_property (p) { } | |
1520 | |
1521 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
|
1522 |
7363 | 1523 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
|
1524 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1525 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1526 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1527 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1528 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1529 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
|
1530 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1531 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1532 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
|
1533 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1534 if (val.is_bool_scalar ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1535 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
|
1536 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1537 return radio_property::do_set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1538 } |
7363 | 1539 }; |
1540 | |
1541 // --------------------------------------------------------------------- | |
1542 | |
1543 class handle_property : public base_property | |
1544 { | |
1545 public: | |
7364 | 1546 handle_property (const std::string& nm, const graphics_handle& h, |
7363 | 1547 const graphics_handle& val = graphics_handle ()) |
7364 | 1548 : base_property (nm, h), |
7363 | 1549 current_val (val) { } |
1550 | |
1551 handle_property (const handle_property& p) | |
1552 : base_property (p), current_val (p.current_val) { } | |
1553 | |
1554 octave_value get (void) const { return current_val.as_octave_value (); } | |
1555 | |
1556 graphics_handle handle_value (void) const { return current_val; } | |
1557 | |
1558 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
|
1559 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1560 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1561 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1562 } |
7363 | 1563 |
1564 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
|
1565 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1566 set (octave_value (h.value ())); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1567 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1568 } |
7363 | 1569 |
21723
bae585228161
use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents:
21721
diff
changeset
|
1570 void invalidate (void) { current_val = octave::numeric_limits<double>::NaN (); } |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
1571 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1572 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
|
1573 |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1574 void add_constraint (const std::string& type) |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1575 { type_constraints.insert (type); } |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1576 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1577 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1578 OCTINTERP_API bool do_set (const octave_value& v); |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1579 std::set<std::string> type_constraints; |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1580 |
7363 | 1581 private: |
1582 graphics_handle current_val; | |
1583 }; | |
1584 | |
1585 // --------------------------------------------------------------------- | |
1586 | |
1587 class any_property : public base_property | |
1588 { | |
1589 public: | |
7364 | 1590 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
|
1591 const octave_value& m = Matrix ()) |
7364 | 1592 : base_property (nm, h), data (m) { } |
7363 | 1593 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1594 any_property (const any_property& p) |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1595 : base_property (p), data (p.data) { } |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1596 |
7363 | 1597 octave_value get (void) const { return data; } |
1598 | |
1599 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
|
1600 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1601 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1602 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1603 } |
7363 | 1604 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1605 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
|
1606 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1607 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1608 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
|
1609 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1610 data = v; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1611 return true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1612 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1613 |
7363 | 1614 private: |
1615 octave_value data; | |
1616 }; | |
1617 | |
1618 // --------------------------------------------------------------------- | |
1619 | |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1620 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
|
1621 { |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1622 public: |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1623 children_property (void) |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
1624 : 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
|
1625 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1626 do_init_children (Matrix ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1627 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1628 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1629 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
|
1630 const Matrix& val) |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
1631 : 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
|
1632 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1633 do_init_children (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1634 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1635 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1636 children_property (const children_property& p) |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
1637 : base_property (p), children_list () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1638 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1639 do_init_children (p.children_list); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1640 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1641 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1642 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
|
1643 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1644 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1645 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1646 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1647 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1648 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
|
1649 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1650 bool remove_child (double val) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1651 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1652 return do_remove_child (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1653 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1654 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1655 void adopt (double val) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1656 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1657 do_adopt_child (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1658 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1659 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1660 Matrix get_children (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1661 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1662 return do_get_children (false); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1663 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1664 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1665 Matrix get_hidden (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1666 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1667 return do_get_children (true); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
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 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1670 Matrix get_all (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1671 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1672 return do_get_all_children (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1673 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1674 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1675 octave_value get (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1676 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1677 return octave_value (get_children ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1678 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1679 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1680 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
|
1681 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1682 do_delete_children (clear); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1683 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1684 |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
1685 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
|
1686 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1687 for (auto& hchild : children_list) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1688 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1689 if (hchild == old_gh) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1690 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1691 hchild = new_gh.value (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1692 return; |
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 } |
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 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
|
1697 } |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
1698 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1699 private: |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1700 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
|
1701 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
|
1702 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
|
1703 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1704 protected: |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1705 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
|
1706 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1707 Matrix new_kids; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1708 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1709 try |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1710 { |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1711 new_kids = val.matrix_value (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1712 } |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1713 catch (octave::execution_exception& e) |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1714 { |
20756
200ae1d650b7
propagate octave_execution_exception objects through try/catch blocks
John W. Eaton <jwe@octave.org>
parents:
20738
diff
changeset
|
1715 error (e, "set: children must be an array of graphics handles"); |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1716 } |
17787
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 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
|
1719 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1720 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
|
1721 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1722 bool is_ok = true; |
19678
c17e1cefdbd3
Fix reordering graphics property children for hidden objects (bug #44211)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19666
diff
changeset
|
1723 bool add_hidden = true; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1724 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1725 const Matrix visible_kids = do_get_children (false); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1726 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1727 if (visible_kids.numel () == new_kids.numel ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1728 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1729 Matrix t1 = visible_kids.sort (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1730 Matrix t2 = new_kids_column.sort (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1731 Matrix t3 = get_hidden ().sort (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1732 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1733 if (t1 != t2) |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1734 is_ok = false; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1735 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1736 if (t1 == t3) |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1737 add_hidden = false; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1738 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1739 else |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1740 is_ok = false; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1741 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1742 if (! is_ok) |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1743 error ("set: new children must be a permutation of existing children"); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1744 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1745 if (is_ok) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1746 { |
19678
c17e1cefdbd3
Fix reordering graphics property children for hidden objects (bug #44211)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19666
diff
changeset
|
1747 Matrix tmp = new_kids_column; |
c17e1cefdbd3
Fix reordering graphics property children for hidden objects (bug #44211)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19666
diff
changeset
|
1748 |
c17e1cefdbd3
Fix reordering graphics property children for hidden objects (bug #44211)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19666
diff
changeset
|
1749 if (add_hidden) |
c17e1cefdbd3
Fix reordering graphics property children for hidden objects (bug #44211)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19666
diff
changeset
|
1750 tmp.stack (get_hidden ()); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1751 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1752 children_list.clear (); |
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 // 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
|
1755 // 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
|
1756 // the child list directly. |
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 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
|
1759 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
|
1760 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1761 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1762 return is_ok; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1763 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1764 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1765 private: |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1766 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
|
1767 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1768 children_list.clear (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1769 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
|
1770 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
|
1771 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1772 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1773 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
|
1774 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1775 children_list.clear (); |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1776 children_list = val; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1777 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1778 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1779 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
|
1780 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1781 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
|
1782 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1783 Matrix retval (children_list.size (), 1); |
21568
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
21562
diff
changeset
|
1784 octave_idx_type i = 0; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1785 |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1786 for (const auto& hchild : children_list) |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1787 retval(i++) = hchild; |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1788 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1789 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1790 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1791 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1792 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
|
1793 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1794 for (auto it = children_list.begin (); it != children_list.end (); it++) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1795 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1796 if (*it == child) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1797 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1798 children_list.erase (it); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1799 return true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1800 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1801 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1802 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1803 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1804 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1805 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
|
1806 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1807 children_list.push_front (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1808 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1809 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1810 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
|
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 | 1815 class callback_property : public base_property |
1816 { | |
1817 public: | |
7364 | 1818 callback_property (const std::string& nm, const graphics_handle& h, |
7363 | 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 | 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 | 1825 octave_value get (void) const { return callback; } |
1826 | |
7367 | 1827 OCTINTERP_API void execute (const octave_value& data = octave_value ()) const; |
7363 | 1828 |
10517 | 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 | 1833 |
7363 | 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 | 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 { |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1845 if (! validate (v)) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1846 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
|
1847 get_name ().c_str ()); |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1848 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1849 callback = v; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1850 return true; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1851 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1852 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1853 |
7363 | 1854 private: |
1855 OCTINTERP_API bool validate (const octave_value& v) const; | |
1856 | |
1857 private: | |
1858 octave_value callback; | |
13323
de081abd32c6
don't execute graphics handle callback functions recursively
John W. Eaton <jwe@octave.org>
parents:
13321
diff
changeset
|
1859 |
de081abd32c6
don't execute graphics handle callback functions recursively
John W. Eaton <jwe@octave.org>
parents:
13321
diff
changeset
|
1860 // 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
|
1861 mutable bool executing; |
7363 | 1862 }; |
1863 | |
1864 // --------------------------------------------------------------------- | |
1865 | |
1866 class property | |
1867 { | |
1868 public: | |
1869 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
|
1870 { } |
7363 | 1871 |
1872 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
|
1873 { if (persist) rep->count++; } |
7363 | 1874 |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
1875 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
|
1876 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1877 rep->count++; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1878 } |
7363 | 1879 |
1880 ~property (void) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1881 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1882 if (--rep->count == 0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1883 delete rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1884 } |
7363 | 1885 |
1886 bool ok (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1887 { return rep->ok (); } |
7363 | 1888 |
1889 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
|
1890 { return rep->get_name (); } |
7363 | 1891 |
1892 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
|
1893 { rep->set_name (name); } |
7363 | 1894 |
1895 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
|
1896 { return rep->get_parent (); } |
7363 | 1897 |
1898 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
|
1899 { rep->set_parent (h); } |
7363 | 1900 |
1901 bool is_hidden (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1902 { return rep->is_hidden (); } |
7363 | 1903 |
1904 void set_hidden (bool flag) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1905 { rep->set_hidden (flag); } |
7363 | 1906 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
1907 bool is_radio (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1908 { return rep->is_radio (); } |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
1909 |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
1910 int get_id (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1911 { return rep->get_id (); } |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
1912 |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
1913 void set_id (int d) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1914 { rep->set_id (d); } |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
1915 |
7363 | 1916 octave_value get (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1917 { return rep->get (); } |
7363 | 1918 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
1919 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
|
1920 bool do_notify_toolkit = true) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1921 { return rep->set (val, do_run, do_notify_toolkit); } |
7363 | 1922 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
1923 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
|
1924 { return rep->values_as_string (); } |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
1925 |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
1926 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
|
1927 { return rep->values_as_cell (); } |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
1928 |
7363 | 1929 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
|
1930 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1931 *rep = val; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1932 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1933 } |
7363 | 1934 |
1935 property& operator = (const property& p) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1936 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1937 if (rep && --rep->count == 0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1938 delete rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1939 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1940 rep = p.rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1941 rep->count++; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1942 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1943 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1944 } |
7363 | 1945 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1946 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
|
1947 { rep->add_listener (v, mode); } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1948 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1949 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
|
1950 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
|
1951 { 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
|
1952 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1953 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
|
1954 { rep->run_listeners (mode); } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1955 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1956 OCTINTERP_API static |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1957 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
|
1958 const caseless_str& type, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1959 const octave_value_list& args); |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1960 |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1961 property clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1962 { return property (rep->clone ()); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1963 |
20946 | 1964 #if 0 |
7363 | 1965 const string_property& as_string_property (void) const |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22351
diff
changeset
|
1966 { return *(dynamic_cast<string_property*> (rep)); } |
7363 | 1967 |
1968 const radio_property& as_radio_property (void) const | |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22351
diff
changeset
|
1969 { return *(dynamic_cast<radio_property*> (rep)); } |
7363 | 1970 |
1971 const color_property& as_color_property (void) const | |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22351
diff
changeset
|
1972 { return *(dynamic_cast<color_property*> (rep)); } |
7363 | 1973 |
1974 const double_property& as_double_property (void) const | |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22351
diff
changeset
|
1975 { return *(dynamic_cast<double_property*> (rep)); } |
7363 | 1976 |
1977 const bool_property& as_bool_property (void) const | |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22351
diff
changeset
|
1978 { return *(dynamic_cast<bool_property*> (rep)); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1979 |
7363 | 1980 const handle_property& as_handle_property (void) const |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22351
diff
changeset
|
1981 { return *(dynamic_cast<handle_property*> (rep)); } |
20946 | 1982 #endif |
7363 | 1983 |
1984 private: | |
1985 base_property *rep; | |
1986 }; | |
1987 | |
1988 // --------------------------------------------------------------------- | |
1989 | |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1990 typedef std::pair<std::string, octave_value> pval_pair; |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1991 |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1992 class pval_vector : public std::vector<pval_pair> |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
1993 { |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
1994 public: |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
1995 const_iterator find (const std::string pname) const |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
1996 { |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
1997 const_iterator it; |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
1998 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
1999 for (it = (*this).begin (); it != (*this).end (); it++) |
21021
a5b99b09f8fd
maint: Use comparison operators rather than compare() for strings.
Rik <rik@octave.org>
parents:
21017
diff
changeset
|
2000 if (pname == (*it).first) |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2001 return it; |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2002 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2003 return (*this).end (); |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2004 } |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2005 |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2006 iterator find (const std::string pname) |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2007 { |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2008 iterator it; |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2009 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2010 for (it = (*this).begin (); it != (*this).end (); it++) |
21021
a5b99b09f8fd
maint: Use comparison operators rather than compare() for strings.
Rik <rik@octave.org>
parents:
21017
diff
changeset
|
2011 if (pname == (*it).first) |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2012 return it; |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2013 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2014 return (*this).end (); |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2015 } |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2016 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2017 octave_value lookup (const std::string pname) const |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2018 { |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2019 octave_value retval; |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2020 |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2021 const_iterator it = find (pname); |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2022 |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2023 if (it != (*this).end ()) |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
2024 retval = (*it).second; |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2025 |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2026 return retval; |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2027 } |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2028 |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2029 octave_value& operator [] (const std::string pname) |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2030 { |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2031 iterator it = find (pname); |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2032 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2033 if (it == (*this).end ()) |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2034 { |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2035 push_back (pval_pair (pname, octave_value ())); |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2036 return (*this).back ().second; |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2037 } |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2038 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2039 return (*it).second; |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2040 } |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2041 |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2042 void erase (const std::string pname) |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2043 { |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2044 iterator it = find (pname); |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2045 if (it != (*this).end ()) |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2046 erase (it); |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2047 } |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2048 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2049 void erase (iterator it) |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2050 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
2051 std::vector<pval_pair>::erase (it); |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2052 } |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2053 |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2054 }; |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2055 |
7363 | 2056 class property_list |
2057 { | |
2058 public: | |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2059 typedef pval_vector pval_map_type; |
7363 | 2060 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
|
2061 |
7363 | 2062 typedef pval_map_type::iterator pval_map_iterator; |
2063 typedef pval_map_type::const_iterator pval_map_const_iterator; | |
2064 | |
2065 typedef plist_map_type::iterator plist_map_iterator; | |
2066 typedef plist_map_type::const_iterator plist_map_const_iterator; | |
2067 | |
2068 property_list (const plist_map_type& m = plist_map_type ()) | |
2069 : plist_map (m) { } | |
2070 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2071 ~property_list (void) = default; |
7363 | 2072 |
2073 void set (const caseless_str& name, const octave_value& val); | |
2074 | |
2075 octave_value lookup (const caseless_str& name) const; | |
2076 | |
2077 plist_map_iterator begin (void) { return plist_map.begin (); } | |
2078 plist_map_const_iterator begin (void) const { return plist_map.begin (); } | |
2079 | |
2080 plist_map_iterator end (void) { return plist_map.end (); } | |
2081 plist_map_const_iterator end (void) const { return plist_map.end (); } | |
2082 | |
2083 plist_map_iterator find (const std::string& go_name) | |
2084 { | |
2085 return plist_map.find (go_name); | |
2086 } | |
2087 | |
2088 plist_map_const_iterator find (const std::string& go_name) const | |
2089 { | |
2090 return plist_map.find (go_name); | |
2091 } | |
2092 | |
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
|
2093 octave_scalar_map as_struct (const std::string& prefix_arg) const; |
7363 | 2094 |
2095 private: | |
2096 plist_map_type plist_map; | |
2097 }; | |
2098 | |
2099 // --------------------------------------------------------------------- | |
2100 | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2101 class graphics_toolkit; |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
2102 class graphics_object; |
7419 | 2103 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2104 class base_graphics_toolkit |
7419 | 2105 { |
2106 public: | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2107 friend class graphics_toolkit; |
7419 | 2108 |
2109 public: | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2110 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
|
2111 : name (nm), count (0) { } |
7419 | 2112 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2113 virtual ~base_graphics_toolkit (void) = default; |
7419 | 2114 |
2115 std::string get_name (void) const { return name; } | |
2116 | |
2117 virtual bool is_valid (void) const { return false; } | |
2118 | |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
2119 virtual void redraw_figure (const graphics_object&) const |
21163
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2120 { gripe_if_tkit_invalid ("redraw_figure"); } |
7419 | 2121 |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
2122 virtual void print_figure (const graphics_object&, const std::string&, |
21699
21fdab18f857
Remove reference to drawnow 'mono' throughout scripts and code, update args test
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
21684
diff
changeset
|
2123 const std::string&, |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2124 const std::string& = "") const |
21163
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2125 { gripe_if_tkit_invalid ("print_figure"); } |
7419 | 2126 |
2127 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
|
2128 { |
21163
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2129 gripe_if_tkit_invalid ("get_canvas_size"); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2130 return Matrix (1, 2, 0.0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2131 } |
7419 | 2132 |
7427 | 2133 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
|
2134 { |
21163
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2135 gripe_if_tkit_invalid ("get_screen_resolution"); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2136 return 72.0; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2137 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2138 |
7445 | 2139 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
|
2140 { |
21163
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2141 gripe_if_tkit_invalid ("get_screen_size"); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2142 return Matrix (1, 2, 0.0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2143 } |
7427 | 2144 |
10974
c6dc5f666695
update comments for base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents:
10973
diff
changeset
|
2145 // Callback function executed when the given graphics object |
11577 | 2146 // 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
|
2147 // changes if needed. |
10973
a8235d26b57a
improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents:
10949
diff
changeset
|
2148 virtual void update (const graphics_object&, int) |
21163
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2149 { gripe_if_tkit_invalid ("base_graphics_toolkit::update"); } |
10973
a8235d26b57a
improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents:
10949
diff
changeset
|
2150 |
a8235d26b57a
improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents:
10949
diff
changeset
|
2151 void update (const graphics_handle&, int); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2152 |
10974
c6dc5f666695
update comments for base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents:
10973
diff
changeset
|
2153 // 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
|
2154 // 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
|
2155 // 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
|
2156 virtual bool initialize (const graphics_object&) |
21163
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2157 { |
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2158 gripe_if_tkit_invalid ("base_graphics_toolkit::initialize"); |
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2159 return false; |
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2160 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2161 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2162 bool initialize (const graphics_handle&); |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
2163 |
10974
c6dc5f666695
update comments for base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents:
10973
diff
changeset
|
2164 // 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
|
2165 // 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
|
2166 // 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
|
2167 virtual void finalize (const graphics_object&) |
21163
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2168 { gripe_if_tkit_invalid ("base_graphics_toolkit::finalize"); } |
10973
a8235d26b57a
improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents:
10949
diff
changeset
|
2169 |
a8235d26b57a
improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents:
10949
diff
changeset
|
2170 void finalize (const graphics_handle&); |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
2171 |
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
|
2172 // 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
|
2173 virtual void close (void) |
21163
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2174 { gripe_if_tkit_invalid ("base_graphics_toolkit::close"); } |
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
|
2175 |
7419 | 2176 private: |
2177 std::string name; | |
23012
27e4ec3b0b49
move octave_refcount inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23002
diff
changeset
|
2178 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
|
2179 |
68550ad9ee9c
Add support for extern updaters. Add set_figure_position interface to graphics_backend.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7824
diff
changeset
|
2180 private: |
21163
2d22bd38deac
graphics.in.h: Rename function gripe_invalid to gripe_if_tkit_invalid.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
2181 void gripe_if_tkit_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
|
2182 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2183 if (! is_valid ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2184 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
|
2185 } |
7419 | 2186 }; |
2187 | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2188 class graphics_toolkit |
7419 | 2189 { |
2190 public: | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2191 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
|
2192 : 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
|
2193 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2194 rep->count++; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2195 } |
7419 | 2196 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2197 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
|
2198 : rep (b) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2199 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2200 rep->count++; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2201 } |
7419 | 2202 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2203 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
|
2204 : rep (b.rep) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2205 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2206 rep->count++; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2207 } |
7419 | 2208 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2209 ~graphics_toolkit (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2210 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2211 if (--rep->count == 0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2212 delete rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2213 } |
7419 | 2214 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2215 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
|
2216 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2217 if (rep != b.rep) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2218 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2219 if (--rep->count == 0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2220 delete rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2221 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2222 rep = b.rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2223 rep->count++; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2224 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2225 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2226 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2227 } |
7419 | 2228 |
2229 operator bool (void) const { return rep->is_valid (); } | |
2230 | |
2231 std::string get_name (void) const { return rep->get_name (); } | |
2232 | |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
2233 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
|
2234 { rep->redraw_figure (go); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2235 |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
2236 void print_figure (const graphics_object& go, const std::string& term, |
21699
21fdab18f857
Remove reference to drawnow 'mono' throughout scripts and code, update args test
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
21684
diff
changeset
|
2237 const std::string& file, |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2238 const std::string& debug_file = "") const |
21699
21fdab18f857
Remove reference to drawnow 'mono' throughout scripts and code, update args test
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
21684
diff
changeset
|
2239 { rep->print_figure (go, term, file, debug_file); } |
7419 | 2240 |
2241 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
|
2242 { return rep->get_canvas_size (fh); } |
7419 | 2243 |
7427 | 2244 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
|
2245 { return rep->get_screen_resolution (); } |
7427 | 2246 |
7445 | 2247 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
|
2248 { return rep->get_screen_size (); } |
7445 | 2249 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2250 // 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
|
2251 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
|
2252 { rep->update (go, id); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2253 |
10973
a8235d26b57a
improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents:
10949
diff
changeset
|
2254 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
|
2255 { rep->update (h, id); } |
8058
ca39c21fa4b8
[mq]: generic_octave_to_backend_nofitication
John W. Eaton <jwe@octave.org>
parents:
8052
diff
changeset
|
2256 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2257 // 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
|
2258 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
|
2259 { 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
|
2260 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2261 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
|
2262 { return rep->initialize (h); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2263 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2264 // Notifies graphics toolkit that object was destroyed. |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21723
diff
changeset
|
2265 // This is called only for explicitly deleted object. |
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21723
diff
changeset
|
2266 // Children are 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
|
2267 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
|
2268 { rep->finalize (go); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2269 |
10973
a8235d26b57a
improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents:
10949
diff
changeset
|
2270 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
|
2271 { rep->finalize (h); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2272 |
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
|
2273 // 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
|
2274 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
|
2275 |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2276 private: |
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 base_graphics_toolkit *rep; |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2279 }; |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2280 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2281 class gtk_manager |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2282 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2283 public: |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2284 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2285 static graphics_toolkit get_toolkit (void) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2286 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2287 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
|
2288 } |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2289 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2290 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
|
2291 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2292 if (instance_ok ()) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2293 instance->do_register_toolkit (name); |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2294 } |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2295 |
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2296 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
|
2297 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2298 if (instance_ok ()) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2299 instance->do_unregister_toolkit (name); |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2300 } |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2301 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2302 static void load_toolkit (const graphics_toolkit& tk) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2303 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2304 if (instance_ok ()) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2305 instance->do_load_toolkit (tk); |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2306 } |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2307 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2308 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
|
2309 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2310 if (instance_ok ()) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2311 instance->do_unload_toolkit (name); |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2312 } |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2313 |
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2314 static graphics_toolkit find_toolkit (const std::string& name) |
7439 | 2315 { |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2316 return instance_ok () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2317 ? instance->do_find_toolkit (name) : graphics_toolkit (); |
7439 | 2318 } |
2319 | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2320 static Cell available_toolkits_list (void) |
7835
ca8b97bb952c
added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents:
7834
diff
changeset
|
2321 { |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2322 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
|
2323 } |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2324 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2325 static Cell loaded_toolkits_list (void) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2326 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2327 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
|
2328 } |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2329 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2330 static void unload_all_toolkits (void) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2331 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2332 if (instance_ok ()) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2333 instance->do_unload_all_toolkits (); |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2334 } |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2335 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2336 static std::string default_toolkit (void) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2337 { |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
2338 return instance_ok () ? instance->do_default_toolkit () : ""; |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2339 } |
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 private: |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2342 |
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
|
2343 gtk_manager (void) { } |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2344 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2345 ~gtk_manager (void) = default; |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2346 |
14281
b4d7de953066
Export more required symbols [Win32].
Michael Goffioul <michael.goffioul@gmail.com>
parents:
14257
diff
changeset
|
2347 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
|
2348 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2349 static bool instance_ok (void) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2350 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2351 bool retval = true; |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2352 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2353 if (! instance) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2354 create_instance (); |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2355 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2356 if (! instance) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
2357 error ("unable to create gh_manager!"); |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2358 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2359 return retval; |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2360 } |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2361 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2362 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
|
2363 |
14281
b4d7de953066
Export more required symbols [Win32].
Michael Goffioul <michael.goffioul@gmail.com>
parents:
14257
diff
changeset
|
2364 OCTINTERP_API static gtk_manager *instance; |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2365 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2366 // The name of the default toolkit. |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2367 std::string dtk; |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2368 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2369 // 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
|
2370 std::set<std::string> available_toolkits; |
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 // 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
|
2373 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
|
2374 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2375 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
|
2376 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2377 typedef std::set<std::string>::const_iterator |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2378 const_available_toolkits_iterator; |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2379 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2380 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
|
2381 loaded_toolkits_iterator; |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2382 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2383 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
|
2384 const_loaded_toolkits_iterator; |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2385 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2386 graphics_toolkit do_get_toolkit (void) const; |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2387 |
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
|
2388 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
|
2389 |
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
|
2390 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
|
2391 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2392 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
|
2393 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2394 loaded_toolkits[tk.get_name ()] = tk; |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2395 } |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2396 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2397 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
|
2398 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2399 loaded_toolkits.erase (name); |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2400 } |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2401 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2402 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
|
2403 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2404 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
|
2405 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2406 if (p != loaded_toolkits.end ()) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2407 return p->second; |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2408 else |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2409 return graphics_toolkit (); |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2410 } |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2411 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2412 Cell do_available_toolkits_list (void) const |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2413 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
2414 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
|
2415 |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2416 octave_idx_type i = 0; |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
2417 for (const auto& tkit : available_toolkits) |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
2418 m(i++) = tkit; |
7835
ca8b97bb952c
added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents:
7834
diff
changeset
|
2419 |
ca8b97bb952c
added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents:
7834
diff
changeset
|
2420 return m; |
ca8b97bb952c
added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents:
7834
diff
changeset
|
2421 } |
ca8b97bb952c
added the function available_backends
Shai Ayal <shaiay@sourceforge.net>
parents:
7834
diff
changeset
|
2422 |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2423 Cell do_loaded_toolkits_list (void) const |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2424 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
2425 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
|
2426 |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2427 octave_idx_type i = 0; |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
2428 for (const auto& nm_tkit_p : loaded_toolkits) |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
2429 m(i++) = nm_tkit_p.first; |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2430 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2431 return m; |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2432 } |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2433 |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2434 void do_unload_all_toolkits (void) |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2435 { |
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2436 while (! loaded_toolkits.empty ()) |
14016
8feb25ecddaf
close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents:
14014
diff
changeset
|
2437 { |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2438 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
|
2439 |
8feb25ecddaf
close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents:
14014
diff
changeset
|
2440 std::string name = p->first; |
8feb25ecddaf
close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents:
14014
diff
changeset
|
2441 |
8feb25ecddaf
close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents:
14014
diff
changeset
|
2442 p->second.close (); |
8feb25ecddaf
close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents:
14014
diff
changeset
|
2443 |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
2444 // The toolkit may have unloaded itself. If not, we'll do it here. |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2445 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
|
2446 unload_toolkit (name); |
14016
8feb25ecddaf
close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents:
14014
diff
changeset
|
2447 } |
8feb25ecddaf
close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents:
14014
diff
changeset
|
2448 } |
8feb25ecddaf
close all graphics toolkits before exit
John W. Eaton <jwe@octave.org>
parents:
14014
diff
changeset
|
2449 |
14021
e3bed294b117
refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents:
14016
diff
changeset
|
2450 std::string do_default_toolkit (void) { return dtk; } |
7419 | 2451 }; |
2452 | |
2453 // --------------------------------------------------------------------- | |
2454 | |
6874 | 2455 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
|
2456 class graphics_object; |
6874 | 2457 |
7365 | 2458 class OCTINTERP_API base_properties |
6874 | 2459 { |
2460 public: | |
7176 | 2461 base_properties (const std::string& ty = "unknown", |
7363 | 2462 const graphics_handle& mh = graphics_handle (), |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2463 const graphics_handle& p = graphics_handle ()); |
6874 | 2464 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2465 virtual ~base_properties (void) = default; |
6874 | 2466 |
17625
bd1dd30ed202
graphics.in.h: Correct bad spelling of "unknown" in graphics_object_name().
Rik <rik@octave.org>
parents:
17544
diff
changeset
|
2467 virtual std::string graphics_object_name (void) const { return "unknown"; } |
6874 | 2468 |
2469 void mark_modified (void); | |
2470 | |
2471 void override_defaults (base_graphics_object& obj); | |
2472 | |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
2473 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
|
2474 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2475 panic_impossible (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2476 } |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
2477 |
6874 | 2478 // Look through DEFAULTS for properties with given CLASS_NAME, and |
2479 // apply them to the current object with set (virtual method). | |
2480 | |
2481 void set_from_list (base_graphics_object& obj, property_list& defaults); | |
2482 | |
7363 | 2483 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
|
2484 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2485 p.set_name (name); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2486 p.set_parent (__myhandle__); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2487 all_props[name] = p; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2488 } |
7363 | 2489 |
9972 | 2490 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
|
2491 |
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
9004
diff
changeset
|
2492 virtual octave_value get (const caseless_str& pname) const; |
7363 | 2493 |
9616
2093499ec9f4
avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents:
9585
diff
changeset
|
2494 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
|
2495 { |
2093499ec9f4
avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents:
9585
diff
changeset
|
2496 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
|
2497 } |
2093499ec9f4
avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents:
9585
diff
changeset
|
2498 |
2093499ec9f4
avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents:
9585
diff
changeset
|
2499 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
|
2500 { |
2093499ec9f4
avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents:
9585
diff
changeset
|
2501 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
|
2502 } |
2093499ec9f4
avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents:
9585
diff
changeset
|
2503 |
7379 | 2504 virtual octave_value get (bool all = false) const; |
7363 | 2505 |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
9004
diff
changeset
|
2506 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
|
2507 |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9582
diff
changeset
|
2508 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
|
2509 { |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9582
diff
changeset
|
2510 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
|
2511 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
|
2512 } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
2513 |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2514 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
|
2515 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2516 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
|
2517 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2518 if (children.remove_child (h.value ())) |
19745
99ef3e58214e
Run children listeners after any adoption/deletion (bug #44242)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19697
diff
changeset
|
2519 { |
99ef3e58214e
Run children listeners after any adoption/deletion (bug #44242)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19697
diff
changeset
|
2520 children.run_listeners (); |
99ef3e58214e
Run children listeners after any adoption/deletion (bug #44242)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19697
diff
changeset
|
2521 mark_modified (); |
99ef3e58214e
Run children listeners after any adoption/deletion (bug #44242)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19697
diff
changeset
|
2522 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2523 } |
7386 | 2524 |
2525 virtual void adopt (const graphics_handle& h) | |
6874 | 2526 { |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2527 children.adopt (h.value ()); |
19745
99ef3e58214e
Run children listeners after any adoption/deletion (bug #44242)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19697
diff
changeset
|
2528 children.run_listeners (); |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
2529 mark_modified (); |
6874 | 2530 } |
2531 | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2532 virtual graphics_toolkit get_toolkit (void) const; |
7419 | 2533 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2534 virtual Matrix |
20946 | 2535 get_boundingbox (bool /* finternal */ = false, |
2536 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
|
2537 { return Matrix (1, 4, 0.0); } |
7447 | 2538 |
7828
4739b6a1925c
Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7827
diff
changeset
|
2539 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
|
2540 |
12389
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
2541 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
|
2542 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2543 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
|
2544 listener_mode = POSTSET); |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2545 |
8299
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
2546 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
|
2547 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
|
2548 |
7363 | 2549 void set_tag (const octave_value& val) { tag = val; } |
7176 | 2550 |
6874 | 2551 void set_parent (const octave_value& val); |
2552 | |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2553 Matrix get_children (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2554 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2555 return children.get_children (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2556 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2557 |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2558 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
|
2559 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2560 return children.get_all (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2561 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2562 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2563 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
|
2564 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2565 return children.get_hidden (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2566 } |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2567 |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2568 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
|
2569 |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2570 void set___modified__ (const octave_value& val) { __modified__ = val; } |
7366 | 2571 |
6874 | 2572 void reparent (const graphics_handle& new_parent) { parent = new_parent; } |
2573 | |
7214 | 2574 // Update data limits for AXIS_TYPE (xdata, ydata, etc.) in the parent |
2575 // axes object. | |
2576 | |
7386 | 2577 virtual void update_axis_limits (const std::string& axis_type) const; |
7214 | 2578 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2579 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
|
2580 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
|
2581 |
20077
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
2582 virtual void update_uicontextmenu (void) const; |
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
2583 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2584 virtual void delete_children (bool clear = false) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2585 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2586 children.delete_children (clear); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2587 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2588 |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
2589 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
|
2590 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2591 children.renumber (old_gh, new_gh); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2592 } |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
2593 |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
2594 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
|
2595 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2596 parent = new_gh; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2597 } |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
2598 |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2599 static property_list::pval_map_type factory_defaults (void); |
7222 | 2600 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2601 // 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
|
2602 // genprops.awk script. |
7222 | 2603 // |
2604 // 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
|
2605 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2606 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
|
2607 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
|
2608 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
|
2609 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
|
2610 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
|
2611 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2612 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
|
2613 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
|
2614 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
|
2615 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
|
2616 virtual bool is_zliminclude (void) const { return false; } |
8249 | 2617 |
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
|
2618 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
|
2619 |
9972 | 2620 std::set<std::string> dynamic_property_names (void) const; |
2621 | |
2622 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
|
2623 |
6874 | 2624 protected: |
9972 | 2625 std::set<std::string> dynamic_properties; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2626 |
9972 | 2627 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
|
2628 |
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
9004
diff
changeset
|
2629 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
|
2630 |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2631 octave_value get_dynamic (bool all = false) const; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2632 |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
9004
diff
changeset
|
2633 property get_property_dynamic (const caseless_str& pname); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2634 |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2635 BEGIN_BASE_PROPERTIES |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2636 // properties common to all objects |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2637 bool_property beingdeleted , "off" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2638 radio_property busyaction , "{queue}|cancel" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2639 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
|
2640 children_property children gf , Matrix () |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2641 bool_property clipping , "on" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2642 callback_property createfcn , Matrix () |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2643 callback_property deletefcn , Matrix () |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2644 radio_property handlevisibility , "{on}|callback|off" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2645 bool_property hittest , "on" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2646 bool_property interruptible , "on" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2647 handle_property parent fs , p |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2648 bool_property selected , "off" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2649 bool_property selectionhighlight , "on" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2650 string_property tag s , "" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2651 string_property type frs , ty |
20077
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
2652 handle_property uicontextmenu u , graphics_handle () |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2653 any_property userdata , Matrix () |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2654 bool_property visible , "on" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2655 // additional (Octave-specific) properties |
22665
4ea5b0c3b10f
Make base graphics property __modified__ hidden (bug #49205).
Rik <rik@octave.org>
parents:
22631
diff
changeset
|
2656 bool_property __modified__ hs , "on" |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2657 graphics_handle __myhandle__ fhrs , mh |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2658 END_PROPERTIES |
7363 | 2659 |
2660 protected: | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2661 struct cmp_caseless_str |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2662 { |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
2663 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
|
2664 { |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2665 std::string a1 = a; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2666 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
|
2667 std::string b1 = b; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2668 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
|
2669 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2670 return a1 < b1; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2671 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2672 }; |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
8023
diff
changeset
|
2673 |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
8023
diff
changeset
|
2674 std::map<caseless_str, property, cmp_caseless_str> all_props; |
7363 | 2675 |
2676 protected: | |
2677 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
|
2678 { insert_property (name, property (&p, true)); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2679 |
22910
23847979b91e
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
2680 virtual void init (void) |
23847979b91e
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
2681 { |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
2682 uicontextmenu.add_constraint ("uicontextmenu"); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
2683 } |
6874 | 2684 }; |
2685 | |
7365 | 2686 class OCTINTERP_API base_graphics_object |
6874 | 2687 { |
2688 public: | |
2689 friend class graphics_object; | |
2690 | |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2691 base_graphics_object (void) : count (1), toolkit_flag (false) { } |
6874 | 2692 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
2693 // No copying! |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
2694 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
2695 base_graphics_object (const base_graphics_object&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
2696 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
2697 base_graphics_object& operator = (const base_graphics_object&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
2698 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2699 virtual ~base_graphics_object (void) = default; |
6874 | 2700 |
2701 virtual void mark_modified (void) | |
2702 { | |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2703 if (! valid_object ()) |
7386 | 2704 error ("base_graphics_object::mark_modified: invalid graphics object"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2705 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2706 get_properties ().mark_modified (); |
6874 | 2707 } |
2708 | |
7386 | 2709 virtual void override_defaults (base_graphics_object& obj) |
6874 | 2710 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2711 if (! valid_object ()) |
7386 | 2712 error ("base_graphics_object::override_defaults: invalid graphics object"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2713 get_properties ().override_defaults (obj); |
6874 | 2714 } |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
2715 |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2716 void build_user_defaults_map (property_list::pval_map_type &def, |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2717 const std::string go_name) const; |
6874 | 2718 |
7386 | 2719 virtual void set_from_list (property_list& plist) |
6874 | 2720 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2721 if (! valid_object ()) |
7386 | 2722 error ("base_graphics_object::set_from_list: invalid graphics object"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2723 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2724 get_properties ().set_from_list (*this, plist); |
6874 | 2725 } |
2726 | |
7386 | 2727 virtual void set (const caseless_str& pname, const octave_value& pval) |
6874 | 2728 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2729 if (! valid_object ()) |
7386 | 2730 error ("base_graphics_object::set: invalid graphics object"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2731 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2732 get_properties ().set (pname, pval); |
6874 | 2733 } |
2734 | |
2735 virtual void set_defaults (const std::string&) | |
2736 { | |
2737 error ("base_graphics_object::set_defaults: invalid graphics object"); | |
2738 } | |
2739 | |
7379 | 2740 virtual octave_value get (bool all = false) const |
6874 | 2741 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2742 if (! valid_object ()) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
2743 error ("base_graphics_object::get: invalid graphics object"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2744 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2745 return get_properties ().get (all); |
6874 | 2746 } |
2747 | |
7386 | 2748 virtual octave_value get (const caseless_str& pname) const |
6874 | 2749 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2750 if (! valid_object ()) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
2751 error ("base_graphics_object::get: invalid graphics object"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2752 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2753 return get_properties ().get (pname); |
6874 | 2754 } |
2755 | |
7189 | 2756 virtual octave_value get_default (const caseless_str&) const; |
6874 | 2757 |
7189 | 2758 virtual octave_value get_factory_default (const caseless_str&) const; |
6874 | 2759 |
2760 virtual octave_value get_defaults (void) const | |
2761 { | |
2762 error ("base_graphics_object::get_defaults: invalid graphics object"); | |
2763 } | |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
2764 |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2765 virtual property_list get_defaults_list (void) const |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2766 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2767 if (! valid_object ()) |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2768 error ("base_graphics_object::get_defaults_list: invalid graphics object"); |
21055
5e00ed38a58b
maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents:
21021
diff
changeset
|
2769 |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2770 return property_list (); |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2771 } |
6874 | 2772 |
2773 virtual octave_value get_factory_defaults (void) const | |
2774 { | |
2775 error ("base_graphics_object::get_factory_defaults: invalid graphics object"); | |
2776 } | |
2777 | |
18963
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
2778 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
|
2779 { |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
2780 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
|
2781 } |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
2782 |
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
|
2783 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
|
2784 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
2785 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
|
2786 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
2787 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
2788 virtual std::string values_as_string (void); |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
2789 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
2790 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
|
2791 |
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
|
2792 virtual octave_scalar_map values_as_struct (void); |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
2793 |
6874 | 2794 virtual graphics_handle get_parent (void) const |
2795 { | |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2796 if (! valid_object ()) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
2797 error ("base_graphics_object::get_parent: invalid graphics object"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2798 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2799 return get_properties ().get_parent (); |
6874 | 2800 } |
2801 | |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
2802 graphics_handle get_handle (void) const |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
2803 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2804 if (! valid_object ()) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
2805 error ("base_graphics_object::get_handle: invalid graphics object"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2806 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2807 return get_properties ().get___myhandle__ (); |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
2808 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
2809 |
7386 | 2810 virtual void remove_child (const graphics_handle& h) |
6874 | 2811 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2812 if (! valid_object ()) |
7386 | 2813 error ("base_graphics_object::remove_child: invalid graphics object"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2814 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2815 get_properties ().remove_child (h); |
6874 | 2816 } |
2817 | |
7386 | 2818 virtual void adopt (const graphics_handle& h) |
6874 | 2819 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2820 if (! valid_object ()) |
7386 | 2821 error ("base_graphics_object::adopt: invalid graphics object"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2822 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2823 get_properties ().adopt (h); |
6874 | 2824 } |
2825 | |
7386 | 2826 virtual void reparent (const graphics_handle& np) |
6874 | 2827 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2828 if (! valid_object ()) |
7386 | 2829 error ("base_graphics_object::reparent: invalid graphics object"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2830 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2831 get_properties ().reparent (np); |
6874 | 2832 } |
2833 | |
2834 virtual void defaults (void) const | |
2835 { | |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
2836 if (! valid_object ()) |
7386 | 2837 error ("base_graphics_object::default: invalid graphics object"); |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
2838 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
2839 std::string msg = (type () + "::defaults"); |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21055
diff
changeset
|
2840 err_not_implemented (msg.c_str ()); |
6874 | 2841 } |
2842 | |
2843 virtual base_properties& get_properties (void) | |
2844 { | |
2845 static base_properties properties; | |
22190
e68128601f5e
skip invalid objects in Qt graphics event handlers (bug #46501)
John W. Eaton <jwe@octave.org>
parents:
22069
diff
changeset
|
2846 warning ("base_graphics_object::get_properties: invalid graphics object"); |
e68128601f5e
skip invalid objects in Qt graphics event handlers (bug #46501)
John W. Eaton <jwe@octave.org>
parents:
22069
diff
changeset
|
2847 return properties; |
6874 | 2848 } |
2849 | |
7222 | 2850 virtual const base_properties& get_properties (void) const |
2851 { | |
2852 static base_properties properties; | |
22190
e68128601f5e
skip invalid objects in Qt graphics event handlers (bug #46501)
John W. Eaton <jwe@octave.org>
parents:
22069
diff
changeset
|
2853 warning ("base_graphics_object::get_properties: invalid graphics object"); |
e68128601f5e
skip invalid objects in Qt graphics event handlers (bug #46501)
John W. Eaton <jwe@octave.org>
parents:
22069
diff
changeset
|
2854 return properties; |
7222 | 2855 } |
2856 | |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
2857 virtual void update_axis_limits (const std::string& axis_type); |
7214 | 2858 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2859 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
|
2860 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
|
2861 |
6874 | 2862 virtual bool valid_object (void) const { return false; } |
2863 | |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2864 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
|
2865 |
7386 | 2866 virtual std::string type (void) const |
2867 { | |
2868 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
|
2869 : "unknown"); |
7386 | 2870 } |
6874 | 2871 |
2872 bool isa (const std::string& go_name) const | |
2873 { | |
2874 return type () == go_name; | |
2875 } | |
2876 | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2877 virtual graphics_toolkit get_toolkit (void) const |
7419 | 2878 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2879 if (! valid_object ()) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
2880 error ("base_graphics_object::get_toolkit: invalid graphics object"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2881 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2882 return get_properties ().get_toolkit (); |
7419 | 2883 } |
2884 | |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2885 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
|
2886 const octave_value& v, |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2887 listener_mode mode = POSTSET) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2888 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2889 if (valid_object ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2890 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
|
2891 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2892 |
8299
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
2893 virtual void delete_property_listener (const std::string& nm, |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2894 const octave_value& v, |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2895 listener_mode mode = POSTSET) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2896 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2897 if (valid_object ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2898 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
|
2899 } |
8299
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
2900 |
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
2901 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
|
2902 |
18963
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
2903 virtual void reset_default_properties (void); |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
2904 |
6874 | 2905 protected: |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2906 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
|
2907 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2908 if (! toolkit_flag) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2909 toolkit_flag = get_toolkit ().initialize (go); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2910 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2911 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2912 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
|
2913 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2914 if (toolkit_flag) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2915 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2916 get_toolkit ().finalize (go); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2917 toolkit_flag = false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2918 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2919 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2920 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2921 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
|
2922 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2923 if (toolkit_flag) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2924 get_toolkit ().update (go, id); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2925 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2926 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2927 protected: |
6874 | 2928 // A reference count. |
23012
27e4ec3b0b49
move octave_refcount inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23002
diff
changeset
|
2929 octave::refcount<int> count; |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
2930 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2931 // 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
|
2932 // 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
|
2933 bool toolkit_flag; |
6874 | 2934 }; |
2935 | |
7365 | 2936 class OCTINTERP_API graphics_object |
6874 | 2937 { |
2938 public: | |
2939 graphics_object (void) : rep (new base_graphics_object ()) { } | |
2940 | |
2941 graphics_object (base_graphics_object *new_rep) | |
2942 : rep (new_rep) { } | |
2943 | |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
2944 graphics_object (const graphics_object& obj) : rep (obj.rep) |
6874 | 2945 { |
2946 rep->count++; | |
2947 } | |
2948 | |
2949 graphics_object& operator = (const graphics_object& obj) | |
2950 { | |
2951 if (rep != obj.rep) | |
2952 { | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2953 if (--rep->count == 0) |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2954 delete rep; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2955 |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2956 rep = obj.rep; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2957 rep->count++; |
6874 | 2958 } |
2959 | |
2960 return *this; | |
2961 } | |
2962 | |
2963 ~graphics_object (void) | |
2964 { | |
2965 if (--rep->count == 0) | |
2966 delete rep; | |
2967 } | |
2968 | |
2969 void mark_modified (void) { rep->mark_modified (); } | |
2970 | |
2971 void override_defaults (base_graphics_object& obj) | |
2972 { | |
2973 rep->override_defaults (obj); | |
2974 } | |
2975 | |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
2976 void override_defaults (void) |
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
2977 { |
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
2978 rep->override_defaults (*rep); |
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
2979 } |
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
2980 |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2981 void build_user_defaults_map (property_list::pval_map_type &def, |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2982 const std::string go_name) const |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2983 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2984 rep->build_user_defaults_map (def, go_name); |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2985 } |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2986 |
7214 | 2987 void set_from_list (property_list& plist) { rep->set_from_list (plist); } |
6874 | 2988 |
7189 | 2989 void set (const caseless_str& name, const octave_value& val) |
6874 | 2990 { |
2991 rep->set (name, val); | |
2992 } | |
2993 | |
2994 void set (const octave_value_list& args); | |
2995 | |
10056
33ba83a06a42
Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
9972
diff
changeset
|
2996 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
|
2997 octave_idx_type row); |
33ba83a06a42
Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
9972
diff
changeset
|
2998 |
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
|
2999 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
|
3000 |
33ba83a06a42
Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
9972
diff
changeset
|
3001 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
|
3002 const octave_value& val); |
33ba83a06a42
Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
9972
diff
changeset
|
3003 |
7214 | 3004 void set_defaults (const std::string& mode) { rep->set_defaults (mode); } |
3005 | |
7379 | 3006 octave_value get (bool all = false) const { return rep->get (all); } |
6874 | 3007 |
7189 | 3008 octave_value get (const caseless_str& name) const |
6874 | 3009 { |
3010 return name.compare ("default") | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3011 ? get_defaults () |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3012 : (name.compare ("factory") |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3013 ? get_factory_defaults () : rep->get (name)); |
6874 | 3014 } |
3015 | |
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
|
3016 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
|
3017 { |
b00af0da85dd
graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents:
9616
diff
changeset
|
3018 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
|
3019 } |
b00af0da85dd
graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents:
9616
diff
changeset
|
3020 |
b00af0da85dd
graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents:
9616
diff
changeset
|
3021 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
|
3022 { |
b00af0da85dd
graphics.h.in: provide std::string and char* versions of graphics_object:get functions
John W. Eaton <jwe@octave.org>
parents:
9616
diff
changeset
|
3023 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
|
3024 } |
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
|
3025 |
7189 | 3026 octave_value get_default (const caseless_str& name) const |
6874 | 3027 { |
3028 return rep->get_default (name); | |
3029 } | |
3030 | |
7189 | 3031 octave_value get_factory_default (const caseless_str& name) const |
6874 | 3032 { |
3033 return rep->get_factory_default (name); | |
3034 } | |
3035 | |
3036 octave_value get_defaults (void) const { return rep->get_defaults (); } | |
3037 | |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3038 property_list get_defaults_list (void) const |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3039 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3040 return rep->get_defaults_list (); |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3041 } |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3042 |
6874 | 3043 octave_value get_factory_defaults (void) const |
3044 { | |
3045 return rep->get_factory_defaults (); | |
3046 } | |
3047 | |
18963
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
3048 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
|
3049 { |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
3050 return rep->get_factory_defaults_list (); |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
3051 } |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
3052 |
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
|
3053 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
|
3054 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
3055 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
|
3056 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
3057 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
3058 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
|
3059 |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
3060 std::string value_as_string (const std::string& prop) |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
3061 { |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
3062 return rep->value_as_string (prop); |
18118
ca84d3c9dc24
set: allow retrieving allowed values for individual properties
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17822
diff
changeset
|
3063 } |
ca84d3c9dc24
set: allow retrieving allowed values for individual properties
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17822
diff
changeset
|
3064 |
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
|
3065 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
|
3066 |
6874 | 3067 graphics_handle get_parent (void) const { return rep->get_parent (); } |
3068 | |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
3069 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
|
3070 |
11250
830b940e7ff4
Turn xget_ancestor into regular API
Michael Goffioul <michael.goffioul@gmail.com>
parents:
11247
diff
changeset
|
3071 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
|
3072 |
7214 | 3073 void remove_child (const graphics_handle& h) { rep->remove_child (h); } |
3074 | |
3075 void adopt (const graphics_handle& h) { rep->adopt (h); } | |
3076 | |
3077 void reparent (const graphics_handle& h) { rep->reparent (h); } | |
6874 | 3078 |
3079 void defaults (void) const { rep->defaults (); } | |
3080 | |
3081 bool isa (const std::string& go_name) const { return rep->isa (go_name); } | |
3082 | |
3083 base_properties& get_properties (void) { return rep->get_properties (); } | |
3084 | |
7222 | 3085 const base_properties& get_properties (void) const |
3086 { | |
3087 return rep->get_properties (); | |
3088 } | |
3089 | |
7214 | 3090 void update_axis_limits (const std::string& axis_type) |
3091 { | |
3092 rep->update_axis_limits (axis_type); | |
3093 } | |
3094 | |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
3095 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
|
3096 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
|
3097 { |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
3098 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
|
3099 } |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
3100 |
6874 | 3101 bool valid_object (void) const { return rep->valid_object (); } |
3102 | |
8208 | 3103 std::string type (void) const { return rep->type (); } |
3104 | |
6874 | 3105 operator bool (void) const { return rep->valid_object (); } |
3106 | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3107 // 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
|
3108 // genprops.awk script. |
7222 | 3109 // |
3110 // 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
|
3111 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3112 octave_value get_alim (void) const |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3113 { return get_properties ().get_alim (); } |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3114 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3115 octave_value get_clim (void) const |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3116 { return get_properties ().get_clim (); } |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3117 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
3118 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
|
3119 { 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
|
3120 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
3121 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
|
3122 { return get_properties ().get_ylim (); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
3123 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
3124 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
|
3125 { return get_properties ().get_zlim (); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
3126 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3127 bool is_aliminclude (void) const |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3128 { return get_properties ().is_aliminclude (); } |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3129 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3130 bool is_climinclude (void) const |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3131 { 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
|
3132 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
3133 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
|
3134 { return get_properties ().is_xliminclude (); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
3135 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
3136 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
|
3137 { return get_properties ().is_yliminclude (); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
3138 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
3139 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
|
3140 { return get_properties ().is_zliminclude (); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
3141 |
8249 | 3142 bool is_handle_visible (void) const |
3143 { return get_properties ().is_handle_visible (); } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
3144 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3145 graphics_toolkit get_toolkit (void) const { return rep->get_toolkit (); } |
7408 | 3146 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
3147 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
|
3148 listener_mode mode = POSTSET) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3149 { 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
|
3150 |
8299
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
3151 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
|
3152 listener_mode mode = POSTSET) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3153 { 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
|
3154 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3155 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
|
3156 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3157 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
|
3158 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3159 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
|
3160 |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
3161 void reset_default_properties (void) |
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
3162 { rep->reset_default_properties (); } |
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
3163 |
7408 | 3164 private: |
7419 | 3165 base_graphics_object *rep; |
7408 | 3166 }; |
3167 | |
3168 // --------------------------------------------------------------------- | |
3169 | |
7365 | 3170 class OCTINTERP_API root_figure : public base_graphics_object |
6874 | 3171 { |
3172 public: | |
7821
f79dcba526a8
Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7527
diff
changeset
|
3173 class OCTINTERP_API properties : public base_properties |
6874 | 3174 { |
3175 public: | |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
3176 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
|
3177 |
14357
e7c74f56cd03
fltk toolkit requires figure units to be "pixels". Bug # 35430.
Ben Abbott <bpabbott@mac.com>
parents:
14324
diff
changeset
|
3178 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
|
3179 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
|
3180 |
6874 | 3181 // See the genprops.awk script for an explanation of the |
3182 // properties declarations. | |
3183 | |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3184 // FIXME: Properties that still don't have callbacks are: |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3185 // monitorpositions, pointerlocation, pointerwindow. |
18764
89448a7523b2
Add some more callbacks for root properties (bug #42347).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18737
diff
changeset
|
3186 // 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
|
3187 // them will have no effect. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3188 |
20459
564e59f75ef8
Remove obsolete properties from root figure object.
Rik <rik@octave.org>
parents:
20428
diff
changeset
|
3189 // FIXME: The commandwindowsize property has been deprecated in Matlab |
564e59f75ef8
Remove obsolete properties from root figure object.
Rik <rik@octave.org>
parents:
20428
diff
changeset
|
3190 // and is now available through matlab.desktop.comandwindow.size. |
564e59f75ef8
Remove obsolete properties from root figure object.
Rik <rik@octave.org>
parents:
20428
diff
changeset
|
3191 // Until Octave has something similar, keep this property in root. |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3192 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3193 // Programming note: Keep property list sorted if new ones are added. |
9778 | 3194 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
3195 BEGIN_PROPERTIES (root_figure, root) |
9778 | 3196 handle_property callbackobject Sr , graphics_handle () |
3197 array_property commandwindowsize r , Matrix (1, 2, 0) | |
7363 | 3198 handle_property currentfigure S , graphics_handle () |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3199 string_property fixedwidthfontname , "Courier" |
21952
a5924b0cbf42
Return "Screensize" for root graphics property "MonitorPositions" (partial fix bug #48239).
Rik <rik@octave.org>
parents:
21948
diff
changeset
|
3200 array_property monitorpositions r , default_screensize () |
10949
848f3a13b7cf
Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents:
10948
diff
changeset
|
3201 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
|
3202 double_property pointerwindow r , 0.0 |
8560
5cc594679cdc
get display characteristics from system
John W. Eaton <jwe@octave.org>
parents:
8465
diff
changeset
|
3203 double_property screendepth r , default_screendepth () |
9778 | 3204 double_property screenpixelsperinch r , default_screenpixelsperinch () |
10949
848f3a13b7cf
Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents:
10948
diff
changeset
|
3205 array_property screensize r , default_screensize () |
9778 | 3206 bool_property showhiddenhandles , "off" |
8560
5cc594679cdc
get display characteristics from system
John W. Eaton <jwe@octave.org>
parents:
8465
diff
changeset
|
3207 radio_property units U , "inches|centimeters|normalized|points|{pixels}" |
6874 | 3208 END_PROPERTIES |
7822
edbaa13397ee
Implement callbackobject property in root object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7821
diff
changeset
|
3209 |
edbaa13397ee
Implement callbackobject property in root object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7821
diff
changeset
|
3210 private: |
edbaa13397ee
Implement callbackobject property in root object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7821
diff
changeset
|
3211 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
|
3212 |
6874 | 3213 }; |
3214 | |
3215 private: | |
3216 properties xproperties; | |
3217 | |
3218 public: | |
3219 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3220 root_figure (void) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3221 : xproperties (0, graphics_handle ()), default_properties () { } |
6874 | 3222 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3223 ~root_figure (void) = default; |
6874 | 3224 |
3225 void mark_modified (void) { } | |
3226 | |
3227 void override_defaults (base_graphics_object& obj) | |
3228 { | |
3229 // Now override with our defaults. If the default_properties | |
3230 // list includes the properties for all defaults (line, | |
3231 // surface, etc.) then we don't have to know the type of OBJ | |
3232 // here, we just call its set function and let it decide which | |
3233 // properties from the list to use. | |
3234 obj.set_from_list (default_properties); | |
3235 } | |
3236 | |
7189 | 3237 void set (const caseless_str& name, const octave_value& value) |
6874 | 3238 { |
3239 if (name.compare ("default", 7)) | |
3240 // strip "default", pass rest to function that will | |
3241 // parse the remainder and add the element to the | |
3242 // default_properties map. | |
3243 default_properties.set (name.substr (7), value); | |
3244 else | |
3245 xproperties.set (name, value); | |
3246 } | |
3247 | |
7189 | 3248 octave_value get (const caseless_str& name) const |
6874 | 3249 { |
3250 octave_value retval; | |
3251 | |
3252 if (name.compare ("default", 7)) | |
3253 return get_default (name.substr (7)); | |
3254 else if (name.compare ("factory", 7)) | |
3255 return get_factory_default (name.substr (7)); | |
3256 else | |
3257 retval = xproperties.get (name); | |
3258 | |
3259 return retval; | |
3260 } | |
3261 | |
7189 | 3262 octave_value get_default (const caseless_str& name) const |
6874 | 3263 { |
3264 octave_value retval = default_properties.lookup (name); | |
3265 | |
3266 if (retval.is_undefined ()) | |
7847
40b16e04172a
Make backend switching work.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7846
diff
changeset
|
3267 { |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
3268 // no default property found, use factory default |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
3269 retval = factory_properties.lookup (name); |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
3270 |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
3271 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
|
3272 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
|
3273 } |
6874 | 3274 |
3275 return retval; | |
3276 } | |
3277 | |
7189 | 3278 octave_value get_factory_default (const caseless_str& name) const |
6874 | 3279 { |
3280 octave_value retval = factory_properties.lookup (name); | |
3281 | |
3282 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
|
3283 error ("get: invalid factory default property '%s'", name.c_str ()); |
6874 | 3284 |
3285 return retval; | |
3286 } | |
3287 | |
3288 octave_value get_defaults (void) const | |
3289 { | |
3290 return default_properties.as_struct ("default"); | |
3291 } | |
3292 | |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3293 property_list get_defaults_list (void) const |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3294 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3295 return default_properties; |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3296 } |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3297 |
6874 | 3298 octave_value get_factory_defaults (void) const |
3299 { | |
3300 return factory_properties.as_struct ("factory"); | |
3301 } | |
3302 | |
18963
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
3303 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
|
3304 { |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
3305 return factory_properties; |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
3306 } |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
3307 |
6874 | 3308 base_properties& get_properties (void) { return xproperties; } |
3309 | |
7222 | 3310 const base_properties& get_properties (void) const { return xproperties; } |
3311 | |
6874 | 3312 bool valid_object (void) const { return true; } |
3313 | |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
3314 void reset_default_properties (void); |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
3315 |
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
|
3316 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
|
3317 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
3318 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
|
3319 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
|
3320 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
|
3321 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
|
3322 } |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
3323 |
6874 | 3324 private: |
3325 property_list default_properties; | |
3326 | |
3327 static property_list factory_properties; | |
3328 | |
3329 static property_list::plist_map_type init_factory_properties (void); | |
3330 }; | |
3331 | |
3332 // --------------------------------------------------------------------- | |
3333 | |
7365 | 3334 class OCTINTERP_API figure : public base_graphics_object |
6874 | 3335 { |
3336 public: | |
7445 | 3337 class OCTINTERP_API properties : public base_properties |
6874 | 3338 { |
3339 public: | |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
3340 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
|
3341 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3342 integerhandle = val; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3343 } |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
3344 |
8266
81b124f463f9
properly update currentaxes when axes are deleted
John W. Eaton <jwe@octave.org>
parents:
8263
diff
changeset
|
3345 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
|
3346 |
7366 | 3347 void set_visible (const octave_value& val); |
6874 | 3348 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3349 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
|
3350 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3351 if (! toolkit) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3352 toolkit = gtk_manager::get_toolkit (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3353 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3354 return toolkit; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3355 } |
7408 | 3356 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3357 void set_toolkit (const graphics_toolkit& b); |
7439 | 3358 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3359 void set___graphics_toolkit__ (const octave_value& val) |
7439 | 3360 { |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
3361 if (! val.is_string ()) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
3362 error ("set___graphics_toolkit__ must be a string"); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
3363 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
3364 std::string nm = val.string_value (); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
3365 graphics_toolkit b = gtk_manager::find_toolkit (nm); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
3366 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
3367 if (b.get_name () != nm) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
3368 error ("set___graphics_toolkit__: invalid graphics toolkit"); |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
3369 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
3370 if (nm != get___graphics_toolkit__ ()) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
3371 { |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
3372 set_toolkit (b); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
3373 mark_modified (); |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
3374 } |
7439 | 3375 } |
7408 | 3376 |
19044
4c59f69fa52c
figure: define adopted axes "currentaxes" if none is defined (bug #41573)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19021
diff
changeset
|
3377 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
|
3378 |
13713
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3379 void set_position (const octave_value& val, |
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3380 bool do_notify_toolkit = true); |
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3381 |
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3382 void set_outerposition (const octave_value& val, |
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3383 bool do_notify_toolkit = true); |
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3384 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3385 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
|
3386 const Matrix& parent_pix_size = Matrix ()) const; |
7445 | 3387 |
13713
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3388 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
|
3389 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
|
3390 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3391 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
|
3392 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3393 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
|
3394 |
10991
9d3a7ad94ee6
Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents:
10990
diff
changeset
|
3395 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
|
3396 |
9d3a7ad94ee6
Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents:
10990
diff
changeset
|
3397 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
|
3398 |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
3399 std::string get_title (void) const; |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
3400 |
6874 | 3401 // See the genprops.awk script for an explanation of the |
3402 // properties declarations. | |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3403 // FIXME: Several properties have been deleted from Matlab. |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3404 // We should either immediately remove them or figure out a way |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3405 // to deprecate them for a release or two. |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3406 // Obsolete properties: doublebuffer, mincolormap, wvisual, wvisualmode, |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3407 // xdisplay, xvisual, xvisualmode |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3408 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3409 // Programming note: Keep property list sorted if new ones are added. |
6874 | 3410 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
3411 BEGIN_PROPERTIES (figure) |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3412 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
|
3413 callback_property buttondownfcn , Matrix () |
7363 | 3414 callback_property closerequestfcn , "closereq" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3415 color_property color , color_property (color_values (1, 1, 1), radio_values ("none")) |
20761
47cec845dd5a
Set default colormap to viridis
Carlo de Falco <carlo.defalco@polimi.it>
parents:
20756
diff
changeset
|
3416 array_property colormap , viridis_colormap () |
7363 | 3417 handle_property currentaxes S , graphics_handle () |
7405 | 3418 string_property currentcharacter r , "" |
3419 handle_property currentobject r , graphics_handle () | |
10517 | 3420 array_property currentpoint r , Matrix (2, 1, 0) |
7405 | 3421 bool_property dockcontrols , "off" |
11247
29b1f7d68665
make filename property of figure objects writable
John W. Eaton <jwe@octave.org>
parents:
11175
diff
changeset
|
3422 string_property filename , "" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3423 bool_property graphicssmoothing , "on" |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
3424 bool_property integerhandle S , "on" |
21323
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21289
diff
changeset
|
3425 bool_property inverthardcopy , "on" |
7405 | 3426 callback_property keypressfcn , Matrix () |
3427 callback_property keyreleasefcn , Matrix () | |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3428 radio_property menubar , "{figure}|none" |
7405 | 3429 string_property name , "" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3430 // FIXME: Need RO property which returns current figure number. |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3431 // double_property number r , |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3432 radio_property nextplot , "{add}|new|replace|replacechildren" |
7405 | 3433 bool_property numbertitle , "on" |
13713
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3434 array_property outerposition s , Matrix (1, 4, -1.0) |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3435 radio_property paperorientation U , "{portrait}|landscape" |
18773
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3436 array_property paperposition m , default_figure_paperposition () |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3437 // FIXME: Matlab default is "auto", but this messes up hgsave BIST test. |
18773
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3438 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
|
3439 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
|
3440 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
|
3441 radio_property paperunits Su , "{inches}|centimeters|normalized|points" |
7405 | 3442 radio_property pointer , "crosshair|fullcrosshair|{arrow}|ibeam|watch|topl|topr|botl|botr|left|top|right|bottom|circle|cross|fleur|custom|hand" |
3443 array_property pointershapecdata , Matrix (16, 16, 0) | |
3444 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
|
3445 array_property position s , default_figure_position () |
21367
0035733e4b3a
graphics.in.h: Make sure XXXmode properties switch to "manual" if XXX is set.
Rik <rik@octave.org>
parents:
21323
diff
changeset
|
3446 radio_property renderer m , "{opengl}|painters" |
7405 | 3447 radio_property renderermode , "{auto}|manual" |
3448 bool_property resize , "on" | |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21952
diff
changeset
|
3449 // FIXME: resizefcn has been deprecated by Matlab, and |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3450 // replaced with sizechangedfcn |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3451 // Eventually this will need to be hidden, and then removed. |
7405 | 3452 callback_property resizefcn , Matrix () |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3453 radio_property selectiontype , "{normal}|extend|alt|open" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3454 callback_property sizechangedfcn , Matrix () |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3455 radio_property toolbar , "{auto}|figure|none" |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3456 radio_property units Su , "{pixels}|normalized|inches|centimeters|points|characters" |
7405 | 3457 callback_property windowbuttondownfcn , Matrix () |
3458 callback_property windowbuttonmotionfcn , Matrix () | |
3459 callback_property windowbuttonupfcn , Matrix () | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3460 callback_property windowkeypressfcn , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3461 callback_property windowkeyreleasefcn , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3462 callback_property windowscrollwheelfcn , Matrix () |
7405 | 3463 radio_property windowstyle , "{normal}|modal|docked" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3464 // Octave-specific properties |
21684
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
21659
diff
changeset
|
3465 mutable string_property __gl_extensions__ hr , "" |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
21659
diff
changeset
|
3466 mutable string_property __gl_renderer__ hr , "" |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
21659
diff
changeset
|
3467 mutable string_property __gl_vendor__ hr , "" |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
21659
diff
changeset
|
3468 mutable string_property __gl_version__ hr , "" |
19834
426525fb3b9f
Hide Octave-only figure property __graphics_toolkit__.
Rik <rik@octave.org>
parents:
19758
diff
changeset
|
3469 string_property __graphics_toolkit__ hs , gtk_manager::default_toolkit () |
13699
dd9b32af0a01
Implement guidata/guihandles.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13324
diff
changeset
|
3470 any_property __guidata__ h , Matrix () |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3471 radio_property __mouse_mode__ hS , "{none}|pan|rotate|select|text|zoom" |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3472 any_property __pan_mode__ h , Matrix () |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3473 any_property __plot_stream__ h , Matrix () |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3474 any_property __rotate_mode__ h , Matrix () |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3475 any_property __zoom_mode__ h , Matrix () |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3476 |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3477 // Obsolete properties: doublebuffer, mincolormap, wvisual, wvisualmode, |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3478 // xdisplay, xvisual, xvisualmode |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21952
diff
changeset
|
3479 // FIXME: Remove in version 4.6 |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3480 bool_property doublebuffer h , "on" |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3481 double_property mincolormap h , 64 |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3482 string_property wvisual hm , "" |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3483 radio_property wvisualmode h , "{auto}|manual" |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3484 string_property xdisplay h , "" |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3485 string_property xvisual hm , "" |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3486 radio_property xvisualmode h , "{auto}|manual" |
6874 | 3487 END_PROPERTIES |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
3488 |
7363 | 3489 protected: |
3490 void init (void) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3491 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3492 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
|
3493 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
|
3494 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
|
3495 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
|
3496 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
|
3497 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
|
3498 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
|
3499 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
|
3500 } |
7408 | 3501 |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
3502 private: |
18773
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3503 Matrix get_auto_paperposition (void); |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3504 |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3505 void update_paperpositionmode (void) |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3506 { |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3507 if (paperpositionmode.is ("auto")) |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3508 paperposition.set (get_auto_paperposition ()); |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3509 } |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3510 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3511 mutable graphics_toolkit toolkit; |
6874 | 3512 }; |
3513 | |
3514 private: | |
3515 properties xproperties; | |
3516 | |
3517 public: | |
3518 figure (const graphics_handle& mh, const graphics_handle& p) | |
3519 : base_graphics_object (), xproperties (mh, p), default_properties () | |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
3520 { } |
6874 | 3521 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3522 ~figure (void) = default; |
6874 | 3523 |
3524 void override_defaults (base_graphics_object& obj) | |
3525 { | |
3526 // Allow parent (root figure) to override first (properties knows how | |
3527 // to find the parent object). | |
3528 xproperties.override_defaults (obj); | |
3529 | |
3530 // Now override with our defaults. If the default_properties | |
3531 // list includes the properties for all defaults (line, | |
3532 // surface, etc.) then we don't have to know the type of OBJ | |
3533 // here, we just call its set function and let it decide which | |
3534 // properties from the list to use. | |
3535 obj.set_from_list (default_properties); | |
3536 } | |
3537 | |
7189 | 3538 void set (const caseless_str& name, const octave_value& value) |
6874 | 3539 { |
3540 if (name.compare ("default", 7)) | |
3541 // strip "default", pass rest to function that will | |
3542 // parse the remainder and add the element to the | |
3543 // default_properties map. | |
3544 default_properties.set (name.substr (7), value); | |
3545 else | |
3546 xproperties.set (name, value); | |
3547 } | |
3548 | |
7189 | 3549 octave_value get (const caseless_str& name) const |
6874 | 3550 { |
3551 octave_value retval; | |
3552 | |
3553 if (name.compare ("default", 7)) | |
3554 retval = get_default (name.substr (7)); | |
3555 else | |
3556 retval = xproperties.get (name); | |
3557 | |
3558 return retval; | |
3559 } | |
3560 | |
7189 | 3561 octave_value get_default (const caseless_str& name) const; |
6874 | 3562 |
3563 octave_value get_defaults (void) const | |
3564 { | |
3565 return default_properties.as_struct ("default"); | |
3566 } | |
3567 | |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3568 property_list get_defaults_list (void) const |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3569 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3570 return default_properties; |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3571 } |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3572 |
6874 | 3573 base_properties& get_properties (void) { return xproperties; } |
3574 | |
7222 | 3575 const base_properties& get_properties (void) const { return xproperties; } |
3576 | |
6874 | 3577 bool valid_object (void) const { return true; } |
3578 | |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
3579 void reset_default_properties (void); |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
3580 |
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
|
3581 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
|
3582 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
3583 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
|
3584 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
|
3585 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
|
3586 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
|
3587 } |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
3588 |
6874 | 3589 private: |
3590 property_list default_properties; | |
3591 }; | |
3592 | |
3593 // --------------------------------------------------------------------- | |
3594 | |
7435 | 3595 class OCTINTERP_API graphics_xform |
3596 { | |
3597 public: | |
3598 graphics_xform (void) | |
12174 | 3599 : xform (xform_eye ()), xform_inv (xform_eye ()), |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
3600 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
|
3601 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3602 zlim(1) = 1.0; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3603 } |
7435 | 3604 |
3605 graphics_xform (const Matrix& xm, const Matrix& xim, | |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
3606 const scaler& x, const scaler& y, const scaler& z, |
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
3607 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
|
3608 : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { } |
7435 | 3609 |
3610 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
|
3611 : 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
|
3612 sy (g.sy), sz (g.sz), zlim (g.zlim) { } |
7435 | 3613 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3614 ~graphics_xform (void) = default; |
7435 | 3615 |
3616 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
|
3617 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3618 xform = g.xform; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3619 xform_inv = g.xform_inv; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3620 sx = g.sx; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3621 sy = g.sy; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3622 sz = g.sz; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3623 zlim = g.zlim; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3624 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3625 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3626 } |
7435 | 3627 |
3628 static ColumnVector xform_vector (double x, double y, double z); | |
3629 | |
3630 static Matrix xform_eye (void); | |
3631 | |
3632 ColumnVector transform (double x, double y, double z, | |
10553 | 3633 bool use_scale = true) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
3634 |
7435 | 3635 ColumnVector untransform (double x, double y, double z, |
10553 | 3636 bool use_scale = true) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
3637 |
10553 | 3638 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
|
3639 { return untransform (x, y, (zlim(0)+zlim(1))/2, use_scale); } |
7435 | 3640 |
3641 Matrix xscale (const Matrix& m) const { return sx.scale (m); } | |
3642 Matrix yscale (const Matrix& m) const { return sy.scale (m); } | |
3643 Matrix zscale (const Matrix& m) const { return sz.scale (m); } | |
3644 | |
7832
e06fdf7ea647
Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7830
diff
changeset
|
3645 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
|
3646 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3647 bool has_z = (m.columns () > 2); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3648 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3649 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
|
3650 && (! has_z || sz.is_linear ())) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3651 return m; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3652 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3653 Matrix retval (m.dims ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3654 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3655 int r = m.rows (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3656 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3657 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
|
3658 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3659 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
|
3660 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
|
3661 if (has_z) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3662 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
|
3663 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3664 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3665 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3666 } |
7832
e06fdf7ea647
Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7830
diff
changeset
|
3667 |
7435 | 3668 private: |
3669 Matrix xform; | |
3670 Matrix xform_inv; | |
3671 scaler sx, sy, sz; | |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
3672 Matrix zlim; |
7435 | 3673 }; |
3674 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3675 enum |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3676 { |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3677 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
|
3678 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
|
3679 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
|
3680 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
|
3681 }; |
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3682 |
7365 | 3683 class OCTINTERP_API axes : public base_graphics_object |
6874 | 3684 { |
3685 public: | |
7445 | 3686 class OCTINTERP_API properties : public base_properties |
6874 | 3687 { |
3688 public: | |
3689 void set_defaults (base_graphics_object& obj, const std::string& mode); | |
3690 | |
3691 void remove_child (const graphics_handle& h); | |
3692 | |
7427 | 3693 const scaler& get_x_scaler (void) const { return sx; } |
3694 const scaler& get_y_scaler (void) const { return sy; } | |
3695 const scaler& get_z_scaler (void) const { return sz; } | |
3696 | |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3697 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
|
3698 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
|
3699 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
|
3700 bool only_text_height=false) const; |
7427 | 3701 |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
3702 double get___fontsize_points__ (double box_pix_height = 0) const; |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3703 |
7828
4739b6a1925c
Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7827
diff
changeset
|
3704 void update_boundingbox (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3705 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3706 if (units_is ("normalized")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3707 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3708 sync_positions (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3709 base_properties::update_boundingbox (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3710 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3711 } |
7828
4739b6a1925c
Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7827
diff
changeset
|
3712 |
7427 | 3713 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
|
3714 void update_axes_layout (void); |
7427 | 3715 void update_aspectratios (void); |
3716 void update_transform (void) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3717 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3718 update_aspectratios (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3719 update_camera (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3720 update_axes_layout (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3721 } |
7427 | 3722 |
17098
786bcce466e9
Initialize the tightinset during initialization of axes.
Ben Abbott <bpabbott@mac.com>
parents:
17011
diff
changeset
|
3723 void sync_positions (void); |
786bcce466e9
Initialize the tightinset during initialization of axes.
Ben Abbott <bpabbott@mac.com>
parents:
17011
diff
changeset
|
3724 |
12389
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
3725 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
|
3726 void update_xlabel_position (void); |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
3727 void update_ylabel_position (void); |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
3728 void update_zlabel_position (void); |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
3729 void update_title_position (void); |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
3730 |
7435 | 3731 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
|
3732 { return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); } |
7435 | 3733 |
3734 Matrix get_transform_matrix (void) const { return x_render; } | |
3735 Matrix get_inverse_transform_matrix (void) const { return x_render_inv; } | |
3736 Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; } | |
3737 Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; } | |
3738 Matrix get_transform_zlim (void) const { return x_zlim; } | |
3739 | |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3740 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
|
3741 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
|
3742 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
|
3743 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
|
3744 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
|
3745 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
|
3746 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
|
3747 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
|
3748 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
|
3749 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
|
3750 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
|
3751 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
|
3752 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
|
3753 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
|
3754 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
|
3755 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
|
3756 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
|
3757 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
|
3758 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
|
3759 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
|
3760 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
|
3761 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
|
3762 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
|
3763 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
|
3764 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
|
3765 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
|
3766 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
|
3767 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
|
3768 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
|
3769 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
|
3770 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
|
3771 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
|
3772 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
|
3773 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
|
3774 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
|
3775 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
|
3776 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
|
3777 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
|
3778 |
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
|
3779 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
|
3780 { 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
|
3781 |
1357bcae6e29
added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7836
diff
changeset
|
3782 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
|
3783 { 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
|
3784 |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3785 void zoom_about_point (const std::string& mode, double x, double y, |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3786 double factor, bool push_to_zoom_stack = true); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3787 void zoom (const std::string& mode, double factor, |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3788 bool push_to_zoom_stack = true); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3789 void zoom (const std::string& mode, const Matrix& xl, const Matrix& yl, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3790 bool push_to_zoom_stack = true); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3791 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3792 void translate_view (const std::string& mode, |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3793 double x0, double x1, double y0, double y1, |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3794 bool push_to_zoom_stack = true); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3795 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3796 void pan (const std::string& mode, double factor, |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3797 bool push_to_zoom_stack = true); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3798 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3799 void rotate3d (double x0, double x1, double y0, double y1, |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3800 bool push_to_zoom_stack = true); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3801 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3802 void rotate_view (double delta_az, double delta_el, |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3803 bool push_to_zoom_stack = true); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3804 |
7855
f317f14516cb
Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7854
diff
changeset
|
3805 void unzoom (void); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3806 void push_zoom_stack (void); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3807 void clear_zoom_stack (bool do_unzoom = true); |
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
|
3808 |
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
|
3809 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
|
3810 |
9d3a7ad94ee6
Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents:
10990
diff
changeset
|
3811 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
|
3812 |
7427 | 3813 private: |
3814 scaler sx, sy, sz; | |
3815 Matrix x_render, x_render_inv; | |
3816 Matrix x_gl_mat1, x_gl_mat2; | |
3817 Matrix x_zlim; | |
7855
f317f14516cb
Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7854
diff
changeset
|
3818 std::list<octave_value> zoom_stack; |
7427 | 3819 |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3820 // Axes layout data |
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3821 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
|
3822 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
|
3823 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
|
3824 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
|
3825 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
|
3826 double xtickoffset, ytickoffset, ztickoffset; |
18667
e42843ceff48
Fix axes bounding box not obeying 'layer' property.
Rik <rik@octave.org>
parents:
18646
diff
changeset
|
3827 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
|
3828 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
|
3829 |
21209
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
3830 // Text renderer, used for calculation of text (tick labels) size |
22326
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
3831 octave::text_renderer txt_renderer; |
12777
6c1d0f03c331
Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents:
12685
diff
changeset
|
3832 |
8249 | 3833 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
|
3834 const octave_value& v); |
8249 | 3835 |
8208 | 3836 void delete_text_child (handle_property& h); |
3837 | |
6874 | 3838 // See the genprops.awk script for an explanation of the |
3839 // properties declarations. | |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3840 |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3841 // FIXME: Several properties have been deleted from Matlab. |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3842 // We should either immediately remove them or figure out a way |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3843 // to deprecate them for a release or two. |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3844 // Obsolete properties: drawmode |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3845 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3846 // 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
|
3847 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
3848 BEGIN_PROPERTIES (axes) |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3849 radio_property activepositionproperty , "{outerposition}|position" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3850 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
|
3851 radio_property alimmode , "{auto}|manual" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3852 color_property ambientlightcolor , color_values (1, 1, 1) |
22351
e6df1ddfc3cf
Change DefaultAxesBox property to "off".
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
3853 bool_property box , "off" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3854 radio_property boxstyle , "{back}|full" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3855 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
|
3856 radio_property camerapositionmode , "{auto}|manual" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3857 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
|
3858 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
|
3859 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
|
3860 radio_property cameraupvectormode , "{auto}|manual" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3861 double_property cameraviewangle m , 6.6086 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3862 radio_property cameraviewanglemode , "{auto}|manual" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3863 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
|
3864 radio_property climmode al , "{auto}|manual" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3865 radio_property clippingstyle , "{3dbox}|rectangle" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3866 color_property color , color_property (color_values (1, 1, 1), radio_values ("none")) |
7363 | 3867 array_property colororder , default_colororder () |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3868 double_property colororderindex , 1.0 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3869 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
|
3870 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
|
3871 radio_property dataaspectratiomode u , "{auto}|manual" |
7403 | 3872 radio_property drawmode , "{normal}|fast" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3873 radio_property fontangle u , "{normal}|italic" |
12777
6c1d0f03c331
Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents:
12685
diff
changeset
|
3874 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
|
3875 double_property fontsize u , 10 |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3876 radio_property fontunits SU , "{points}|inches|centimeters|normalized|pixels" |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3877 bool_property fontsmoothing , "on" |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3878 radio_property fontweight u , "{normal}|bold" |
21367
0035733e4b3a
graphics.in.h: Make sure XXXmode properties switch to "manual" if XXX is set.
Rik <rik@octave.org>
parents:
21323
diff
changeset
|
3879 double_property gridalpha m , 0.15 |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3880 radio_property gridalphamode , "{auto}|manual" |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3881 color_property gridcolor , color_property (color_values (0.15, 0.15, 0.15), radio_values ("none")) |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3882 radio_property gridcolormode , "{auto}|manual" |
22056
05ad23810150
Use default gridlinestyle of '-' for Matlab compatibility.
Rik <rik@octave.org>
parents:
22022
diff
changeset
|
3883 radio_property gridlinestyle , "{-}|--|:|-.|none" |
22723
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3884 double_property labelfontsizemultiplier u , 1.1 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3885 radio_property layer u , "{bottom}|top" |
17382
50b2863d10a6
Create Matlab compatible linestyleorder char matrices (bug #34906)
Rik <rik@octave.org>
parents:
17104
diff
changeset
|
3886 // FIXME: should be kind of string array. |
50b2863d10a6
Create Matlab compatible linestyleorder char matrices (bug #34906)
Rik <rik@octave.org>
parents:
17104
diff
changeset
|
3887 any_property linestyleorder S , "-" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3888 double_property linestyleorderindex , 1.0 |
7403 | 3889 double_property linewidth , 0.5 |
21367
0035733e4b3a
graphics.in.h: Make sure XXXmode properties switch to "manual" if XXX is set.
Rik <rik@octave.org>
parents:
21323
diff
changeset
|
3890 double_property minorgridalpha m , 0.25 |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3891 radio_property minorgridalphamode , "{auto}|manual" |
21367
0035733e4b3a
graphics.in.h: Make sure XXXmode properties switch to "manual" if XXX is set.
Rik <rik@octave.org>
parents:
21323
diff
changeset
|
3892 color_property minorgridcolor m , color_property (color_values (0.1, 0.1, 0.1), radio_values ("none")) |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3893 radio_property minorgridcolormode , "{auto}|manual" |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3894 radio_property minorgridlinestyle , "{:}|-|--|-.|none" |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3895 radio_property nextplot , "{replace}|add|replacechildren" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3896 array_property outerposition u , default_axes_outerposition () |
11167
51ac3a08e53c
Fix {d,pb}aspectratios for OpenGL backends.
Konstantinos Poulios <logari81@googlemail.com>
parents:
11163
diff
changeset
|
3897 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
|
3898 radio_property plotboxaspectratiomode u , "{auto}|manual" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3899 radio_property pickableparts , "{visible}|all|none" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3900 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
|
3901 radio_property projection , "{orthographic}|perspective" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3902 radio_property sortmethod , "{depth}|childorder" |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3903 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
|
3904 radio_property tickdirmode u , "{auto}|manual" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3905 // FIXME: Added recently to Matlab, should replace interpreter property. |
20285
6db2ea5556a4
Make use of the axes "ticklabelinterpreter" property (bug #45438)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20274
diff
changeset
|
3906 radio_property ticklabelinterpreter , "{tex}|latex|none" |
14391
c9ec21bef97a
Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents:
14357
diff
changeset
|
3907 array_property ticklength u , default_axes_ticklength () |
7403 | 3908 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
|
3909 handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) |
22723
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3910 double_property titlefontsizemultiplier u , 1.1 |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3911 radio_property titlefontweight u , "{bold}|normal" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3912 // 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
|
3913 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
|
3914 array_property view u , default_axes_view () |
22319
1ddb53b6ad30
Add support for setting "(xy)axislocation" to "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22294
diff
changeset
|
3915 // FIXME: Remove "zero" in 4.6 |
1ddb53b6ad30
Add support for setting "(xy)axislocation" to "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22294
diff
changeset
|
3916 radio_property xaxislocation u , "{bottom}|top|origin|zero" |
23001
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3917 color_property xcolor mu , color_values (0.15, 0.15, 0.15) |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3918 radio_property xcolormode , "{auto}|manual" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3919 radio_property xdir u , "{normal}|reverse" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3920 bool_property xgrid , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3921 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
|
3922 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
|
3923 radio_property xlimmode al , "{auto}|manual" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3924 bool_property xminorgrid , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3925 bool_property xminortick , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3926 radio_property xscale alu , "{linear}|log" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3927 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
|
3928 // 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
|
3929 any_property xticklabel S , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3930 radio_property xticklabelmode u , "{auto}|manual" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3931 double_property xticklabelrotation , 0.0 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3932 radio_property xtickmode u , "{auto}|manual" |
22319
1ddb53b6ad30
Add support for setting "(xy)axislocation" to "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22294
diff
changeset
|
3933 // FIXME: Remove "zero" in 4.6 |
1ddb53b6ad30
Add support for setting "(xy)axislocation" to "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22294
diff
changeset
|
3934 radio_property yaxislocation u , "{left}|right|origin|zero" |
23001
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3935 color_property ycolor mu , color_values (0.15, 0.15, 0.15) |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3936 radio_property ycolormode , "{auto}|manual" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3937 radio_property ydir u , "{normal}|reverse" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3938 bool_property ygrid , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3939 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
|
3940 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
|
3941 radio_property ylimmode al , "{auto}|manual" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3942 bool_property yminorgrid , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3943 bool_property yminortick , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3944 radio_property yscale alu , "{linear}|log" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3945 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
|
3946 any_property yticklabel S , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3947 radio_property yticklabelmode u , "{auto}|manual" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3948 double_property yticklabelrotation , 0.0 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3949 radio_property ytickmode u , "{auto}|manual" |
23001
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3950 color_property zcolor mu , color_values (0.15, 0.15, 0.15) |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3951 radio_property zcolormode , "{auto}|manual" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3952 radio_property zdir u , "{normal}|reverse" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3953 bool_property zgrid , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3954 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
|
3955 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
|
3956 radio_property zlimmode al , "{auto}|manual" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3957 bool_property zminorgrid , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3958 bool_property zminortick , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3959 radio_property zscale alu , "{linear}|log" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3960 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
|
3961 any_property zticklabel S , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3962 radio_property zticklabelmode u , "{auto}|manual" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3963 double_property zticklabelrotation , 0.0 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3964 radio_property ztickmode u , "{auto}|manual" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3965 // Octave-specific properties |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3966 double_property mousewheelzoom , 0.5 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3967 // hidden properties for alignment of subplots |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
3968 radio_property __autopos_tag__ h , "{none}|subplot" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3969 // hidden properties for inset |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3970 array_property looseinset hu , Matrix (1, 4, 0.0) |
7403 | 3971 // hidden properties for transformation computation |
3972 array_property x_viewtransform h , Matrix (4, 4, 0.0) | |
3973 array_property x_projectiontransform h , Matrix (4, 4, 0.0) | |
3974 array_property x_viewporttransform h , Matrix (4, 4, 0.0) | |
3975 array_property x_normrendertransform h , Matrix (4, 4, 0.0) | |
3976 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
|
3977 // hidden properties for minor ticks |
22623
76f1164d2135
Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
3978 row_vector_property xminortickvalues h , Matrix () |
76f1164d2135
Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
3979 row_vector_property yminortickvalues h , Matrix () |
76f1164d2135
Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
3980 row_vector_property zminortickvalues h , Matrix () |
19047
1288a2f27769
Handle non "points" fontunits properties (bug # 40158)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19044
diff
changeset
|
3981 // hidden property for text rendering |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
3982 double_property __fontsize_points__ hgr , 0 |
7189 | 3983 END_PROPERTIES |
6874 | 3984 |
7363 | 3985 protected: |
8249 | 3986 void init (void); |
7427 | 3987 |
3988 private: | |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3989 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3990 std::string |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3991 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
|
3992 { |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3993 std::string retval = scale; |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3994 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3995 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
|
3996 retval = "neglog"; |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3997 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3998 return retval; |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3999 } |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4000 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4001 void update_xscale (void) |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4002 { |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4003 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
|
4004 } |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4005 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4006 void update_yscale (void) |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4007 { |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4008 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
|
4009 } |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4010 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4011 void update_zscale (void) |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4012 { |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4013 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
|
4014 } |
7427 | 4015 |
23001
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
4016 void update_label_color (handle_property label, color_property col); |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
4017 void update_xcolor (void) |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
4018 { update_label_color (xlabel, xcolor); } |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
4019 |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
4020 void update_ycolor (void) |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
4021 { update_label_color (ylabel, ycolor); } |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
4022 |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
4023 void update_zcolor (void) |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
4024 { update_label_color (zlabel, zcolor); } |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
4025 |
12440
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4026 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
|
4027 void update_dataaspectratio (void) { sync_positions (); } |
b932ae4381da
improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12440
diff
changeset
|
4028 void update_dataaspectratiomode (void) { sync_positions (); } |
b932ae4381da
improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12440
diff
changeset
|
4029 void update_plotboxaspectratio (void) { sync_positions (); } |
b932ae4381da
improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12440
diff
changeset
|
4030 void update_plotboxaspectratiomode (void) { sync_positions (); } |
7427 | 4031 |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
4032 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
|
4033 void update_yaxislocation (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4034 { |
22319
1ddb53b6ad30
Add support for setting "(xy)axislocation" to "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22294
diff
changeset
|
4035 // FIXME: Remove warning with "zero" in 4.6 |
1ddb53b6ad30
Add support for setting "(xy)axislocation" to "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22294
diff
changeset
|
4036 if (yaxislocation_is ("zero")) |
1ddb53b6ad30
Add support for setting "(xy)axislocation" to "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22294
diff
changeset
|
4037 warning_with_id ("Octave:deprecated-property", |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22351
diff
changeset
|
4038 "Setting 'yaxislocation' to 'zero' is deprecated, " |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22351
diff
changeset
|
4039 "set to 'origin' instead."); |
19652
5b4fd7ebcfc6
Update "tightinset" when "x/yaxislocation" is changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19597
diff
changeset
|
4040 sync_positions (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4041 update_axes_layout (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4042 update_ylabel_position (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4043 } |
12503
2c66314447f1
update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents:
12496
diff
changeset
|
4044 void update_xaxislocation (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4045 { |
22319
1ddb53b6ad30
Add support for setting "(xy)axislocation" to "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22294
diff
changeset
|
4046 // FIXME: Remove warning with "zero" in 4.6 |
1ddb53b6ad30
Add support for setting "(xy)axislocation" to "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22294
diff
changeset
|
4047 if (xaxislocation_is ("zero")) |
1ddb53b6ad30
Add support for setting "(xy)axislocation" to "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22294
diff
changeset
|
4048 warning_with_id ("Octave:deprecated-property", |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22351
diff
changeset
|
4049 "Setting 'xaxislocation' to 'zero' is deprecated, " |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22351
diff
changeset
|
4050 "set to 'origin' instead."); |
19652
5b4fd7ebcfc6
Update "tightinset" when "x/yaxislocation" is changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19597
diff
changeset
|
4051 sync_positions (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4052 update_axes_layout (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4053 update_xlabel_position (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4054 } |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
4055 |
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
4056 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
|
4057 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
|
4058 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
|
4059 |
14391
c9ec21bef97a
Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents:
14357
diff
changeset
|
4060 void update_ticklength (void); |
c9ec21bef97a
Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents:
14357
diff
changeset
|
4061 void update_tickdir (void) { update_ticklength (); } |
c9ec21bef97a
Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents:
14357
diff
changeset
|
4062 void update_tickdirmode (void) { update_ticklength (); } |
7446 | 4063 |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4064 void update_xtick (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4065 { |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4066 calc_ticks_and_lims (xlim, xtick, xminortickvalues, xlimmode.is ("auto"), |
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4067 xtickmode.is ("auto"), xscale.is ("log")); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4068 if (xticklabelmode.is ("auto")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4069 calc_ticklabels (xtick, xticklabel, xscale.is ("log")); |
19659
a9516bc4c55c
Update axes "tightinset" when "x/y/ztick" have changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19652
diff
changeset
|
4070 sync_positions (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4071 } |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4072 void update_ytick (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4073 { |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4074 calc_ticks_and_lims (ylim, ytick, yminortickvalues, ylimmode.is ("auto"), |
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4075 ytickmode.is ("auto"), yscale.is ("log")); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4076 if (yticklabelmode.is ("auto")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4077 calc_ticklabels (ytick, yticklabel, yscale.is ("log")); |
19659
a9516bc4c55c
Update axes "tightinset" when "x/y/ztick" have changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19652
diff
changeset
|
4078 sync_positions (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4079 } |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4080 void update_ztick (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4081 { |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4082 calc_ticks_and_lims (zlim, ztick, zminortickvalues, zlimmode.is ("auto"), |
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4083 ztickmode.is ("auto"), zscale.is ("log")); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4084 if (zticklabelmode.is ("auto")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4085 calc_ticklabels (ztick, zticklabel, zscale.is ("log")); |
19659
a9516bc4c55c
Update axes "tightinset" when "x/y/ztick" have changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19652
diff
changeset
|
4086 sync_positions (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4087 } |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4088 |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
4089 void update_xtickmode (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4090 { |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
4091 if (xtickmode.is ("auto")) |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4092 update_xtick (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4093 } |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
4094 void update_ytickmode (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4095 { |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
4096 if (ytickmode.is ("auto")) |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4097 update_ytick (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4098 } |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
4099 void update_ztickmode (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4100 { |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
4101 if (ztickmode.is ("auto")) |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4102 update_ztick (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4103 } |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
4104 |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4105 void update_xticklabelmode (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4106 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4107 if (xticklabelmode.is ("auto")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4108 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
|
4109 } |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4110 void update_yticklabelmode (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4111 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4112 if (yticklabelmode.is ("auto")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4113 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
|
4114 } |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4115 void update_zticklabelmode (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4116 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4117 if (zticklabelmode.is ("auto")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4118 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
|
4119 } |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4120 |
22723
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4121 void update_font (std::string prop = ""); |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4122 void update_fontname (void) |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4123 { |
22723
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4124 update_font ("fontname"); |
19684
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
4125 sync_positions (); |
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
4126 } |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4127 void update_fontsize (void) |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4128 { |
22723
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4129 update_font ("fontsize"); |
19684
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
4130 sync_positions (); |
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
4131 } |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4132 void update_fontangle (void) |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4133 { |
22723
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4134 update_font ("fontangle"); |
19684
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
4135 sync_positions (); |
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
4136 } |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4137 void update_fontweight (void) |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4138 { |
22723
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4139 update_font ("fontweight"); |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4140 sync_positions (); |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4141 } |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4142 |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4143 void update_titlefontsizemultiplier (void) |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4144 { |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4145 update_font ("fontsize"); |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4146 sync_positions (); |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4147 } |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4148 |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4149 void update_labelfontsizemultiplier (void) |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4150 { |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4151 update_font ("fontsize"); |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4152 sync_positions (); |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4153 } |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4154 |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4155 void update_titlefontweight (void) |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4156 { |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
4157 update_font ("fontweight"); |
19684
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
4158 sync_positions (); |
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
4159 } |
12777
6c1d0f03c331
Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents:
12685
diff
changeset
|
4160 |
12440
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4161 void update_outerposition (void) |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4162 { |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4163 set_activepositionproperty ("outerposition"); |
17011
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4164 caseless_str old_units = get_units (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4165 set_units ("normalized"); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4166 Matrix outerbox = outerposition.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4167 Matrix innerbox = position.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4168 Matrix linset = looseinset.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4169 Matrix tinset = tightinset.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4170 outerbox(2) = outerbox(2) + outerbox(0); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4171 outerbox(3) = outerbox(3) + outerbox(1); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4172 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
|
4173 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
|
4174 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
|
4175 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
|
4176 innerbox(2) = innerbox(2) - innerbox(0); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4177 innerbox(3) = innerbox(3) - innerbox(1); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4178 position = innerbox; |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4179 set_units (old_units); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4180 update_transform (); |
12440
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4181 } |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4182 |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4183 void update_position (void) |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4184 { |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4185 set_activepositionproperty ("position"); |
17011
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4186 caseless_str old_units = get_units (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4187 set_units ("normalized"); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4188 Matrix outerbox = outerposition.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4189 Matrix innerbox = position.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4190 Matrix linset = looseinset.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4191 Matrix tinset = tightinset.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4192 innerbox(2) = innerbox(2) + innerbox(0); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4193 innerbox(3) = innerbox(3) + innerbox(1); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4194 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
|
4195 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
|
4196 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
|
4197 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
|
4198 outerbox(2) = outerbox(2) - outerbox(0); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4199 outerbox(3) = outerbox(3) - outerbox(1); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4200 outerposition = outerbox; |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4201 set_units (old_units); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4202 update_transform (); |
12440
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4203 } |
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
|
4204 |
17011
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4205 void update_looseinset (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4206 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4207 caseless_str old_units = get_units (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4208 set_units ("normalized"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4209 Matrix innerbox = position.get ().matrix_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4210 innerbox(2) = innerbox(2) + innerbox(0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4211 innerbox(3) = innerbox(3) + innerbox(1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4212 Matrix outerbox = outerposition.get ().matrix_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4213 outerbox(2) = outerbox(2) + outerbox(0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4214 outerbox(3) = outerbox(3) + outerbox(1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4215 Matrix linset = looseinset.get ().matrix_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4216 Matrix tinset = tightinset.get ().matrix_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4217 if (activepositionproperty.is ("position")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4218 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4219 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
|
4220 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
|
4221 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
|
4222 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
|
4223 outerbox(2) = outerbox(2) - outerbox(0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4224 outerbox(3) = outerbox(3) - outerbox(1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4225 outerposition = outerbox; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4226 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4227 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4228 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4229 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
|
4230 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
|
4231 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
|
4232 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
|
4233 innerbox(2) = innerbox(2) - innerbox(0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4234 innerbox(3) = innerbox(3) - innerbox(1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4235 position = innerbox; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4236 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4237 set_units (old_units); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4238 update_transform (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4239 } |
12467
2f83974d5a6d
implement looseinset property for axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12443
diff
changeset
|
4240 |
7827
3584f37eac69
better tick and limit handling, still missing logscale support
Shai Ayal <shaiay@sourceforge.net>
parents:
7826
diff
changeset
|
4241 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
|
4242 void calc_ticks_and_lims (array_property& lims, array_property& ticks, |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4243 array_property& mticks, bool limmode_is_auto, |
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4244 bool tickmode_is_auto, bool is_logscale); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4245 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
|
4246 bool is_logscale); |
12334
63dc132a1000
Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents:
12327
diff
changeset
|
4247 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
|
4248 const string_vector& ticklabels, |
63dc132a1000
Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents:
12327
diff
changeset
|
4249 const Matrix& limits); |
63dc132a1000
Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents:
12327
diff
changeset
|
4250 |
7854
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4251 void fix_limits (array_property& lims) |
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4252 { |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4253 if (lims.get ().is_empty ()) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4254 return; |
7854
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4255 |
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4256 Matrix l = lims.get ().matrix_value (); |
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4257 if (l(0) > l(1)) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4258 { |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4259 l(0) = 0; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4260 l(1) = 1; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4261 lims = l; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4262 } |
7854
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4263 else if (l(0) == l(1)) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4264 { |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4265 l(0) -= 0.5; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4266 l(1) += 0.5; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4267 lims = l; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4268 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4269 } |
7446 | 4270 |
12440
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4271 Matrix calc_tightbox (const Matrix& init_pos); |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4272 |
7446 | 4273 public: |
13132
e3e8ca96f923
Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents:
12965
diff
changeset
|
4274 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
|
4275 double min_pos, double max_neg, |
e3e8ca96f923
Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents:
12965
diff
changeset
|
4276 bool logscale); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4277 |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
4278 void update_xlim () |
7446 | 4279 { |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4280 calc_ticks_and_lims (xlim, xtick, xminortickvalues, xlimmode.is ("auto"), |
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4281 xtickmode.is ("auto"), xscale.is ("log")); |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4282 if (xticklabelmode.is ("auto")) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4283 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
|
4284 |
7854
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4285 fix_limits (xlim); |
7855
f317f14516cb
Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7854
diff
changeset
|
4286 |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4287 update_xscale (); |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4288 |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
4289 update_axes_layout (); |
7446 | 4290 } |
4291 | |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
4292 void update_ylim (void) |
7446 | 4293 { |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4294 calc_ticks_and_lims (ylim, ytick, yminortickvalues, ylimmode.is ("auto"), |
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4295 ytickmode.is ("auto"), yscale.is ("log")); |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4296 if (yticklabelmode.is ("auto")) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4297 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
|
4298 |
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4299 fix_limits (ylim); |
7855
f317f14516cb
Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7854
diff
changeset
|
4300 |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4301 update_yscale (); |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4302 |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
4303 update_axes_layout (); |
7446 | 4304 } |
4305 | |
4306 void update_zlim (void) | |
4307 { | |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4308 calc_ticks_and_lims (zlim, ztick, zminortickvalues, zlimmode.is ("auto"), |
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4309 ztickmode.is ("auto"), zscale.is ("log")); |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4310 if (zticklabelmode.is ("auto")) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4311 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
|
4312 |
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4313 fix_limits (zlim); |
7855
f317f14516cb
Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7854
diff
changeset
|
4314 |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4315 update_zscale (); |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4316 |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
4317 update_axes_layout (); |
7446 | 4318 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4319 |
6874 | 4320 }; |
4321 | |
4322 private: | |
4323 properties xproperties; | |
4324 | |
4325 public: | |
4326 axes (const graphics_handle& mh, const graphics_handle& p) | |
4327 : base_graphics_object (), xproperties (mh, p), default_properties () | |
4328 { | |
19087
3e0720bd6bfc
Fix setting axes default x/y/zlabel with string values (bug #34755)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19086
diff
changeset
|
4329 xproperties.update_transform (); |
6874 | 4330 } |
4331 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
4332 ~axes (void) = default; |
6874 | 4333 |
4334 void override_defaults (base_graphics_object& obj) | |
4335 { | |
4336 // Allow parent (figure) to override first (properties knows how | |
4337 // to find the parent object). | |
4338 xproperties.override_defaults (obj); | |
4339 | |
4340 // Now override with our defaults. If the default_properties | |
4341 // list includes the properties for all defaults (line, | |
4342 // surface, etc.) then we don't have to know the type of OBJ | |
4343 // here, we just call its set function and let it decide which | |
4344 // properties from the list to use. | |
4345 obj.set_from_list (default_properties); | |
4346 } | |
4347 | |
7189 | 4348 void set (const caseless_str& name, const octave_value& value) |
6874 | 4349 { |
4350 if (name.compare ("default", 7)) | |
4351 // strip "default", pass rest to function that will | |
4352 // parse the remainder and add the element to the | |
4353 // default_properties map. | |
4354 default_properties.set (name.substr (7), value); | |
4355 else | |
4356 xproperties.set (name, value); | |
4357 } | |
4358 | |
4359 void set_defaults (const std::string& mode) | |
4360 { | |
4361 xproperties.set_defaults (*this, mode); | |
4362 } | |
4363 | |
7189 | 4364 octave_value get (const caseless_str& name) const |
6874 | 4365 { |
4366 octave_value retval; | |
4367 | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4368 // FIXME: finish this. |
6874 | 4369 if (name.compare ("default", 7)) |
4370 retval = get_default (name.substr (7)); | |
4371 else | |
4372 retval = xproperties.get (name); | |
4373 | |
4374 return retval; | |
4375 } | |
4376 | |
7189 | 4377 octave_value get_default (const caseless_str& name) const; |
6874 | 4378 |
4379 octave_value get_defaults (void) const | |
4380 { | |
4381 return default_properties.as_struct ("default"); | |
4382 } | |
4383 | |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
4384 property_list get_defaults_list (void) const |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
4385 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
4386 return default_properties; |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
4387 } |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
4388 |
6874 | 4389 base_properties& get_properties (void) { return xproperties; } |
4390 | |
7222 | 4391 const base_properties& get_properties (void) const { return xproperties; } |
4392 | |
7214 | 4393 void update_axis_limits (const std::string& axis_type); |
4394 | |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
4395 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
|
4396 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
|
4397 |
6874 | 4398 bool valid_object (void) const { return true; } |
4399 | |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
4400 void reset_default_properties (void); |
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
4401 |
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
|
4402 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
|
4403 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4404 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
|
4405 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
|
4406 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
|
4407 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
|
4408 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4409 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
4410 protected: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
4411 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
|
4412 |
6874 | 4413 private: |
4414 property_list default_properties; | |
4415 }; | |
4416 | |
4417 // --------------------------------------------------------------------- | |
4418 | |
7365 | 4419 class OCTINTERP_API line : public base_graphics_object |
6874 | 4420 { |
4421 public: | |
7821
f79dcba526a8
Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7527
diff
changeset
|
4422 class OCTINTERP_API properties : public base_properties |
6874 | 4423 { |
4424 public: | |
4425 // See the genprops.awk script for an explanation of the | |
4426 // properties declarations. | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4427 // Programming note: Keep property list sorted if new ones are added. |
7366 | 4428 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
4429 BEGIN_PROPERTIES (line) |
20738
f90295782d60
Accept color value of "none" for line objects (bug #44224).
Rik <rik@octave.org>
parents:
20730
diff
changeset
|
4430 color_property color , color_property (color_values (0, 0, 0), radio_values ("none")) |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4431 string_property displayname , "" |
21905
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
4432 // FIXME: Remove erasemode property in version 4.6. |
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
4433 radio_property erasemode h , "{normal}|none|xor|background" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4434 // 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
|
4435 // 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
|
4436 radio_property interpreter , "{tex}|none|latex" |
22759
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
4437 radio_property linejoin , "{round}|miter|chamfer" |
7363 | 4438 radio_property linestyle , "{-}|--|:|-.|none" |
4439 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
|
4440 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
|
4441 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
|
4442 color_property markerfacecolor , color_property (radio_values ("auto|{none}"), color_values (0, 0, 0)) |
7363 | 4443 double_property markersize , 6 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4444 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
|
4445 string_property xdatasource , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4446 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
|
4447 string_property ydatasource , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4448 row_vector_property zdata u , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4449 string_property zdatasource , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4450 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4451 // 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
|
4452 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
|
4453 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
|
4454 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
|
4455 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
|
4456 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
|
4457 bool_property zliminclude hl , "off" |
6874 | 4458 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
|
4459 |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4460 protected: |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4461 void init (void) |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4462 { |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4463 linewidth.add_constraint ("min", 0, false); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4464 markersize.add_constraint ("min", 0, false); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4465 } |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4466 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4467 private: |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4468 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
|
4469 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
|
4470 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4471 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
|
4472 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4473 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
|
4474 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4475 void update_zdata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4476 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4477 set_zlim (zdata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4478 set_zliminclude (get_zdata ().numel () > 0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4479 } |
6874 | 4480 }; |
4481 | |
4482 private: | |
4483 properties xproperties; | |
4484 | |
4485 public: | |
4486 line (const graphics_handle& mh, const graphics_handle& p) | |
4487 : base_graphics_object (), xproperties (mh, p) | |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
4488 { } |
6874 | 4489 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
4490 ~line (void) = default; |
6874 | 4491 |
4492 base_properties& get_properties (void) { return xproperties; } | |
4493 | |
7222 | 4494 const base_properties& get_properties (void) const { return xproperties; } |
4495 | |
6874 | 4496 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
|
4497 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4498 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
|
4499 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4500 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
|
4501 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
|
4502 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
|
4503 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
|
4504 } |
6874 | 4505 }; |
4506 | |
4507 // --------------------------------------------------------------------- | |
4508 | |
7365 | 4509 class OCTINTERP_API text : public base_graphics_object |
6874 | 4510 { |
4511 public: | |
7821
f79dcba526a8
Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7527
diff
changeset
|
4512 class OCTINTERP_API properties : public base_properties |
6874 | 4513 { |
4514 public: | |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
4515 double get___fontsize_points__ (double box_pix_height = 0) const; |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
4516 |
14448
7a49519913e3
Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents:
14391
diff
changeset
|
4517 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
|
4518 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4519 octave_value new_val (val); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4520 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4521 if (new_val.numel () == 2) |
14448
7a49519913e3
Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents:
14391
diff
changeset
|
4522 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4523 dim_vector dv (1, 3); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4524 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4525 new_val = new_val.resize (dv, true); |
14448
7a49519913e3
Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents:
14391
diff
changeset
|
4526 } |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4527 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4528 if (position.set (new_val, false)) |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4529 { |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4530 set_positionmode ("manual"); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4531 update_position (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4532 position.run_listeners (POSTSET); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4533 mark_modified (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4534 } |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4535 else |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4536 set_positionmode ("manual"); |
14448
7a49519913e3
Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents:
14391
diff
changeset
|
4537 } |
7a49519913e3
Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents:
14391
diff
changeset
|
4538 |
6874 | 4539 // See the genprops.awk script for an explanation of the |
4540 // properties declarations. | |
4541 | |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
4542 BEGIN_PROPERTIES (text) |
17646
993ea21b7e03
graphics.in.h: Text "edgecolor" property should default to "none".
Rik <rik@octave.org>
parents:
17645
diff
changeset
|
4543 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
|
4544 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
|
4545 string_property displayname , "" |
17645
85a057ad1ba6
Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents:
17631
diff
changeset
|
4546 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
|
4547 bool_property editing , "off" |
21905
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
4548 radio_property erasemode h , "{normal}|none|xor|background" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4549 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
|
4550 radio_property fontangle u , "{normal}|italic|oblique" |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4551 string_property fontname u , OCTAVE_DEFAULT_FONTNAME |
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4552 double_property fontsize u , 10 |
19047
1288a2f27769
Handle non "points" fontunits properties (bug # 40158)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19044
diff
changeset
|
4553 radio_property fontunits SU , "inches|centimeters|normalized|{points}|pixels" |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4554 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
|
4555 radio_property horizontalalignment mu , "{left}|center|right" |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4556 radio_property interpreter u , "{tex}|none|latex" |
7377 | 4557 radio_property linestyle , "{-}|--|:|-.|none" |
4558 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
|
4559 double_property margin , 2 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4560 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
|
4561 double_property rotation mu , 0 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4562 text_label_property string u , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4563 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
|
4564 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
|
4565 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4566 // 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
|
4567 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
|
4568 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
|
4569 row_vector_property zlim hlr , Matrix () |
11281
3f952c6973f7
graphics.h.in: Change intended for 11272.
Ben Abbott <bpabbott@mac.com>
parents:
11250
diff
changeset
|
4570 bool_property xliminclude hl , "off" |
3f952c6973f7
graphics.h.in: Change intended for 11272.
Ben Abbott <bpabbott@mac.com>
parents:
11250
diff
changeset
|
4571 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
|
4572 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
|
4573 // hidden properties for auto-positioning |
12389
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4574 radio_property positionmode hu , "{auto}|manual" |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4575 radio_property rotationmode hu , "{auto}|manual" |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4576 radio_property horizontalalignmentmode hu , "{auto}|manual" |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4577 radio_property verticalalignmentmode hu , "{auto}|manual" |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
4578 radio_property __autopos_tag__ h , "{none}|xlabel|ylabel|zlabel|title" |
19047
1288a2f27769
Handle non "points" fontunits properties (bug # 40158)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19044
diff
changeset
|
4579 // hidden property for text rendering |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
4580 double_property __fontsize_points__ hgr , 0 |
6874 | 4581 END_PROPERTIES |
4582 | |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4583 Matrix get_data_position (void) const; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
11394
diff
changeset
|
4584 Matrix get_extent_matrix (void) const; |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
11394
diff
changeset
|
4585 const uint8NDArray& get_pixels (void) const { return pixels; } |
21209
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
4586 |
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
4587 // Text renderer, used for calculation of text size |
22326
71dd9d5a5ecd
move more new classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
4588 octave::text_renderer txt_renderer; |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4589 |
7363 | 4590 protected: |
4591 void init (void) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4592 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4593 position.add_constraint (dim_vector (1, 3)); |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4594 fontsize.add_constraint ("min", 0.0, false); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4595 linewidth.add_constraint ("min", 0.0, false); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4596 margin.add_constraint ("min", 0.0, false); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4597 cached_units = get_units (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4598 update_font (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4599 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4600 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4601 private: |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4602 void update_position (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4603 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4604 Matrix pos = get_data_position (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4605 Matrix lim; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4606 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4607 lim = Matrix (1, 3, pos(0)); |
21723
bae585228161
use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents:
21721
diff
changeset
|
4608 lim(2) = (lim(2) <= 0 ? octave::numeric_limits<double>::Inf () : lim(2)); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4609 set_xlim (lim); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4610 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4611 lim = Matrix (1, 3, pos(1)); |
21723
bae585228161
use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents:
21721
diff
changeset
|
4612 lim(2) = (lim(2) <= 0 ? octave::numeric_limits<double>::Inf () : lim(2)); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4613 set_ylim (lim); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4614 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4615 if (pos.numel () == 3) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4616 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4617 lim = Matrix (1, 3, pos(2)); |
21723
bae585228161
use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents:
21721
diff
changeset
|
4618 lim(2) = (lim(2) <= 0 ? octave::numeric_limits<double>::Inf () : lim(2)); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4619 set_zliminclude ("on"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4620 set_zlim (lim); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4621 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4622 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4623 set_zliminclude ("off"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4624 } |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4625 |
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4626 void update_text_extent (void); |
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4627 |
12389
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4628 void request_autopos (void); |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4629 void update_positionmode (void) { request_autopos (); } |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4630 void update_rotationmode (void) { request_autopos (); } |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4631 void update_horizontalalignmentmode (void) { request_autopos (); } |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4632 void update_verticalalignmentmode (void) { request_autopos (); } |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4633 |
12777
6c1d0f03c331
Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents:
12685
diff
changeset
|
4634 void update_font (void); |
12440
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4635 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
|
4636 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
|
4637 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
|
4638 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
|
4639 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
|
4640 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
|
4641 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
|
4642 void update_interpreter (void) { update_text_extent (); } |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
11394
diff
changeset
|
4643 void update_horizontalalignment (void) { update_text_extent (); } |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
11394
diff
changeset
|
4644 void update_verticalalignment (void) { update_text_extent (); } |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4645 |
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4646 void update_units (void); |
19047
1288a2f27769
Handle non "points" fontunits properties (bug # 40158)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19044
diff
changeset
|
4647 void update_fontunits (const caseless_str& old_fontunits); |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4648 |
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4649 private: |
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4650 std::string cached_units; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
11394
diff
changeset
|
4651 uint8NDArray pixels; |
6874 | 4652 }; |
4653 | |
4654 private: | |
4655 properties xproperties; | |
4656 | |
4657 public: | |
4658 text (const graphics_handle& mh, const graphics_handle& p) | |
4659 : base_graphics_object (), xproperties (mh, p) | |
4660 { | |
12433
02669a1aa070
regexp.cc: avoid deprecated Array<T>:resize function
John W. Eaton <jwe@octave.org>
parents:
12389
diff
changeset
|
4661 xproperties.set_clipping ("off"); |
6874 | 4662 } |
4663 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
4664 ~text (void) = default; |
6874 | 4665 |
4666 base_properties& get_properties (void) { return xproperties; } | |
4667 | |
7222 | 4668 const base_properties& get_properties (void) const { return xproperties; } |
4669 | |
6874 | 4670 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
|
4671 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4672 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
|
4673 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4674 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
|
4675 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
|
4676 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
|
4677 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
|
4678 } |
6874 | 4679 }; |
4680 | |
4681 // --------------------------------------------------------------------- | |
4682 | |
7365 | 4683 class OCTINTERP_API image : public base_graphics_object |
6874 | 4684 { |
4685 public: | |
7821
f79dcba526a8
Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7527
diff
changeset
|
4686 class OCTINTERP_API properties : public base_properties |
6874 | 4687 { |
4688 public: | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4689 bool is_aliminclude (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4690 { 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
|
4691 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
|
4692 { return aliminclude.current_value (); } |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4693 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4694 bool is_climinclude (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4695 { 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
|
4696 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
|
4697 { 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
|
4698 |
9680
73153525df9a
initial implementation of OpenGL image rendering
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9620
diff
changeset
|
4699 octave_value get_color_data (void) const; |
73153525df9a
initial implementation of OpenGL image rendering
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9620
diff
changeset
|
4700 |
19324
68db8396c378
Make "image ()" use the default image cdata
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19087
diff
changeset
|
4701 void initialize_data (void) { update_cdata (); } |
68db8396c378
Make "image ()" use the default image cdata
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19087
diff
changeset
|
4702 |
6874 | 4703 // See the genprops.awk script for an explanation of the |
4704 // properties declarations. | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4705 // Programming note: Keep property list sorted if new ones are added. |
6874 | 4706 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
4707 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
|
4708 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
|
4709 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
|
4710 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
|
4711 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
|
4712 string_property displayname , "" |
21905
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
4713 radio_property erasemode h , "{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
|
4714 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
|
4715 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
|
4716 // hidden properties for limit computation |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4717 row_vector_property alim hlr , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4718 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
|
4719 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
|
4720 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
|
4721 bool_property aliminclude hlg , "on" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4722 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
|
4723 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
|
4724 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
|
4725 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
|
4726 radio_property ydatamode ha , "{auto}|manual" |
6874 | 4727 END_PROPERTIES |
4728 | |
7363 | 4729 protected: |
4730 void init (void) | |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4731 { |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4732 xdata.add_constraint (2); |
20273
b8c1b3e9aa91
Fix segfault when '[]' used for row_vector_property.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
4733 xdata.add_constraint (dim_vector (0, 0)); |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4734 ydata.add_constraint (2); |
20273
b8c1b3e9aa91
Fix segfault when '[]' used for row_vector_property.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
4735 ydata.add_constraint (dim_vector (0, 0)); |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4736 cdata.add_constraint ("double"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4737 cdata.add_constraint ("single"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4738 cdata.add_constraint ("logical"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4739 cdata.add_constraint ("uint8"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4740 cdata.add_constraint ("uint16"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4741 cdata.add_constraint ("int16"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4742 cdata.add_constraint ("real"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4743 cdata.add_constraint (dim_vector (-1, -1)); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4744 cdata.add_constraint (dim_vector (-1, -1, 3)); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4745 alphadata.add_constraint (dim_vector (-1, -1)); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4746 alphadata.add_constraint ("double"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4747 alphadata.add_constraint ("uint8"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4748 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4749 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4750 private: |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4751 void update_alphadata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4752 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4753 if (alphadatamapping_is ("scaled")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4754 set_alim (alphadata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4755 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4756 alim = alphadata.get_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4757 } |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4758 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4759 void update_cdata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4760 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4761 if (cdatamapping_is ("scaled")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4762 set_clim (cdata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4763 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4764 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
|
4765 |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4766 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
|
4767 update_xdata (); |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4768 |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4769 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
|
4770 update_ydata (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4771 } |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4772 |
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 void update_xdata (void) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4774 { |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4775 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
|
4776 set_xdatamode ("auto"); |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4777 |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4778 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
|
4779 { |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4780 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
|
4781 set_xdatamode ("auto"); |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4782 } |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4783 |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4784 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
|
4785 float dp = pixel_xsize (); |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4786 |
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4787 limits(0) = limits(0) - dp; |
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4788 limits(1) = limits(1) + dp; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4789 set_xlim (limits); |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4790 } |
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4791 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4792 void update_ydata (void) |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4793 { |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4794 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
|
4795 set_ydatamode ("auto"); |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4796 |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4797 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
|
4798 { |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4799 set_ydata (get_auto_ydata ()); |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4800 set_ydatamode ("auto"); |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4801 } |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4802 |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4803 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
|
4804 float dp = pixel_ysize (); |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4805 |
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4806 limits(0) = limits(0) - dp; |
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4807 limits(1) = limits(1) + dp; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4808 set_ylim (limits); |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4809 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4810 |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4811 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
|
4812 { |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4813 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
|
4814 Matrix data; |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4815 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
|
4816 { |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4817 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
|
4818 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
|
4819 } |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4820 return data; |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4821 } |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4822 |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4823 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
|
4824 { |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4825 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
|
4826 Matrix data; |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4827 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
|
4828 { |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4829 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
|
4830 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
|
4831 } |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4832 return data; |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4833 } |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4834 |
11076
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4835 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
|
4836 { |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4837 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
|
4838 float dp; |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4839 |
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
|
4840 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
|
4841 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
|
4842 else |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4843 { |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4844 if (limits(1) == limits(2)) |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4845 dp = 0.5; |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4846 else |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4847 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
|
4848 } |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4849 return dp; |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4850 } |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4851 |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4852 public: |
21562
6c2fd62db1f7
maint: Eliminate accidental double spaces in code.
Rik <rik@octave.org>
parents:
21367
diff
changeset
|
4853 float pixel_xsize (void) |
11076
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4854 { |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4855 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
|
4856 } |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4857 |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4858 float pixel_ysize (void) |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4859 { |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4860 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
|
4861 } |
6874 | 4862 }; |
4863 | |
4864 private: | |
4865 properties xproperties; | |
4866 | |
4867 public: | |
4868 image (const graphics_handle& mh, const graphics_handle& p) | |
4869 : base_graphics_object (), xproperties (mh, p) | |
4870 { | |
19324
68db8396c378
Make "image ()" use the default image cdata
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19087
diff
changeset
|
4871 xproperties.initialize_data (); |
6874 | 4872 } |
4873 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
4874 ~image (void) = default; |
6874 | 4875 |
4876 base_properties& get_properties (void) { return xproperties; } | |
4877 | |
7222 | 4878 const base_properties& get_properties (void) const { return xproperties; } |
4879 | |
6874 | 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 | 4889 }; |
4890 | |
4891 // --------------------------------------------------------------------- | |
4892 | |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4893 class OCTINTERP_API light : public base_graphics_object |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4894 { |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4895 public: |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4896 class OCTINTERP_API properties : public base_properties |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4897 { |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4898 // See the genprops.awk script for an explanation of the |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4899 // properties declarations. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4900 // Programming note: Keep property list sorted if new ones are added. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4901 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4902 BEGIN_PROPERTIES (light) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4903 color_property color , color_values (1, 1, 1) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4904 array_property position , default_light_position () |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4905 radio_property style , "{infinite}|local" |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4906 END_PROPERTIES |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4907 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4908 protected: |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4909 void init (void) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4910 { |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4911 position.add_constraint (dim_vector (1, 3)); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4912 } |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4913 }; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4914 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4915 private: |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4916 properties xproperties; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4917 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4918 public: |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4919 light (const graphics_handle& mh, const graphics_handle& p) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4920 : base_graphics_object (), xproperties (mh, p) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4921 { } |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4922 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
4923 ~light (void) = default; |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4924 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4925 base_properties& get_properties (void) { return xproperties; } |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4926 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4927 const base_properties& get_properties (void) const { return xproperties; } |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4928 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4929 bool valid_object (void) const { return true; } |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4930 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4931 bool has_readonly_property (const caseless_str& pname) const |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4932 { |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4933 bool retval = xproperties.has_readonly_property (pname); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4934 if (! retval) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4935 retval = base_properties::has_readonly_property (pname); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4936 return retval; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4937 } |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4938 }; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4939 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4940 // --------------------------------------------------------------------- |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4941 |
7365 | 4942 class OCTINTERP_API patch : public base_graphics_object |
6874 | 4943 { |
4944 public: | |
7821
f79dcba526a8
Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7527
diff
changeset
|
4945 class OCTINTERP_API properties : public base_properties |
6874 | 4946 { |
4947 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
|
4948 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
|
4949 |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4950 // Matlab allows incoherent data to be stored into patch properties. |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4951 // The patch should then be ignored by the renderer. |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4952 bool has_bad_data (std::string &msg) const |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4953 { |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4954 msg = bad_data_msg; |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4955 return ! msg.empty (); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4956 } |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4957 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4958 bool is_aliminclude (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4959 { 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
|
4960 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
|
4961 { 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
|
4962 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4963 bool is_climinclude (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4964 { 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
|
4965 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
|
4966 { return climinclude.current_value (); } |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4967 |
6874 | 4968 // See the genprops.awk script for an explanation of the |
4969 // properties declarations. | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4970 // Programming note: Keep property list sorted if new ones are added. |
6874 | 4971 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
4972 BEGIN_PROPERTIES (patch) |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4973 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
|
4974 double_property ambientstrength , 0.3 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4975 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
|
4976 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
|
4977 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
|
4978 double_property diffusestrength , 0.6 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4979 string_property displayname , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4980 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
|
4981 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
|
4982 radio_property edgelighting , "{none}|flat|gouraud|phong" |
21905
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
4983 radio_property erasemode h , "{normal}|none|xor|background" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4984 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
|
4985 color_property facecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4986 radio_property facelighting , "none|{flat}|gouraud|phong" |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
4987 array_property facenormals m , Matrix () |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
4988 radio_property facenormalsmode , "{auto}|manual" |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4989 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
|
4990 array_property facevertexalphadata , Matrix () |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4991 array_property facevertexcdata u , Matrix () |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4992 // 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
|
4993 // 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
|
4994 radio_property interpreter , "{tex}|none|latex" |
7363 | 4995 radio_property linestyle , "{-}|--|:|-.|none" |
4996 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
|
4997 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
|
4998 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
|
4999 color_property markerfacecolor , color_property (radio_values ("{none}|auto|flat"), color_values (0, 0, 0)) |
7363 | 5000 double_property markersize , 6 |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5001 radio_property normalmode hsg , "{auto}|manual" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5002 double_property specularcolorreflectance , 1.0 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5003 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
|
5004 double_property specularstrength , 0.9 |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5005 array_property vertexnormals m , Matrix () |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5006 radio_property vertexnormalsmode , "{auto}|manual" |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5007 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
|
5008 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
|
5009 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
|
5010 array_property zdata u , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
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 // hidden properties for limit computation |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5013 row_vector_property alim hlr , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5014 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
|
5015 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
|
5016 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
|
5017 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
|
5018 bool_property aliminclude hlg , "on" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5019 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
|
5020 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
|
5021 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
|
5022 bool_property zliminclude hl , "on" |
6874 | 5023 END_PROPERTIES |
5024 | |
7363 | 5025 protected: |
5026 void init (void) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5027 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5028 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
|
5029 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
|
5030 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
|
5031 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
|
5032 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
|
5033 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
|
5034 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
|
5035 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
|
5036 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
|
5037 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
|
5038 facevertexalphadata.add_constraint (dim_vector (-1, 1)); |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5039 facenormals.add_constraint (dim_vector (-1, 3)); |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5040 facenormals.add_constraint (dim_vector (0, 0)); |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5041 vertexnormals.add_constraint (dim_vector (-1, 3)); |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5042 vertexnormals.add_constraint (dim_vector (0, 0)); |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5043 |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5044 ambientstrength.add_constraint ("min", 0.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5045 ambientstrength.add_constraint ("max", 1.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5046 diffusestrength.add_constraint ("min", 0.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5047 diffusestrength.add_constraint ("max", 1.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5048 linewidth.add_constraint ("min", 0.0, false); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5049 markersize.add_constraint ("min", 0.0, false); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5050 specularcolorreflectance.add_constraint ("min", 0.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5051 specularcolorreflectance.add_constraint ("max", 1.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5052 specularexponent.add_constraint ("min", 0.0, false); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5053 specularstrength.add_constraint ("min", 0.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5054 specularstrength.add_constraint ("max", 1.0, true); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5055 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5056 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5057 private: |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5058 std::string bad_data_msg; |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5059 |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5060 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
|
5061 |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5062 void update_vertices (void) { update_data ();} |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5063 |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5064 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
|
5065 |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5066 void update_fvc (void); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5067 |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
5068 void update_xdata (void) |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
5069 { |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5070 if (get_xdata ().is_empty ()) |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5071 { |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
5072 // For compatibility with matlab behavior, |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
5073 // if x/ydata are set empty, silently empty other *data and |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
5074 // faces properties while vertices remain unchanged. |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5075 set_ydata (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5076 set_zdata (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5077 set_cdata (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5078 set_faces (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5079 } |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5080 else |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5081 update_fvc (); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5082 |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5083 set_xlim (xdata.get_limits ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5084 } |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5085 |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
5086 void update_ydata (void) |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
5087 { |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5088 if (get_ydata ().is_empty ()) |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5089 { |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5090 set_xdata (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5091 set_zdata (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5092 set_cdata (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5093 set_faces (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5094 } |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5095 else |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5096 update_fvc (); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5097 |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5098 set_ylim (ydata.get_limits ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5099 } |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5100 |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
5101 void update_zdata (void) |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
5102 { |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5103 update_fvc (); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5104 set_zlim (zdata.get_limits ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5105 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
5106 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5107 void update_cdata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5108 { |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5109 update_fvc (); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5110 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5111 if (cdatamapping_is ("scaled")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5112 set_clim (cdata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5113 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5114 clim = cdata.get_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5115 } |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5116 |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5117 void update_data (void); |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5118 |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5119 void set_normalmode (const octave_value& val) |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5120 { |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5121 warning_with_id ("Octave:deprecated-property", |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5122 "patch: Property 'normalmode' is deprecated and will be removed " |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21723
diff
changeset
|
5123 "from a future version of Octave. Use 'vertexnormalsmode' instead."); |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5124 set_vertexnormalsmode (val); |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5125 } |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5126 |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5127 std::string get_normalmode (void) const |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5128 { |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5129 warning_with_id ("Octave:deprecated-property", |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5130 "patch: Property 'normalmode' is deprecated and will be removed " |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21723
diff
changeset
|
5131 "from a future version of Octave. Use 'vertexnormalsmode' instead."); |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5132 return vertexnormalsmode.current_value (); |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5133 } |
6874 | 5134 }; |
5135 | |
5136 private: | |
5137 properties xproperties; | |
5138 | |
5139 public: | |
5140 patch (const graphics_handle& mh, const graphics_handle& p) | |
5141 : base_graphics_object (), xproperties (mh, p) | |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
5142 { } |
6874 | 5143 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5144 ~patch (void) = default; |
6874 | 5145 |
5146 base_properties& get_properties (void) { return xproperties; } | |
5147 | |
7222 | 5148 const base_properties& get_properties (void) const { return xproperties; } |
5149 | |
6874 | 5150 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
|
5151 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5152 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
|
5153 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5154 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
|
5155 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
|
5156 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
|
5157 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
|
5158 } |
6874 | 5159 }; |
5160 | |
5161 // --------------------------------------------------------------------- | |
5162 | |
7365 | 5163 class OCTINTERP_API surface : public base_graphics_object |
6874 | 5164 { |
5165 public: | |
7821
f79dcba526a8
Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7527
diff
changeset
|
5166 class OCTINTERP_API properties : public base_properties |
6874 | 5167 { |
5168 public: | |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5169 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
|
5170 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5171 bool is_aliminclude (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5172 { 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
|
5173 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
|
5174 { 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
|
5175 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5176 bool is_climinclude (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5177 { 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
|
5178 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
|
5179 { return climinclude.current_value (); } |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5180 |
6874 | 5181 // See the genprops.awk script for an explanation of the |
5182 // properties declarations. | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5183 // Programming note: Keep property list sorted if new ones are added. |
6874 | 5184 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
5185 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
|
5186 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
|
5187 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
|
5188 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
|
5189 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
|
5190 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
|
5191 radio_property cdatamapping al , "{scaled}|direct" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5192 string_property cdatasource , "" |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5193 double_property diffusestrength , 0.6 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5194 string_property displayname , "" |
7846
d7737a4268b7
Fix typos in property names (edgealpha/facealpha).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7844
diff
changeset
|
5195 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
|
5196 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
|
5197 radio_property edgelighting , "{none}|flat|gouraud|phong" |
21905
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
5198 radio_property erasemode h , "{normal}|none|xor|background" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5199 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
|
5200 color_property facecolor , color_property (radio_values ("none|{flat}|interp|texturemap"), color_values (0, 0, 0)) |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
5201 radio_property facelighting , "none|{flat}|gouraud|phong" |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5202 array_property facenormals m , Matrix () |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5203 radio_property facenormalsmode , "{auto}|manual" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5204 // 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
|
5205 // 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
|
5206 radio_property interpreter , "{tex}|none|latex" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5207 radio_property linestyle , "{-}|--|:|-.|none" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5208 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
|
5209 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
|
5210 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
|
5211 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
|
5212 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
|
5213 radio_property meshstyle , "{both}|row|column" |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5214 radio_property normalmode hsg , "{auto}|manual" |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5215 double_property specularcolorreflectance , 1 |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5216 double_property specularexponent , 10 |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5217 double_property specularstrength , 0.9 |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5218 array_property vertexnormals m , Matrix () |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5219 radio_property vertexnormalsmode u , "{auto}|manual" |
18646
2deed6538c72
Make some graphics factory defaults conform to Matlab values (bug #41770).
pantxo <pantxo.diribarne@gmail.com>
parents:
18645
diff
changeset
|
5220 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
|
5221 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
|
5222 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
|
5223 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
|
5224 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
|
5225 string_property zdatasource , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5226 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5227 // hidden properties for limit computation |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5228 row_vector_property alim hlr , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5229 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
|
5230 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
|
5231 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
|
5232 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
|
5233 bool_property aliminclude hlg , "on" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5234 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
|
5235 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
|
5236 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
|
5237 bool_property zliminclude hl , "on" |
6874 | 5238 END_PROPERTIES |
5239 | |
7363 | 5240 protected: |
5241 void init (void) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5242 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5243 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
|
5244 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
|
5245 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
|
5246 cdata.add_constraint ("double"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5247 cdata.add_constraint ("single"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5248 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
|
5249 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
|
5250 alphadata.add_constraint ("double"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5251 alphadata.add_constraint ("uint8"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5252 alphadata.add_constraint (dim_vector (-1, -1)); |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5253 facenormals.add_constraint (dim_vector (-1, -1, 3)); |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5254 facenormals.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
|
5255 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
|
5256 vertexnormals.add_constraint (dim_vector (0, 0)); |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5257 |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5258 ambientstrength.add_constraint ("min", 0.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5259 ambientstrength.add_constraint ("max", 1.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5260 diffusestrength.add_constraint ("min", 0.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5261 diffusestrength.add_constraint ("max", 1.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5262 linewidth.add_constraint ("min", 0.0, false); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5263 markersize.add_constraint ("min", 0.0, false); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5264 specularcolorreflectance.add_constraint ("min", 0.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5265 specularcolorreflectance.add_constraint ("max", 1.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5266 specularexponent.add_constraint ("min", 0.0, false); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5267 specularstrength.add_constraint ("min", 0.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5268 specularstrength.add_constraint ("max", 1.0, true); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5269 } |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5270 |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5271 private: |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5272 void update_alphadata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5273 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5274 if (alphadatamapping_is ("scaled")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5275 set_alim (alphadata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5276 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5277 alim = alphadata.get_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5278 } |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5279 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5280 void update_cdata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5281 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5282 if (cdatamapping_is ("scaled")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5283 set_clim (cdata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5284 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5285 clim = cdata.get_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5286 } |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5287 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5288 void update_xdata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5289 { |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5290 update_vertex_normals (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5291 set_xlim (xdata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5292 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
5293 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5294 void update_ydata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5295 { |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5296 update_vertex_normals (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5297 set_ylim (ydata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5298 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5299 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5300 void update_zdata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5301 { |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5302 update_vertex_normals (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5303 set_zlim (zdata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5304 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5305 |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5306 void update_vertex_normals (void); |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5307 |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5308 void update_vertexnormalsmode (void) |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5309 { update_vertex_normals (); } |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5310 |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5311 void set_normalmode (const octave_value& val) |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5312 { |
21659
ff2347e1df02
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21654
diff
changeset
|
5313 warning_with_id ("Octave:deprecated-property", |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5314 "surface: Property 'normalmode' is deprecated and will be removed " |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21723
diff
changeset
|
5315 "from a future version of Octave. Use 'vertexnormalsmode' instead."); |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5316 set_vertexnormalsmode (val); |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5317 } |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5318 |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5319 std::string get_normalmode (void) const |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5320 { |
21659
ff2347e1df02
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21654
diff
changeset
|
5321 warning_with_id ("Octave:deprecated-property", |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5322 "surface: Property 'normalmode' is deprecated and will be removed " |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21723
diff
changeset
|
5323 "from a future version of Octave. Use 'vertexnormalsmode' instead."); |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5324 return vertexnormalsmode.current_value (); |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5325 } |
6874 | 5326 }; |
5327 | |
5328 private: | |
5329 properties xproperties; | |
5330 | |
5331 public: | |
5332 surface (const graphics_handle& mh, const graphics_handle& p) | |
5333 : base_graphics_object (), xproperties (mh, p) | |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
5334 { } |
6874 | 5335 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5336 ~surface (void) = default; |
6874 | 5337 |
5338 base_properties& get_properties (void) { return xproperties; } | |
5339 | |
7222 | 5340 const base_properties& get_properties (void) const { return xproperties; } |
5341 | |
6874 | 5342 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
|
5343 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5344 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
|
5345 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5346 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
|
5347 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
|
5348 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
|
5349 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
|
5350 } |
6874 | 5351 }; |
5352 | |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5353 // --------------------------------------------------------------------- |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5354 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5355 class OCTINTERP_API hggroup : public base_graphics_object |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5356 { |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5357 public: |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5358 class OCTINTERP_API properties : public base_properties |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5359 { |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5360 public: |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5361 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
|
5362 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5363 base_properties::remove_child (h); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5364 update_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5365 } |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5366 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5367 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
|
5368 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5369 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5370 base_properties::adopt (h); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5371 update_limits (h); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5372 } |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5373 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5374 // 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
|
5375 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5376 // 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
|
5377 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
5378 BEGIN_PROPERTIES (hggroup) |
15519
f915996325b7
Add missing DisplayName and EraseMode properties to hggroups (bug #37442)
Ben Abbott <bpabbott@mac.com>
parents:
15468
diff
changeset
|
5379 string_property displayname , "" |
21905
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
5380 radio_property erasemode h , "{normal}|none|xor|background" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5381 |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5382 // hidden properties for limit computation |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5383 row_vector_property alim hr , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5384 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
|
5385 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
|
5386 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
|
5387 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
|
5388 bool_property aliminclude h , "on" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5389 bool_property climinclude h , "on" |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5390 bool_property xliminclude h , "on" |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5391 bool_property yliminclude h , "on" |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5392 bool_property zliminclude h , "on" |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5393 END_PROPERTIES |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5394 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5395 private: |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5396 void update_limits (void) const; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5397 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5398 void update_limits (const graphics_handle& h) const; |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5399 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5400 protected: |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5401 void init (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5402 { } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
5403 |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5404 }; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5405 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5406 private: |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5407 properties xproperties; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5408 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5409 public: |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5410 hggroup (const graphics_handle& mh, const graphics_handle& p) |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5411 : base_graphics_object (), xproperties (mh, p) |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
5412 { } |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5413 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5414 ~hggroup (void) = default; |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5415 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5416 base_properties& get_properties (void) { return xproperties; } |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5417 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5418 const base_properties& get_properties (void) const { return xproperties; } |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5419 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5420 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
|
5421 |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5422 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
|
5423 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
5424 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
|
5425 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
|
5426 |
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
|
5427 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
|
5428 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5429 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
|
5430 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
|
5431 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
|
5432 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
|
5433 } |
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 |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5435 }; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5436 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5437 // --------------------------------------------------------------------- |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5438 |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5439 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
|
5440 { |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5441 public: |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5442 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
|
5443 { |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5444 public: |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5445 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
|
5446 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5447 base_properties::remove_child (h); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5448 } |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5449 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5450 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
|
5451 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5452 base_properties::adopt (h); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5453 } |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5454 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5455 // 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
|
5456 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5457 // 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
|
5458 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5459 BEGIN_PROPERTIES (uimenu) |
20593
3af34e1ef330
Preliminary inclusion of uixx objects properties in the manual (bug #46076)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20545
diff
changeset
|
5460 any_property __object__ h , Matrix () |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5461 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
|
5462 callback_property callback , Matrix () |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5463 bool_property checked , "off" |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5464 bool_property enable , "on" |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5465 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
|
5466 string_property label , "" |
20045
ae12edf69bce
Set default uimenu position property to 0 (Bug #44770)
John Donoghue
parents:
19987
diff
changeset
|
5467 double_property position , 0 |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5468 bool_property separator , "off" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5469 // Octave-specific properties |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
5470 string_property __fltk_label__ h , "" |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5471 END_PROPERTIES |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5472 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5473 protected: |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5474 void init (void) |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5475 { |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5476 position.add_constraint ("min", 0, false); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5477 } |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5478 }; |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5479 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5480 private: |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5481 properties xproperties; |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5482 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5483 public: |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5484 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
|
5485 : base_graphics_object (), xproperties (mh, p) |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
5486 { } |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5487 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5488 ~uimenu (void) = default; |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5489 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5490 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
|
5491 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5492 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
|
5493 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5494 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
|
5495 |
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
|
5496 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
|
5497 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5498 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
|
5499 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
|
5500 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
|
5501 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
|
5502 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5503 |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5504 }; |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5505 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5506 // --------------------------------------------------------------------- |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5507 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5508 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
|
5509 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5510 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5511 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
|
5512 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5513 public: |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20171
diff
changeset
|
5514 |
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20171
diff
changeset
|
5515 void add_dependent_obj (graphics_handle gh) |
20077
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5516 { dependent_obj_list.push_back (gh); } |
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5517 |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20171
diff
changeset
|
5518 // FIXME: the list may contain duplicates. |
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20171
diff
changeset
|
5519 // Should we return only unique elements? |
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20171
diff
changeset
|
5520 const std::list<graphics_handle> get_dependent_obj_list (void) |
20077
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5521 { return dependent_obj_list; } |
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5522 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5523 // 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
|
5524 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5525 // 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
|
5526 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5527 BEGIN_PROPERTIES (uicontextmenu) |
20593
3af34e1ef330
Preliminary inclusion of uixx objects properties in the manual (bug #46076)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20545
diff
changeset
|
5528 any_property __object__ h , 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
|
5529 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
|
5530 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
|
5531 END_PROPERTIES |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5532 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5533 protected: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5534 void init (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5535 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5536 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
|
5537 position.add_constraint (dim_vector (2, 1)); |
20171
b70f8da6dcd3
Default uicontextmenu visible to 'off' (Bug #44939)
John Donoghue
parents:
20077
diff
changeset
|
5538 visible.set (octave_value (false)); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5539 } |
20077
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5540 |
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5541 private: |
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5542 // List of objects that might depend on this uicontextmenu object |
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5543 std::list<graphics_handle> dependent_obj_list; |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5544 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5545 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5546 private: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5547 properties xproperties; |
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 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5550 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
|
5551 : base_graphics_object (), xproperties (mh, p) |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
5552 { } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5553 |
20077
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5554 ~uicontextmenu (void); |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5555 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5556 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
|
5557 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5558 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
|
5559 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5560 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
|
5561 |
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
|
5562 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
|
5563 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5564 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
|
5565 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
|
5566 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
|
5567 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
|
5568 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5569 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5570 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5571 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5572 // --------------------------------------------------------------------- |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5573 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5574 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
|
5575 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5576 public: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5577 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
|
5578 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5579 public: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5580 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
|
5581 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
|
5582 |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
5583 double get___fontsize_points__ (double box_pix_height = 0) const; |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5584 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5585 // 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
|
5586 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5587 // 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
|
5588 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5589 BEGIN_PROPERTIES (uicontrol) |
20593
3af34e1ef330
Preliminary inclusion of uixx objects properties in the manual (bug #46076)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20545
diff
changeset
|
5590 any_property __object__ h , Matrix () |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5591 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
|
5592 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
|
5593 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
|
5594 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
|
5595 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
|
5596 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
|
5597 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
|
5598 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
|
5599 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
|
5600 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
|
5601 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
|
5602 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
|
5603 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
|
5604 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
|
5605 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
|
5606 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
|
5607 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
|
5608 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
|
5609 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
|
5610 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
|
5611 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
|
5612 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
|
5613 radio_property units u , "normalized|inches|centimeters|points|{pixels}|characters" |
22619
7adc5bbd840a
graphics: set uicontrol value default to 0 and handle special cases (Bug #48255)
John D
parents:
22407
diff
changeset
|
5614 row_vector_property value , Matrix (1, 1, 0.0) |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5615 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
|
5616 END_PROPERTIES |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5617 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5618 private: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5619 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
|
5620 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5621 protected: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5622 void init (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5623 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5624 cdata.add_constraint ("double"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5625 cdata.add_constraint ("single"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5626 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
|
5627 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
|
5628 sliderstep.add_constraint (dim_vector (1, 2)); |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5629 fontsize.add_constraint ("min", 0.0, false); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5630 cached_units = get_units (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5631 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5632 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5633 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
|
5634 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5635 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
|
5636 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
|
5637 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
|
5638 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
|
5639 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
|
5640 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
|
5641 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5642 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
|
5643 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5644 }; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5645 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5646 private: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5647 properties xproperties; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5648 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5649 public: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5650 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
|
5651 : base_graphics_object (), xproperties (mh, p) |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
5652 { } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5653 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5654 ~uicontrol (void) = default; |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5655 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5656 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
|
5657 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5658 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
|
5659 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5660 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
|
5661 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5662 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
|
5663 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5664 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
|
5665 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
|
5666 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
|
5667 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
|
5668 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5669 }; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5670 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5671 // --------------------------------------------------------------------- |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5672 |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5673 class OCTINTERP_API uibuttongroup : public base_graphics_object |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5674 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5675 public: |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5676 class OCTINTERP_API properties : public base_properties |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5677 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5678 public: |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5679 Matrix get_boundingbox (bool internal = false, |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5680 const Matrix& parent_pix_size = Matrix ()) const; |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5681 |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
5682 double get___fontsize_points__ (double box_pix_height = 0) const; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5683 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5684 // See the genprops.awk script for an explanation of the |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5685 // properties declarations. |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5686 // Programming note: Keep property list sorted if new ones are added. |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5687 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5688 BEGIN_PROPERTIES (uibuttongroup) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5689 any_property __object__ h , Matrix () |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5690 color_property backgroundcolor , color_values (1, 1, 1) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5691 radio_property bordertype , "none|{etchedin}|etchedout|beveledin|beveledout|line" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5692 double_property borderwidth , 1 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5693 bool_property clipping , "on" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5694 radio_property fontangle , "{normal}|italic|oblique" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5695 string_property fontname , OCTAVE_DEFAULT_FONTNAME |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5696 double_property fontsize , 10 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5697 radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5698 radio_property fontweight , "light|{normal}|demi|bold" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5699 color_property foregroundcolor , color_values (0, 0, 0) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5700 color_property highlightcolor , color_values (1, 1, 1) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5701 array_property position , default_panel_position () |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5702 callback_property resizefcn , Matrix () |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5703 handle_property selectedobject S , graphics_handle() |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5704 callback_property selectionchangedfcn , Matrix() |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5705 color_property shadowcolor , color_values (0, 0, 0) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5706 callback_property sizechangedfcn , Matrix () |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5707 radio_property units S , "{normalized}|inches|centimeters|points|pixels|characters" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5708 string_property title , "" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5709 radio_property titleposition , "{lefttop}|centertop|righttop|leftbottom|centerbottom|rightbottom" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5710 END_PROPERTIES |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5711 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5712 protected: |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5713 void init (void) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5714 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5715 position.add_constraint (dim_vector (1, 4)); |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5716 borderwidth.add_constraint ("min", 0.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5717 fontsize.add_constraint ("min", 0.0, false); |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5718 } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5719 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5720 // void update_text_extent (void); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5721 // void update_string (void) { update_text_extent (); } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5722 // void update_fontname (void) { update_text_extent (); } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5723 // void update_fontsize (void) { update_text_extent (); } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5724 // void update_fontangle (void) { update_text_extent (); } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5725 // void update_fontweight (void) { update_text_extent (); } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5726 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5727 void update_units (const caseless_str& old_units); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5728 void update_fontunits (const caseless_str& old_units); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5729 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5730 }; |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5731 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5732 private: |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5733 properties xproperties; |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5734 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5735 public: |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5736 uibuttongroup (const graphics_handle& mh, const graphics_handle& p) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5737 : base_graphics_object (), xproperties (mh, p) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5738 { } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5739 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5740 ~uibuttongroup (void) = default; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5741 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5742 base_properties& get_properties (void) { return xproperties; } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5743 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5744 const base_properties& get_properties (void) const { return xproperties; } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5745 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5746 bool valid_object (void) const { return true; } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5747 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5748 bool has_readonly_property (const caseless_str& pname) const |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5749 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5750 bool retval = xproperties.has_readonly_property (pname); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5751 if (! retval) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5752 retval = base_properties::has_readonly_property (pname); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5753 return retval; |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5754 } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5755 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5756 }; |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5757 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5758 // --------------------------------------------------------------------- |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5759 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5760 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
|
5761 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5762 public: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5763 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
|
5764 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5765 public: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5766 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
|
5767 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
|
5768 |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
5769 double get___fontsize_points__ (double box_pix_height = 0) const; |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5770 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5771 // 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
|
5772 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5773 // 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
|
5774 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5775 BEGIN_PROPERTIES (uipanel) |
20593
3af34e1ef330
Preliminary inclusion of uixx objects properties in the manual (bug #46076)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20545
diff
changeset
|
5776 any_property __object__ h , Matrix () |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5777 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
|
5778 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
|
5779 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
|
5780 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
|
5781 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
|
5782 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
|
5783 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
|
5784 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
|
5785 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
|
5786 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
|
5787 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
|
5788 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
|
5789 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
|
5790 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
|
5791 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
|
5792 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
|
5793 END_PROPERTIES |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5794 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5795 protected: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5796 void init (void) |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
5797 { |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5798 borderwidth.add_constraint ("min", 0.0, true); |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5799 fontsize.add_constraint ("min", 0.0, false); |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
5800 position.add_constraint (dim_vector (1, 4)); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
5801 } |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18819
diff
changeset
|
5802 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5803 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
|
5804 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
|
5805 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5806 }; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5807 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5808 private: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5809 properties xproperties; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5810 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5811 public: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5812 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
|
5813 : base_graphics_object (), xproperties (mh, p) |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
5814 { } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5815 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5816 ~uipanel (void) = default; |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5817 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5818 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
|
5819 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5820 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
|
5821 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5822 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
|
5823 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5824 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
|
5825 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5826 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
|
5827 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
|
5828 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
|
5829 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
|
5830 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5831 }; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5832 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5833 // --------------------------------------------------------------------- |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5834 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5835 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
|
5836 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5837 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5838 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
|
5839 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5840 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5841 // 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
|
5842 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5843 // 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
|
5844 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5845 BEGIN_PROPERTIES (uitoolbar) |
20593
3af34e1ef330
Preliminary inclusion of uixx objects properties in the manual (bug #46076)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20545
diff
changeset
|
5846 any_property __object__ h , Matrix () |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5847 END_PROPERTIES |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5848 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5849 protected: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5850 void init (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5851 { } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5852 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5853 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5854 private: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5855 properties xproperties; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5856 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5857 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5858 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
|
5859 : base_graphics_object (), xproperties (mh, p), default_properties () |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
5860 { } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5861 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5862 ~uitoolbar (void) = default; |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5863 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5864 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
|
5865 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5866 // 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
|
5867 // 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
|
5868 xproperties.override_defaults (obj); |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5869 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5870 // 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
|
5871 // 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
|
5872 // 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
|
5873 // 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
|
5874 // 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
|
5875 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
|
5876 } |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5877 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5878 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
|
5879 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5880 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
|
5881 // 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
|
5882 // 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
|
5883 // default_properties map. |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5884 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
|
5885 else |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5886 xproperties.set (name, value); |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5887 } |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5888 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5889 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
|
5890 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5891 octave_value retval; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5892 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5893 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
|
5894 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
|
5895 else |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5896 retval = xproperties.get (name); |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5897 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5898 return retval; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5899 } |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5900 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5901 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
|
5902 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5903 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
|
5904 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5905 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
|
5906 } |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5907 |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
5908 property_list get_defaults_list (void) const |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
5909 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
5910 return default_properties; |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
5911 } |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
5912 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5913 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
|
5914 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5915 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
|
5916 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5917 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
|
5918 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5919 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
|
5920 |
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
|
5921 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
|
5922 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5923 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
|
5924 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
|
5925 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
|
5926 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
|
5927 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5928 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5929 private: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5930 property_list default_properties; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5931 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5932 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5933 // --------------------------------------------------------------------- |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5934 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5935 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
|
5936 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5937 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5938 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
|
5939 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5940 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5941 // 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
|
5942 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5943 // 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
|
5944 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5945 BEGIN_PROPERTIES (uipushtool) |
20593
3af34e1ef330
Preliminary inclusion of uixx objects properties in the manual (bug #46076)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20545
diff
changeset
|
5946 any_property __object__ h , Matrix () |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5947 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
|
5948 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
|
5949 bool_property enable , "on" |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5950 bool_property separator , "off" |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5951 string_property tooltipstring , "" |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5952 END_PROPERTIES |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5953 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5954 protected: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5955 void init (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5956 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5957 cdata.add_constraint ("double"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5958 cdata.add_constraint ("single"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5959 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
|
5960 } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5961 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5962 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5963 private: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5964 properties xproperties; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5965 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5966 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5967 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
|
5968 : base_graphics_object (), xproperties (mh, p) |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
5969 { } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5970 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5971 ~uipushtool (void) = default; |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5972 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5973 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
|
5974 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5975 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
|
5976 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5977 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
|
5978 |
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
|
5979 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
|
5980 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5981 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
|
5982 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
|
5983 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
|
5984 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
|
5985 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5986 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5987 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5988 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5989 // --------------------------------------------------------------------- |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5990 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5991 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
|
5992 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5993 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5994 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
|
5995 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5996 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5997 // 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
|
5998 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5999 // 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
|
6000 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6001 BEGIN_PROPERTIES (uitoggletool) |
20593
3af34e1ef330
Preliminary inclusion of uixx objects properties in the manual (bug #46076)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20545
diff
changeset
|
6002 any_property __object__ h , Matrix () |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6003 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
|
6004 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
|
6005 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
|
6006 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
|
6007 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
|
6008 bool_property separator , "off" |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6009 bool_property state , "off" |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6010 string_property tooltipstring , "" |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6011 END_PROPERTIES |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6012 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6013 protected: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6014 void init (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6015 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6016 cdata.add_constraint ("double"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6017 cdata.add_constraint ("single"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6018 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
|
6019 } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6020 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6021 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6022 private: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6023 properties xproperties; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6024 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6025 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6026 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
|
6027 : base_graphics_object (), xproperties (mh, p) |
20051
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
6028 { } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6029 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
6030 ~uitoggletool (void) = default; |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6031 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6032 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
|
6033 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6034 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
|
6035 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6036 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
|
6037 |
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
|
6038 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
|
6039 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
6040 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
|
6041 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
|
6042 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
|
6043 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
|
6044 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
6045 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6046 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6047 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6048 // --------------------------------------------------------------------- |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6049 |
6874 | 6050 octave_value |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
6051 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
|
6052 const std::string& func); |
6874 | 6053 bool |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
6054 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
|
6055 const octave_value& arg, const std::string& func); |
6874 | 6056 |
6057 // --------------------------------------------------------------------- | |
6058 | |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6059 class graphics_event; |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6060 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6061 class |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6062 base_graphics_event |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6063 { |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6064 public: |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6065 friend class graphics_event; |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6066 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6067 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
|
6068 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
6069 virtual ~base_graphics_event (void) = default; |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6070 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6071 virtual void execute (void) = 0; |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6072 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6073 private: |
23012
27e4ec3b0b49
move octave_refcount inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23002
diff
changeset
|
6074 octave::refcount<int> count; |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6075 }; |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6076 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6077 class |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6078 graphics_event |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6079 { |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6080 public: |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6081 typedef void (*event_fcn) (void*); |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6082 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6083 graphics_event (void) : rep (0) { } |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6084 |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
6085 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
|
6086 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6087 rep->count++; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6088 } |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6089 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6090 ~graphics_event (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6091 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6092 if (rep && --rep->count == 0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6093 delete rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6094 } |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6095 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6096 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
|
6097 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6098 if (rep != e.rep) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6099 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6100 if (rep && --rep->count == 0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6101 delete rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6102 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6103 rep = e.rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6104 if (rep) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6105 rep->count++; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6106 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6107 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6108 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6109 } |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6110 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6111 void execute (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6112 { if (rep) rep->execute (); } |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6113 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6114 bool ok (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6115 { return (rep != 0); } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6116 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6117 static graphics_event |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6118 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
|
6119 const std::string& name, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6120 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
|
6121 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6122 static graphics_event |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6123 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
|
6124 const octave_value& cb, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6125 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
|
6126 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6127 static graphics_event |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6128 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
|
6129 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6130 static graphics_event |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6131 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
|
6132 const octave_value& value, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6133 bool notify_toolkit = true); |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6134 private: |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6135 base_graphics_event *rep; |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6136 }; |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6137 |
7365 | 6138 class OCTINTERP_API gh_manager |
6874 | 6139 { |
6140 protected: | |
6141 | |
6142 gh_manager (void); | |
6143 | |
6144 public: | |
6145 | |
13992
e1f76bfe0452
apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents:
13985
diff
changeset
|
6146 static void create_instance (void); |
e1f76bfe0452
apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents:
13985
diff
changeset
|
6147 |
6874 | 6148 static bool instance_ok (void) |
6149 { | |
6150 bool retval = true; | |
6151 | |
6152 if (! instance) | |
13992
e1f76bfe0452
apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents:
13985
diff
changeset
|
6153 create_instance (); |
6874 | 6154 |
6155 if (! instance) | |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
6156 error ("unable to create gh_manager!"); |
6874 | 6157 |
6158 return retval; | |
6159 } | |
6160 | |
13992
e1f76bfe0452
apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents:
13985
diff
changeset
|
6161 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
|
6162 |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6163 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
|
6164 { |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6165 return instance_ok () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6166 ? 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
|
6167 : graphics_handle (); |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6168 } |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6169 |
6874 | 6170 static void free (const graphics_handle& h) |
6171 { | |
6172 if (instance_ok ()) | |
6173 instance->do_free (h); | |
6174 } | |
6175 | |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6176 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
|
6177 const graphics_handle& new_gh) |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6178 { |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6179 if (instance_ok ()) |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6180 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
|
6181 } |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6182 |
6874 | 6183 static graphics_handle lookup (double val) |
6184 { | |
6185 return instance_ok () ? instance->do_lookup (val) : graphics_handle (); | |
6186 } | |
6187 | |
10265
8c583af2cf64
validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents:
10161
diff
changeset
|
6188 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
|
6189 { |
8c583af2cf64
validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents:
10161
diff
changeset
|
6190 return val.is_real_scalar () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6191 ? 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
|
6192 } |
8c583af2cf64
validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents:
10161
diff
changeset
|
6193 |
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
|
6194 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
|
6195 { |
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
|
6196 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
|
6197 } |
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
|
6198 |
6874 | 6199 static graphics_object get_object (const graphics_handle& h) |
6200 { | |
6201 return instance_ok () ? instance->do_get_object (h) : graphics_object (); | |
6202 } | |
6203 | |
6204 static graphics_handle | |
6205 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
|
6206 const graphics_handle& parent, |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6207 bool integer_figure_handle = false, |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6208 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
|
6209 bool do_notify_toolkit = true) |
6874 | 6210 { |
6211 return instance_ok () | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6212 ? 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
|
6213 integer_figure_handle, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6214 do_createfcn, do_notify_toolkit) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6215 : graphics_handle (); |
6874 | 6216 } |
6217 | |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6218 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
|
6219 bool do_notify_toolkit = true) |
6874 | 6220 { |
6221 return instance_ok () | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6222 ? 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
|
6223 : graphics_handle (); |
6874 | 6224 } |
6225 | |
6226 static void push_figure (const graphics_handle& h) | |
6227 { | |
6228 if (instance_ok ()) | |
6229 instance->do_push_figure (h); | |
6230 } | |
6231 | |
6232 static void pop_figure (const graphics_handle& h) | |
6233 { | |
6234 if (instance_ok ()) | |
6235 instance->do_pop_figure (h); | |
6236 } | |
6237 | |
6238 static graphics_handle current_figure (void) | |
6239 { | |
6240 return instance_ok () | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6241 ? instance->do_current_figure () : graphics_handle (); |
6874 | 6242 } |
6243 | |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6244 static Matrix handle_list (bool show_hidden = false) |
6874 | 6245 { |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6246 return instance_ok () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6247 ? instance->do_handle_list (show_hidden) : Matrix (); |
6874 | 6248 } |
6249 | |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6250 static void lock (void) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6251 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6252 if (instance_ok ()) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6253 instance->do_lock (); |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6254 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6255 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6256 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
|
6257 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6258 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
|
6259 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
|
6260 else |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6261 return false; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6262 } |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6263 |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6264 static void unlock (void) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6265 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6266 if (instance_ok ()) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6267 instance->do_unlock (); |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6268 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6269 |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6270 static Matrix figure_handle_list (bool show_hidden = false) |
6874 | 6271 { |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6272 return instance_ok () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6273 ? instance->do_figure_handle_list (show_hidden) : Matrix (); |
6874 | 6274 } |
6275 | |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6276 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
|
6277 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
|
6278 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6279 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
|
6280 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
|
6281 } |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6282 |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6283 static void execute_callback (const graphics_handle& h, |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
6284 const std::string& name, |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
6285 const octave_value& data = Matrix ()) |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6286 { |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6287 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
|
6288 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6289 if (true) |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6290 { |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6291 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
|
6292 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6293 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
|
6294 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6295 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
|
6296 cb = go.get (name); |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6297 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6298 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
6299 execute_callback (h, cb, data); |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6300 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6301 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6302 static void execute_callback (const graphics_handle& h, |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
6303 const octave_value& cb, |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
6304 const octave_value& data = Matrix ()) |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6305 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6306 if (instance_ok ()) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6307 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
|
6308 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6309 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6310 static void post_callback (const graphics_handle& h, |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
6311 const std::string& name, |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
6312 const octave_value& data = Matrix ()) |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6313 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6314 if (instance_ok ()) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6315 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
|
6316 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6317 |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6318 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
|
6319 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6320 if (instance_ok ()) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6321 instance->do_post_function (fcn, data); |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6322 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6323 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6324 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
|
6325 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
|
6326 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6327 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
|
6328 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
|
6329 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6330 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6331 static int process_events (void) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6332 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6333 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
|
6334 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6335 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6336 static int flush_events (void) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6337 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6338 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
|
6339 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6340 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6341 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
|
6342 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6343 if (instance_ok ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6344 instance->do_enable_event_processing (enable); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6345 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6346 |
8249 | 6347 static bool is_handle_visible (const graphics_handle& h) |
6348 { | |
6349 bool retval = false; | |
6350 | |
6351 graphics_object go = get_object (h); | |
6352 | |
6353 if (go.valid_object ()) | |
6354 retval = go.is_handle_visible (); | |
6355 | |
6356 return retval; | |
6357 } | |
6358 | |
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
|
6359 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
|
6360 { |
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
|
6361 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
|
6362 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
|
6363 } |
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
|
6364 |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6365 public: |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6366 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
|
6367 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6368 public: |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6369 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
|
6370 : 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
|
6371 ? 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
|
6372 : octave_mutex (), |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6373 wait) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6374 { } |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6375 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6376 // No copying! |
22865
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22831
diff
changeset
|
6377 |
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22831
diff
changeset
|
6378 auto_lock (const auto_lock&) = delete; |
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22831
diff
changeset
|
6379 |
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22831
diff
changeset
|
6380 auto_lock& operator = (const auto_lock&) = delete; |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6381 }; |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6382 |
6874 | 6383 private: |
6384 | |
6385 static gh_manager *instance; | |
6386 | |
6387 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
|
6388 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
|
6389 const_iterator; |
6874 | 6390 |
6391 typedef std::set<graphics_handle>::iterator free_list_iterator; | |
6392 typedef std::set<graphics_handle>::const_iterator const_free_list_iterator; | |
6393 | |
6394 typedef std::list<graphics_handle>::iterator figure_list_iterator; | |
6395 typedef std::list<graphics_handle>::const_iterator const_figure_list_iterator; | |
6396 | |
6397 // A map of handles to graphics objects. | |
6398 std::map<graphics_handle, graphics_object> handle_map; | |
6399 | |
6400 // The available graphics handles. | |
6401 std::set<graphics_handle> handle_free_list; | |
6402 | |
6403 // The next handle available if handle_free_list is empty. | |
7286 | 6404 double next_handle; |
6874 | 6405 |
6406 // The allocated figure handles. Top of the stack is most recently | |
6407 // created. | |
6408 std::list<graphics_handle> figure_list; | |
6409 | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
6410 // 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
|
6411 octave_mutex graphics_lock; |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6412 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
6413 // 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
|
6414 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
|
6415 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
6416 // The stack of callback objects. |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6417 std::list<graphics_object> callback_objects; |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6418 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6419 // 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
|
6420 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
|
6421 |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6422 graphics_handle do_get_handle (bool integer_figure_handle); |
6874 | 6423 |
6424 void do_free (const graphics_handle& h); | |
6425 | |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6426 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
|
6427 const graphics_handle& new_gh); |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6428 |
6874 | 6429 graphics_handle do_lookup (double val) |
6430 { | |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6431 iterator p = (octave::math::isnan (val) ? handle_map.end () |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6432 : handle_map.find (val)); |
6874 | 6433 |
6434 return (p != handle_map.end ()) ? p->first : graphics_handle (); | |
6435 } | |
6436 | |
6437 graphics_object do_get_object (const graphics_handle& h) | |
6438 { | |
7379 | 6439 iterator p = (h.ok () ? handle_map.find (h) : handle_map.end ()); |
6874 | 6440 |
6441 return (p != handle_map.end ()) ? p->second : graphics_object (); | |
6442 } | |
6443 | |
6444 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
|
6445 const graphics_handle& p, |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6446 bool integer_figure_handle, |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6447 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
|
6448 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
|
6449 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6450 graphics_handle do_make_figure_handle (double val, bool do_notify_toolkit); |
6874 | 6451 |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6452 Matrix do_handle_list (bool show_hidden) |
6874 | 6453 { |
6454 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
|
6455 |
6874 | 6456 octave_idx_type i = 0; |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6457 for (const auto& h_iter : handle_map) |
7056 | 6458 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6459 graphics_handle h = h_iter.first; |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6460 |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6461 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
|
6462 retval(i++) = h.value (); |
7056 | 6463 } |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6464 |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6465 retval.resize (1, i); |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6466 |
6874 | 6467 return retval; |
6468 } | |
6469 | |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6470 Matrix do_figure_handle_list (bool show_hidden) |
6874 | 6471 { |
6472 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
|
6473 |
6874 | 6474 octave_idx_type i = 0; |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6475 for (const auto& hfig : figure_list) |
7056 | 6476 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6477 if (show_hidden || is_handle_visible (hfig)) |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6478 retval(i++) = hfig.value (); |
7056 | 6479 } |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6480 |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6481 retval.resize (1, i); |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6482 |
6874 | 6483 return retval; |
6484 } | |
6485 | |
6486 void do_push_figure (const graphics_handle& h); | |
6487 | |
6488 void do_pop_figure (const graphics_handle& h); | |
6489 | |
6490 graphics_handle do_current_figure (void) const | |
6491 { | |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6492 graphics_handle retval; |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6493 |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6494 for (const auto& hfig : figure_list) |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6495 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6496 if (is_handle_visible (hfig)) |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6497 retval = hfig; |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6498 } |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6499 |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6500 return retval; |
6874 | 6501 } |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6502 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6503 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
|
6504 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6505 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
|
6506 |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6507 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
|
6508 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6509 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
|
6510 |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6511 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
|
6512 const octave_value& data); |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6513 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
6514 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
|
6515 const octave_value& data); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6516 |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6517 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
|
6518 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
6519 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
|
6520 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
|
6521 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6522 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
|
6523 |
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
|
6524 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
|
6525 |
9397
394c7adb488f
graphics.h.in (gh_manager::restore_gcbo): fix decl for unwind-protect
John W. Eaton <jwe@octave.org>
parents:
9347
diff
changeset
|
6526 static void restore_gcbo (void) |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6527 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6528 if (instance_ok ()) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6529 instance->do_restore_gcbo (); |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6530 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6531 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6532 void do_restore_gcbo (void); |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6533 |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6534 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
|
6535 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6536 void do_enable_event_processing (bool enable = true); |
6874 | 6537 }; |
6538 | |
13132
e3e8ca96f923
Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents:
12965
diff
changeset
|
6539 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
|
6540 double& min_pos, double& max_neg, |
9455 | 6541 const Matrix& kids, char limit_type); |
6874 | 6542 |
10917
888c75785221
Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents:
10792
diff
changeset
|
6543 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
|
6544 |
6874 | 6545 // This function is NOT equivalent to the scripting language function gcf. |
7365 | 6546 OCTINTERP_API graphics_handle gcf (void); |
6874 | 6547 |
6548 // This function is NOT equivalent to the scripting language function gca. | |
7365 | 6549 OCTINTERP_API graphics_handle gca (void); |
6874 | 6550 |
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
|
6551 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
|
6552 |
6874 | 6553 #endif |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22351
diff
changeset
|
6554 |