Mercurial > octave
annotate libinterp/corefcn/graphics.in.h @ 25960:ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
* graphics.in.h (base_graphics_event::m_busyaction,
base_graphics_event::get_busyaction): New data member and accessor method.
(base_graphics_event::priority) New enum for allowed values of m_busyaction,
INTERRUPT, QUEUE, CANCEL.
(graphics_event::create_callback_event): Add new busyaction argument that
defaults to base_graphics_event::QUEUE.
(graphics_event::get_busyaction): Accessor for base_graphics_event::busyaction.
* graphics.cc (gh_manager::do_post_callback): Post all events tagged according
to the "busyaction" of the callback object and the name of the callback.
(gh_manager::do_process_events): Triage callback execution here only.
(Fdrawnow): First call process_events and then redraw. Allow drawnow to be
called recursivelly.
(figure::properties::set_position): Use gh_manager::post_callback to schedule
the execution of the resizefcn.
(F__go_post_callback__): New internal interpreter function for testing purpose.
Add BIST that test busyaction,interruptible and resizefcn properties.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Wed, 22 Aug 2018 09:14:44 +0200 |
parents | 06c41d1ae5b1 |
children | d85049849e88 |
rev | line source |
---|---|
6874 | 1 /* |
2 | |
25054
6652d3823428
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
24991
diff
changeset
|
3 Copyright (C) 2007-2018 John W. Eaton |
6874 | 4 |
5 This file is part of Octave. | |
6 | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24523
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22723
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24523
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
22755
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 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24523
diff
changeset
|
19 <https://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> |
23639 | 29 #include <cmath> |
6874 | 30 |
31 #include <algorithm> | |
32 #include <list> | |
33 #include <map> | |
24252
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
34 #include <memory> |
6874 | 35 #include <set> |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
36 #include <sstream> |
6874 | 37 #include <string> |
38 | |
11075
4e31d44a9763
extract caseless_str class to separate header file
John W. Eaton <jwe@octave.org>
parents:
11074
diff
changeset
|
39 #include "caseless-str.h" |
9004
17ba311ef110
add one more missing include
Jaroslav Hajek <highegg@gmail.com>
parents:
8944
diff
changeset
|
40 |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21055
diff
changeset
|
41 #include "errwarn.h" |
23774
41795b504a8b
don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents:
23763
diff
changeset
|
42 #include "graphics-handle.h" |
41795b504a8b
don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents:
23763
diff
changeset
|
43 #include "graphics-toolkit.h" |
6874 | 44 #include "oct-map.h" |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
45 #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
|
46 #include "oct-refcount.h" |
6874 | 47 #include "ov.h" |
21209
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
48 #include "text-renderer.h" |
6874 | 49 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
50 // 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
|
51 // 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
|
52 // gnuplot users. |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
20785
diff
changeset
|
53 #if ! defined (OCTAVE_DEFAULT_FONTNAME) |
8944
cb0e9facc342
make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
54 #define OCTAVE_DEFAULT_FONTNAME "*" |
cb0e9facc342
make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
55 #endif |
cb0e9facc342
make default fontname * instead of Helvetica
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
56 |
6874 | 57 // --------------------------------------------------------------------- |
58 | |
7427 | 59 class base_scaler |
60 { | |
61 public: | |
62 base_scaler (void) { } | |
63 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
64 virtual ~base_scaler (void) = default; |
7440 | 65 |
20893
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
66 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
|
67 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
68 error ("invalid axis scale"); |
20893
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 |
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
71 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
|
72 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
73 error ("invalid axis scale"); |
20893
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 |
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
76 virtual double scale (double) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
77 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
78 error ("invalid axis scale"); |
20893
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 |
384ff5aa9437
2015 Code Sprint: Eliminate useless return statements after error ().
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
81 virtual double unscale (double) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
82 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
83 error ("invalid axis scale"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
84 } |
7427 | 85 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
86 virtual base_scaler * clone () const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
87 { 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
|
88 |
e06fdf7ea647
Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7830
diff
changeset
|
89 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
|
90 { return false; } |
7427 | 91 }; |
92 | |
93 class lin_scaler : public base_scaler | |
94 { | |
95 public: | |
96 lin_scaler (void) { } | |
97 | |
98 Matrix scale (const Matrix& m) const { return m; } | |
99 | |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
100 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
|
101 |
7427 | 102 double scale (double d) const { return d; } |
103 | |
104 double unscale (double d) const { return d; } | |
105 | |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
106 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
|
107 |
e06fdf7ea647
Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7830
diff
changeset
|
108 bool is_linear (void) const { return true; } |
7427 | 109 }; |
110 | |
111 class log_scaler : public base_scaler | |
112 { | |
113 public: | |
114 log_scaler (void) { } | |
115 | |
116 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
|
117 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
118 Matrix retval (m.rows (), m.cols ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
119 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
120 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
|
121 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
122 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
123 } |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
124 |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
125 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
|
126 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
127 NDArray retval (m.dims ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
128 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
129 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
|
130 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
131 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
132 } |
7427 | 133 |
134 double scale (double d) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
135 { return log10 (d); } |
7427 | 136 |
137 double unscale (double d) const | |
23639 | 138 { return std::pow (10.0, d); } |
7427 | 139 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
140 base_scaler * clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
141 { 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
|
142 |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
143 private: |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
144 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
|
145 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
146 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
|
147 dest[i] = log10 (src[i]); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
148 } |
14324
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 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
151 class neg_log_scaler : public base_scaler |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
152 { |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
153 public: |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
154 neg_log_scaler (void) { } |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
155 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
156 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
|
157 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
158 Matrix retval (m.rows (), m.cols ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
159 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
160 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
|
161 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
162 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
163 } |
13756
6dfebfa334cb
allow negative data log plots with OpenGL+FLTK graphics (bug #34232)
John W. Eaton <jwe@octave.org>
parents:
13722
diff
changeset
|
164 |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
165 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
|
166 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
167 NDArray retval (m.dims ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
168 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
169 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
|
170 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
171 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
172 } |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
173 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
174 double scale (double d) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
175 { return -log10 (-d); } |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
176 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
177 double unscale (double d) const |
23639 | 178 { return -std::pow (10.0, -d); } |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
179 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
180 base_scaler * clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
181 { return new neg_log_scaler (); } |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
182 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
183 private: |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
184 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
|
185 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
186 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
|
187 dest[i] = -log10 (-src[i]); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
188 } |
7427 | 189 }; |
190 | |
191 class scaler | |
192 { | |
193 public: | |
194 scaler (void) : rep (new base_scaler ()) { } | |
195 | |
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
|
196 scaler (const scaler& s) : rep (s.rep->clone ()) { } |
7427 | 197 |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
198 scaler (const std::string& s) |
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
199 : rep (s == "log" |
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
200 ? new log_scaler () |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23449
diff
changeset
|
201 : (s == "neglog" |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23449
diff
changeset
|
202 ? new neg_log_scaler () |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23449
diff
changeset
|
203 : (s == "linear" |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23449
diff
changeset
|
204 ? new lin_scaler () |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23449
diff
changeset
|
205 : new base_scaler ()))) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
206 { } |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
207 |
7427 | 208 ~scaler (void) { delete rep; } |
209 | |
210 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
|
211 { return rep->scale (m); } |
7427 | 212 |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
213 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
|
214 { 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
|
215 |
7427 | 216 double scale (double d) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
217 { return rep->scale (d); } |
7427 | 218 |
219 double unscale (double d) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
220 { return rep->unscale (d); } |
7427 | 221 |
7832
e06fdf7ea647
Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7830
diff
changeset
|
222 bool is_linear (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
223 { 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
|
224 |
7427 | 225 scaler& operator = (const scaler& s) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
226 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
227 if (rep) |
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 delete rep; |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23774
diff
changeset
|
230 rep = nullptr; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
231 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
232 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
233 rep = s.rep->clone (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
234 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
235 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
236 } |
7427 | 237 |
238 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
|
239 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
240 if (rep) |
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 delete rep; |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23774
diff
changeset
|
243 rep = nullptr; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
244 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
245 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
246 if (s == "log") |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
247 rep = new log_scaler (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
248 else if (s == "neglog") |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
249 rep = new neg_log_scaler (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
250 else if (s == "linear") |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
251 rep = new lin_scaler (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
252 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
253 rep = new base_scaler (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
254 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
255 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
256 } |
7427 | 257 |
258 private: | |
259 base_scaler *rep; | |
260 }; | |
261 | |
262 // --------------------------------------------------------------------- | |
263 | |
7363 | 264 class property; |
265 | |
13924
3b654a0753b1
Implement waitfor, uiwait and uiresume.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13868
diff
changeset
|
266 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
|
267 |
7363 | 268 class base_property |
269 { | |
270 public: | |
271 friend class property; | |
272 | |
273 public: | |
12174 | 274 base_property (void) |
275 : 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
|
276 { } |
7363 | 277 |
278 base_property (const std::string& s, const graphics_handle& h) | |
12174 | 279 : 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
|
280 { } |
7363 | 281 |
282 base_property (const base_property& p) | |
12174 | 283 : id (-1), count (1), name (p.name), parent (p.parent), |
284 hidden (p.hidden), listeners () | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
285 { } |
7363 | 286 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
287 virtual ~base_property (void) = default; |
7363 | 288 |
289 bool ok (void) const { return parent.ok (); } | |
290 | |
291 std::string get_name (void) const { return name; } | |
292 | |
293 void set_name (const std::string& s) { name = s; } | |
294 | |
295 graphics_handle get_parent (void) const { return parent; } | |
296 | |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
297 void set_parent (const graphics_handle& h) { parent = h; } |
7363 | 298 |
299 bool is_hidden (void) const { return hidden; } | |
300 | |
301 void set_hidden (bool flag) { hidden = flag; } | |
302 | |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
303 virtual bool is_radio (void) const { return false; } |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
304 |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
305 int get_id (void) const { return id; } |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
306 |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
307 void set_id (int d) { id = d; } |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
308 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
309 // Sets property value, notifies graphics toolkit. |
8058
ca39c21fa4b8
[mq]: generic_octave_to_backend_nofitication
John W. Eaton <jwe@octave.org>
parents:
8052
diff
changeset
|
310 // If do_run is true, runs associated listeners. |
13321
5ea207067ee5
Export base_property::set.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13307
diff
changeset
|
311 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
|
312 bool do_notify_toolkit = true); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
313 |
7363 | 314 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
|
315 { |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
316 error (R"(get: invalid property "%s")", name.c_str ()); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
317 } |
7363 | 318 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
319 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
|
320 { |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
321 error (R"(values_as_string: invalid property "%s")", name.c_str ()); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
322 } |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
323 |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
324 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
|
325 { |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
326 error (R"(values_as_cell: invalid property "%s")", name.c_str ()); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
327 } |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
328 |
7363 | 329 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
|
330 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
331 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
332 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
333 } |
7363 | 334 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
335 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
|
336 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
337 octave_value_list& l = listeners[mode]; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
338 l.resize (l.length () + 1, v); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
339 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
340 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
341 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
|
342 listener_mode mode = POSTSET) |
17787
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 octave_value_list& l = listeners[mode]; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
345 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
346 if (v.is_defined ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
347 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
348 bool found = false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
349 int i; |
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 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
|
352 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
353 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
|
354 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
355 found = true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
356 break; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
357 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
358 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
359 if (found) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
360 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
361 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
|
362 l(j) = l(j + 1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
363 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
364 l.resize (l.length () - 1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
365 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
366 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
367 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 if (mode == PERSISTENT) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
370 l.resize (0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
371 else |
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 octave_value_list lnew (0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
374 octave_value_list& lp = listeners[PERSISTENT]; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
375 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
|
376 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
377 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
|
378 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
379 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
|
380 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
381 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
|
382 break; |
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 l = lnew; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
387 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
388 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
389 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
390 } |
8299
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
391 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
392 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
|
393 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
394 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
|
395 { return new base_property (*this); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
396 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
397 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
398 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
|
399 { |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
400 error (R"(set: invalid property "%s")", name.c_str ()); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
401 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
402 |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
403 private: |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
404 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
|
405 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
|
406 listener_map_iterator; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
407 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
|
408 listener_map_const_iterator; |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
409 |
7363 | 410 private: |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
411 int id; |
23012
27e4ec3b0b49
move octave_refcount inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23002
diff
changeset
|
412 octave::refcount<int> count; |
7363 | 413 std::string name; |
414 graphics_handle parent; | |
415 bool hidden; | |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
416 listener_map listeners; |
7363 | 417 }; |
418 | |
419 // --------------------------------------------------------------------- | |
420 | |
421 class string_property : public base_property | |
422 { | |
423 public: | |
424 string_property (const std::string& s, const graphics_handle& h, | |
425 const std::string& val = "") | |
426 : base_property (s, h), str (val) { } | |
427 | |
428 string_property (const string_property& p) | |
429 : base_property (p), str (p.str) { } | |
430 | |
431 octave_value get (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
432 { return octave_value (str); } |
7363 | 433 |
434 std::string string_value (void) const { return str; } | |
435 | |
436 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
|
437 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
438 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
439 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
440 } |
7363 | 441 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
442 base_property * clone (void) const { return new string_property (*this); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
443 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
444 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
445 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
|
446 { |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
447 if (! val.is_string ()) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
448 error (R"(set: invalid string property value for "%s")", |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
449 get_name ().c_str ()); |
20962
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 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
|
452 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
453 if (new_str != str) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
454 { |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
455 str = new_str; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
456 return true; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
457 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
458 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
459 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
460 |
7363 | 461 private: |
462 std::string str; | |
463 }; | |
464 | |
465 // --------------------------------------------------------------------- | |
466 | |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
467 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
|
468 { |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
469 public: |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
470 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
|
471 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
472 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
|
473 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
|
474 const desired_enum& typ = string_t) |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
475 : 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
|
476 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
477 size_t pos = 0; |
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 while (true) |
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 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
|
482 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
483 if (new_pos == std::string::npos) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
484 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
485 str.append (val.substr (pos)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
486 break; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
487 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
488 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
489 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
|
490 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
491 pos = new_pos + 1; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
492 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
493 } |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
494 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
495 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
|
496 const Cell& c, const char& sep = '|', |
830f27544bb7
Accept char array inputs for linestyleorder property (bug #34906).
Rik <rik@octave.org>
parents:
16832
diff
changeset
|
497 const desired_enum& typ = string_t) |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
498 : 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
|
499 { |
23575
e95738a119da
maint: Deprecate is_cellstr and replace with iscellstr.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
500 if (! c.iscellstr ()) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
501 error (R"(set: invalid order property value for "%s")", |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
502 get_name ().c_str ()); |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
503 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
504 string_vector strings (c.numel ()); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
505 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
506 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
|
507 strings[i] = c(i).string_value (); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
508 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
509 str = strings; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
510 } |
10135
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 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
|
513 : 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
|
514 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
|
515 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
516 octave_value get (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
517 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
518 if (desired_type == string_t) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
519 return octave_value (string_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
520 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
521 return octave_value (cell_value ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
522 } |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
523 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
524 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
|
525 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
526 std::string s; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
527 |
20232
a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents:
20181
diff
changeset
|
528 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
|
529 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
530 s += str[i]; |
20232
a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents:
20181
diff
changeset
|
531 if (i != str.numel () - 1) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
532 s += separator; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
533 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
534 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
535 return s; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
536 } |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
537 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
538 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
|
539 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
540 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
|
541 |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
542 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
|
543 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
544 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
545 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
546 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
547 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
548 base_property * clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
549 { 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
|
550 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
551 protected: |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
552 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
|
553 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
554 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
|
555 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
556 bool replace = false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
557 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
|
558 string_vector strings; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
559 size_t pos = 0; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
560 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
561 // Split single string on delimiter (usually '|') |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
562 while (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 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
|
565 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
566 if (new_pos == std::string::npos) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
567 { |
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)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
569 break; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
570 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
571 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
572 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
|
573 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
574 pos = new_pos + 1; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
575 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
576 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
577 if (str.numel () == strings.numel ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
578 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
579 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
|
580 if (strings[i] != str[i]) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
581 { |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
582 replace = true; |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
583 break; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
584 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
585 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
586 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
587 replace = true; |
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 desired_type = string_t; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
590 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
591 if (replace) |
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 str = strings; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
594 return true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
595 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
596 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
597 else 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
|
598 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
599 bool replace = false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
600 charMatrix chm = val.char_matrix_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
601 octave_idx_type nel = chm.rows (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
602 string_vector strings (nel); |
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 if (nel != str.numel ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
605 replace = true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
606 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
|
607 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
608 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
|
609 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
|
610 replace = true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
611 } |
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 desired_type = string_t; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
614 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
615 if (replace) |
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 str = strings; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
618 return true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
619 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
620 } |
23575
e95738a119da
maint: Deprecate is_cellstr and replace with iscellstr.
Rik <rik@octave.org>
parents:
23564
diff
changeset
|
621 else if (val.iscellstr ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
622 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
623 bool replace = false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
624 Cell new_cell = val.cell_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
625 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
626 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
|
627 |
20232
a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents:
20181
diff
changeset
|
628 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
|
629 |
a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents:
20181
diff
changeset
|
630 if (nel != str.numel ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
631 replace = true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
632 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
633 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
634 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
|
635 { |
10585
9f55d3ce490a
avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents:
10566
diff
changeset
|
636 if (strings[i] != str[i]) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
637 { |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
638 replace = true; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
639 break; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
640 } |
17787
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 } |
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 desired_type = cell_t; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
645 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
646 if (replace) |
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 str = strings; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
649 return true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
650 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
651 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
652 else |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
653 error (R"(set: invalid string property value for "%s")", |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
654 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
|
655 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
656 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
657 } |
10135
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
658 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
659 private: |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
660 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
|
661 char separator; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
662 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
|
663 }; |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
664 |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
665 // --------------------------------------------------------------------- |
4516a0c97ced
Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents:
10121
diff
changeset
|
666 |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
667 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
|
668 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
669 public: |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
670 enum type { char_t, cellstr_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 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
|
673 const std::string& val = "") |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
674 : 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
|
675 { } |
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 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
|
678 const NDArray& nda) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
679 : 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
|
680 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
681 octave_idx_type nel = nda.numel (); |
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 value.resize (nel); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
684 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
685 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
|
686 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
687 std::ostringstream buf; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
688 buf << nda(i); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
689 value[i] = buf.str (); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
690 } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
691 } |
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 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
|
694 const Cell& c) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
695 : 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
|
696 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
697 octave_idx_type nel = c.numel (); |
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 value.resize (nel); |
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 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
|
702 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
703 octave_value tmp = c(i); |
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 if (tmp.is_string ()) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
706 value[i] = c(i).string_value (); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
707 else |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
708 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
709 double d = c(i).double_value (); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
710 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
711 std::ostringstream buf; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
712 buf << d; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
713 value[i] = buf.str (); |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
714 } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
715 } |
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 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
718 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
|
719 : 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
|
720 { } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
721 |
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
|
722 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
|
723 { |
22bc9ec80c2c
allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents:
12959
diff
changeset
|
724 octave_value tmp = get (); |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23576
diff
changeset
|
725 return tmp.isempty (); |
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
|
726 } |
22bc9ec80c2c
allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents:
12959
diff
changeset
|
727 |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
728 octave_value get (void) const |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
729 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
730 if (stored_type == char_t) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
731 return octave_value (char_value ()); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
732 else |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
733 return octave_value (cell_value ()); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
734 } |
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 std::string string_value (void) const |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
737 { |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
738 return value.empty () ? "" : value[0]; |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
739 } |
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 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
|
742 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
743 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
|
744 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
745 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
|
746 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
747 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
|
748 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
749 set (val); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
750 return *this; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
751 } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
752 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
753 base_property * clone (void) const { return new text_label_property (*this); } |
12959
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 protected: |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
756 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
757 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
|
758 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
759 if (val.is_string ()) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
760 { |
20990
fc9cca99b2de
Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents:
20976
diff
changeset
|
761 value = val.string_vector_value (); |
12959
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 stored_type = char_t; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
764 } |
23576
00e518162fda
maint: Deprecate is_cell and replace with iscell.
Rik <rik@octave.org>
parents:
23575
diff
changeset
|
765 else if (val.iscell ()) |
12959
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 Cell c = val.cell_value (); |
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 octave_idx_type nel = c.numel (); |
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 value.resize (nel); |
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 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
|
774 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
775 octave_value tmp = c(i); |
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 if (tmp.is_string ()) |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
778 value[i] = c(i).string_value (); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
779 else |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
780 { |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
781 double d = c(i).double_value (); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
782 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
783 std::ostringstream buf; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
784 buf << d; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
785 value[i] = buf.str (); |
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 } |
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
|
788 |
22bc9ec80c2c
allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents:
12959
diff
changeset
|
789 stored_type = cellstr_t; |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
790 } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
791 else |
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 NDArray nda; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
794 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
795 try |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
796 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
797 nda = val.array_value (); |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
798 } |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
799 catch (octave::execution_exception& e) |
12959
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
800 { |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
801 error (e, R"(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
|
802 get_name ().c_str ()); |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
803 } |
20545
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 octave_idx_type nel = nda.numel (); |
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 value.resize (nel); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
808 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
809 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
|
810 { |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
811 std::ostringstream buf; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
812 buf << nda(i); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
813 value[i] = buf.str (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
814 } |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
815 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
816 stored_type = char_t; |
12959
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 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
819 return true; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
820 } |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
821 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
822 private: |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
823 string_vector value; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
824 type stored_type; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
825 }; |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
826 |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
827 // --------------------------------------------------------------------- |
0c86ae6f7c34
new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents:
12777
diff
changeset
|
828 |
7363 | 829 class radio_values |
830 { | |
831 public: | |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
832 OCTINTERP_API radio_values (const std::string& opt_string = ""); |
7363 | 833 |
834 radio_values (const radio_values& a) | |
835 : default_val (a.default_val), possible_vals (a.possible_vals) { } | |
836 | |
837 radio_values& operator = (const radio_values& a) | |
838 { | |
839 if (&a != this) | |
840 { | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
841 default_val = a.default_val; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
842 possible_vals = a.possible_vals; |
7363 | 843 } |
844 | |
845 return *this; | |
846 } | |
847 | |
848 std::string default_value (void) const { return default_val; } | |
849 | |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
850 bool validate (const std::string& val, std::string& match) |
7363 | 851 { |
852 bool retval = true; | |
853 | |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
854 if (! contains (val, match)) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
855 error ("invalid value = %s", val.c_str ()); |
7363 | 856 |
857 return retval; | |
858 } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
859 |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
860 bool contains (const std::string& val, std::string& match) |
7363 | 861 { |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
862 size_t k = 0; |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
863 |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
864 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
|
865 |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
866 std::string first_match; |
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 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
|
869 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
870 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
|
871 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
872 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
|
873 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
874 // 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
|
875 // 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
|
876 // 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
|
877 match = possible_val; |
13236
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
878 return true; |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
879 } |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
880 else |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
881 { |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
882 if (k == 0) |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
883 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
|
884 |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
885 k++; |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
886 } |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
887 } |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
888 } |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
889 |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
890 if (k == 1) |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
891 { |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
892 match = first_match; |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
893 return true; |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
894 } |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
895 else |
8bb526fb3349
allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents:
13132
diff
changeset
|
896 return false; |
7363 | 897 } |
898 | |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
899 std::string values_as_string (void) const; |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
900 |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
901 Cell values_as_cell (void) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
902 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
903 octave_idx_type nelem (void) const { return possible_vals.size (); } |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
904 |
7363 | 905 private: |
906 // Might also want to cache | |
907 std::string default_val; | |
908 std::set<caseless_str> possible_vals; | |
909 }; | |
910 | |
911 class radio_property : public base_property | |
912 { | |
913 public: | |
7364 | 914 radio_property (const std::string& nm, const graphics_handle& h, |
7363 | 915 const radio_values& v = radio_values ()) |
7364 | 916 : base_property (nm, h), |
7363 | 917 vals (v), current_val (v.default_value ()) { } |
918 | |
7364 | 919 radio_property (const std::string& nm, const graphics_handle& h, |
7363 | 920 const std::string& v) |
7364 | 921 : base_property (nm, h), |
7363 | 922 vals (v), current_val (vals.default_value ()) { } |
923 | |
7364 | 924 radio_property (const std::string& nm, const graphics_handle& h, |
7363 | 925 const radio_values& v, const std::string& def) |
7364 | 926 : base_property (nm, h), |
7363 | 927 vals (v), current_val (def) { } |
928 | |
929 radio_property (const radio_property& p) | |
930 : base_property (p), vals (p.vals), current_val (p.current_val) { } | |
931 | |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
932 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
|
933 |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
934 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
|
935 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
936 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
|
937 |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
938 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
|
939 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
940 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
|
941 { return v.compare (current_val); } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
942 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
943 bool is_radio (void) const { return true; } |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
944 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
945 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
|
946 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
947 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
948 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
949 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
950 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
951 base_property * clone (void) const { return new radio_property (*this); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
952 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
953 protected: |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
954 bool do_set (const octave_value& newval) |
7363 | 955 { |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
956 if (! newval.is_string ()) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
957 error (R"(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
|
958 get_name ().c_str ()); |
20962
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 std::string s = newval.string_value (); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
961 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
962 std::string match; |
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 (! vals.validate (s, match)) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
965 error (R"(set: invalid value for radio property "%s" (value = %s))", |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
966 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
|
967 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
968 if (match != current_val) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
969 { |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
970 if (s.length () != match.length ()) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
971 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
|
972 "%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
|
973 "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
|
974 match.c_str ()); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
975 current_val = match; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
976 return true; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
977 } |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
978 return false; |
7363 | 979 } |
980 | |
981 private: | |
982 radio_values vals; | |
983 std::string current_val; | |
984 }; | |
985 | |
986 // --------------------------------------------------------------------- | |
987 | |
988 class color_values | |
989 { | |
990 public: | |
991 color_values (double r = 0, double g = 0, double b = 1) | |
992 : xrgb (1, 3) | |
993 { | |
994 xrgb(0) = r; | |
995 xrgb(1) = g; | |
996 xrgb(2) = b; | |
997 | |
998 validate (); | |
999 } | |
1000 | |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1001 color_values (const std::string& str) |
7363 | 1002 : xrgb (1, 3) |
1003 { | |
1004 if (! str2rgb (str)) | |
1005 error ("invalid color specification: %s", str.c_str ()); | |
1006 } | |
1007 | |
1008 color_values (const color_values& c) | |
1009 : xrgb (c.xrgb) | |
1010 { } | |
1011 | |
1012 color_values& operator = (const color_values& c) | |
1013 { | |
1014 if (&c != this) | |
1015 xrgb = c.xrgb; | |
1016 | |
1017 return *this; | |
1018 } | |
1019 | |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1020 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
|
1021 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1022 return (xrgb(0) == c.xrgb(0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1023 && xrgb(1) == c.xrgb(1) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1024 && xrgb(2) == c.xrgb(2)); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1025 } |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1026 |
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1027 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
|
1028 { return ! (*this == c); } |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1029 |
7363 | 1030 Matrix rgb (void) const { return xrgb; } |
1031 | |
1032 operator octave_value (void) const { return xrgb; } | |
1033 | |
1034 void validate (void) const | |
1035 { | |
1036 for (int i = 0; i < 3; i++) | |
1037 { | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
1038 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
|
1039 error ("invalid RGB color specification"); |
7363 | 1040 } |
1041 } | |
1042 | |
1043 private: | |
1044 Matrix xrgb; | |
1045 | |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1046 OCTINTERP_API bool str2rgb (const std::string& str); |
7363 | 1047 }; |
1048 | |
1049 class color_property : public base_property | |
1050 { | |
1051 public: | |
1052 color_property (const color_values& c, const radio_values& v) | |
1053 : base_property ("", graphics_handle ()), | |
1054 current_type (color_t), color_val (c), radio_val (v), | |
1055 current_val (v.default_value ()) | |
1056 { } | |
1057 | |
17645
85a057ad1ba6
Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents:
17631
diff
changeset
|
1058 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
|
1059 : base_property ("", graphics_handle ()), |
85a057ad1ba6
Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents:
17631
diff
changeset
|
1060 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
|
1061 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
|
1062 { } |
85a057ad1ba6
Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents:
17631
diff
changeset
|
1063 |
7364 | 1064 color_property (const std::string& nm, const graphics_handle& h, |
7363 | 1065 const color_values& c = color_values (), |
1066 const radio_values& v = radio_values ()) | |
7364 | 1067 : base_property (nm, h), |
7363 | 1068 current_type (color_t), color_val (c), radio_val (v), |
1069 current_val (v.default_value ()) | |
1070 { } | |
1071 | |
7364 | 1072 color_property (const std::string& nm, const graphics_handle& h, |
7363 | 1073 const radio_values& v) |
7364 | 1074 : base_property (nm, h), |
7363 | 1075 current_type (radio_t), color_val (color_values ()), radio_val (v), |
1076 current_val (v.default_value ()) | |
1077 { } | |
1078 | |
7364 | 1079 color_property (const std::string& nm, const graphics_handle& h, |
7363 | 1080 const std::string& v) |
7364 | 1081 : base_property (nm, h), |
7363 | 1082 current_type (radio_t), color_val (color_values ()), radio_val (v), |
1083 current_val (radio_val.default_value ()) | |
1084 { } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1085 |
7364 | 1086 color_property (const std::string& nm, const graphics_handle& h, |
7363 | 1087 const color_property& v) |
7364 | 1088 : base_property (nm, h), |
7363 | 1089 current_type (v.current_type), color_val (v.color_val), |
1090 radio_val (v.radio_val), current_val (v.current_val) | |
1091 { } | |
1092 | |
1093 color_property (const color_property& p) | |
1094 : base_property (p), current_type (p.current_type), | |
1095 color_val (p.color_val), radio_val (p.radio_val), | |
1096 current_val (p.current_val) { } | |
1097 | |
1098 octave_value get (void) const | |
1099 { | |
1100 if (current_type == color_t) | |
1101 return color_val.rgb (); | |
1102 | |
1103 return current_val; | |
1104 } | |
1105 | |
1106 bool is_rgb (void) const { return (current_type == color_t); } | |
1107 | |
1108 bool is_radio (void) const { return (current_type == radio_t); } | |
1109 | |
1110 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
|
1111 { return (is_radio () && current_val == v); } |
7363 | 1112 |
1113 Matrix rgb (void) const | |
1114 { | |
1115 if (current_type != color_t) | |
20726
25d676f9619c
Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
1116 error ("color has no RGB value"); |
7363 | 1117 |
1118 return color_val.rgb (); | |
1119 } | |
1120 | |
1121 const std::string& current_value (void) const | |
1122 { | |
1123 if (current_type != radio_t) | |
1124 error ("color has no radio value"); | |
1125 | |
1126 return current_val; | |
1127 } | |
1128 | |
1129 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
|
1130 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1131 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1132 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1133 } |
7363 | 1134 |
1135 operator octave_value (void) const { return get (); } | |
1136 | |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
1137 base_property * clone (void) const { return new color_property (*this); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1138 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1139 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
|
1140 { 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
|
1141 |
f0236b444356
Allow set(h) to work if the handle includes color properties
David Bateman <dbateman@free.fr>
parents:
10722
diff
changeset
|
1142 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
|
1143 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1144 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1145 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
|
1146 |
7363 | 1147 private: |
1148 enum current_enum { color_t, radio_t } current_type; | |
1149 color_values color_val; | |
1150 radio_values radio_val; | |
1151 std::string current_val; | |
1152 }; | |
1153 | |
1154 // --------------------------------------------------------------------- | |
1155 | |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1156 enum finite_type |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1157 { |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1158 NO_CHECK, |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1159 FINITE, |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1160 NOT_NAN, |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1161 NOT_INF |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1162 }; |
7363 | 1163 class double_property : public base_property |
1164 { | |
1165 public: | |
7364 | 1166 double_property (const std::string& nm, const graphics_handle& h, |
7363 | 1167 double d = 0) |
7364 | 1168 : base_property (nm, h), |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1169 current_val (d), finite_constraint (NO_CHECK), |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1170 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
|
1171 maxval (std::pair<double, bool> (octave_NaN, true)) { } |
7363 | 1172 |
1173 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
|
1174 : base_property (p), current_val (p.current_val), |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1175 finite_constraint (NO_CHECK), |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1176 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
|
1177 maxval (std::pair<double, bool> (octave_NaN, true)) { } |
7363 | 1178 |
1179 octave_value get (void) const { return octave_value (current_val); } | |
1180 | |
1181 double double_value (void) const { return current_val; } | |
1182 | |
1183 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
|
1184 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1185 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1186 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1187 } |
7363 | 1188 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
1189 base_property * clone (void) const |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1190 { |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1191 double_property *p = new double_property (*this); |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1192 |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1193 p->finite_constraint = finite_constraint; |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1194 p->minval = minval; |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1195 p->maxval = maxval; |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1196 |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1197 return p; |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1198 } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1199 |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1200 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
|
1201 { |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1202 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
|
1203 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
|
1204 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
|
1205 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
|
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 |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1208 void add_constraint (const finite_type finite) |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1209 { finite_constraint = finite; } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1210 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1211 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1212 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
|
1213 { |
23582
0cc2011d800e
maint: Deprecate is_real_type and replace with isreal.
Rik <rik@octave.org>
parents:
23577
diff
changeset
|
1214 if (! v.is_scalar_type () || ! v.isreal ()) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1215 error (R"(set: invalid value for double property "%s")", |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1216 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
|
1217 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1218 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
|
1219 |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1220 // 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
|
1221 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
|
1222 { |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1223 if (minval.second && minval.first > new_val) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1224 error (R"(set: "%s" must be greater than or equal to %g)", |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1225 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
|
1226 else if (! minval.second && minval.first >= new_val) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1227 error (R"(set: "%s" must be greater than %g)", |
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 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
|
1229 } |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1230 |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1231 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
|
1232 { |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1233 if (maxval.second && maxval.first < new_val) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1234 error (R"(set: "%s" must be less than or equal to %g)", |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1235 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
|
1236 else if (! maxval.second && maxval.first <= new_val) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1237 error (R"(set: "%s" must be less than %g)", |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1238 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
|
1239 } |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1240 |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1241 if (finite_constraint == NO_CHECK) { /* do nothing */ } |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1242 else if (finite_constraint == FINITE) |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1243 { |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1244 if (! octave::math::isfinite (new_val)) |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1245 error (R"(set: "%s" must be finite)", get_name ().c_str ()); |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1246 } |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1247 else if (finite_constraint == NOT_NAN) |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1248 { |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1249 if (octave::math::isnan (new_val)) |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1250 error (R"(set: "%s" must not be nan)", get_name ().c_str ()); |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1251 } |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1252 else if (finite_constraint == NOT_INF) |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1253 { |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1254 if (octave::math::isinf (new_val)) |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1255 error (R"(set: "%s" must not be infinite)", get_name ().c_str ()); |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1256 } |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1257 |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1258 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
|
1259 { |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1260 current_val = new_val; |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1261 return true; |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1262 } |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
1263 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1264 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1265 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1266 |
7363 | 1267 private: |
1268 double current_val; | |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1269 finite_type finite_constraint; |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1270 std::pair<double, bool> minval, maxval; |
7363 | 1271 }; |
1272 | |
1273 // --------------------------------------------------------------------- | |
1274 | |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1275 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
|
1276 { |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1277 public: |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1278 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
|
1279 : 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
|
1280 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
|
1281 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
|
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 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
|
1285 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
|
1286 : 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
|
1287 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
|
1288 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
|
1289 { } |
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 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
|
1292 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
|
1293 : 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
|
1294 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
|
1295 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
|
1296 { } |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1297 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1298 double_radio_property (const double_radio_property& p) |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1299 : base_property (p), current_type (p.current_type), |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1300 dval (p.dval), radio_val (p.radio_val), |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1301 current_val (p.current_val) { } |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1302 |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1303 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
|
1304 { |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1305 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
|
1306 return dval; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1307 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1308 return current_val; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1309 } |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1310 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1311 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
|
1312 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1313 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
|
1314 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1315 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
|
1316 { 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
|
1317 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1318 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
|
1319 { |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1320 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
|
1321 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
|
1322 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1323 return dval; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1324 } |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1325 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1326 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
|
1327 { |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1328 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
|
1329 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
|
1330 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1331 return current_val; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1332 } |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1333 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1334 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
|
1335 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1336 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1337 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1338 } |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1339 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1340 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
|
1341 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
1342 base_property * clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1343 { return new double_radio_property (*this); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1344 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1345 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1346 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
|
1347 |
7844
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1348 private: |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1349 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
|
1350 double dval; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1351 radio_values radio_val; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1352 std::string current_val; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1353 }; |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1354 |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1355 // --------------------------------------------------------------------- |
3d60445d3638
Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7842
diff
changeset
|
1356 |
7363 | 1357 class array_property : public base_property |
1358 { | |
1359 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
|
1360 array_property (void) |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
1361 : 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
|
1362 xmin (), xmax (), xminp (), xmaxp (), |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1363 type_constraints (), size_constraints (), finite_constraint (NO_CHECK), |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1364 minval (std::pair<double, bool> (octave_NaN, true)), |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1365 maxval (std::pair<double, bool> (octave_NaN, true)) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1366 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1367 get_data_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1368 } |
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
|
1369 |
7364 | 1370 array_property (const std::string& nm, const graphics_handle& h, |
7363 | 1371 const octave_value& m) |
23583
b7747a2c88b2
maint: Deprecate is_sparse_type and replace with issparse.
Rik <rik@octave.org>
parents:
23582
diff
changeset
|
1372 : base_property (nm, h), data (m.issparse () ? m.full_value () : m), |
13132
e3e8ca96f923
Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents:
12965
diff
changeset
|
1373 xmin (), xmax (), xminp (), xmaxp (), |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1374 type_constraints (), size_constraints (), finite_constraint (NO_CHECK), |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1375 minval (std::pair<double, bool> (octave_NaN, true)), |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1376 maxval (std::pair<double, bool> (octave_NaN, true)) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1377 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1378 get_data_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1379 } |
7363 | 1380 |
7848
6bb2bbc2bf45
Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7847
diff
changeset
|
1381 // 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
|
1382 // 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
|
1383 // copy constraints. |
6bb2bbc2bf45
Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7847
diff
changeset
|
1384 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
|
1385 : 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
|
1386 xmin (p.xmin), xmax (p.xmax), xminp (p.xminp), xmaxp (p.xmaxp), |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1387 type_constraints (), size_constraints (), finite_constraint (NO_CHECK), |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1388 minval (std::pair<double, bool> (octave_NaN, true)), |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1389 maxval (std::pair<double, bool> (octave_NaN, true)) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1390 { } |
7848
6bb2bbc2bf45
Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7847
diff
changeset
|
1391 |
7363 | 1392 octave_value get (void) const { return data; } |
1393 | |
1394 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
|
1395 { type_constraints.insert (type); } |
7363 | 1396 |
7524
a653856aa3e1
array_value::add_constraint: pass dim_vector as const reference, not value
John W. Eaton <jwe@octave.org>
parents:
7523
diff
changeset
|
1397 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
|
1398 { size_constraints.push_back (dims); } |
7363 | 1399 |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1400 void add_constraint (const finite_type finite) |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1401 { finite_constraint = finite; } |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1402 |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1403 void add_constraint (const std::string& type, double val, bool inclusive) |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1404 { |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1405 if (type == "min") |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1406 minval = std::pair<double, bool> (val, inclusive); |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1407 else if (type == "max") |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1408 maxval = std::pair<double, bool> (val, inclusive); |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1409 } |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1410 |
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
|
1411 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
|
1412 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
|
1413 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
|
1414 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
|
1415 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
1416 Matrix get_limits (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1417 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1418 Matrix m (1, 4); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1419 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1420 m(0) = min_val (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1421 m(1) = max_val (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1422 m(2) = min_pos (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1423 m(3) = max_neg (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1424 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1425 return m; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1426 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
1427 |
7363 | 1428 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
|
1429 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1430 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1431 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1432 } |
7363 | 1433 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
1434 base_property * clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1435 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1436 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
|
1437 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1438 p->type_constraints = type_constraints; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1439 p->size_constraints = size_constraints; |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1440 p->finite_constraint = finite_constraint; |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1441 p->minval = minval; |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1442 p->maxval = maxval; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1443 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1444 return p; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1445 } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1446 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1447 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1448 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
|
1449 { |
23583
b7747a2c88b2
maint: Deprecate is_sparse_type and replace with issparse.
Rik <rik@octave.org>
parents:
23582
diff
changeset
|
1450 octave_value tmp = (v.issparse () ? v.full_value () : v); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1451 |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1452 if (! validate (tmp)) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1453 error (R"(invalid value for array property "%s")", |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1454 get_name ().c_str ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1455 |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1456 // 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
|
1457 if (! is_equal (tmp)) |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1458 { |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1459 data = tmp; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1460 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1461 get_data_limits (); |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1462 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1463 return true; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1464 } |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1465 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1466 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1467 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1468 |
7363 | 1469 private: |
1470 OCTINTERP_API bool validate (const octave_value& v); | |
1471 | |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1472 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
|
1473 |
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
|
1474 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
|
1475 |
7523
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1476 protected: |
7363 | 1477 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
|
1478 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
|
1479 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
|
1480 double xminp; |
13132
e3e8ca96f923
Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents:
12965
diff
changeset
|
1481 double xmaxp; |
15069
7a3957ca99c3
Handle complex arguments in imagesc (bug #36866)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
14861
diff
changeset
|
1482 std::set<std::string> type_constraints; |
7363 | 1483 std::list<dim_vector> size_constraints; |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1484 finite_type finite_constraint; |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1485 std::pair<double, bool> minval, maxval; |
7363 | 1486 }; |
1487 | |
7523
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1488 class row_vector_property : public array_property |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1489 { |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1490 public: |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1491 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
|
1492 const octave_value& m) |
7527
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1493 : array_property (nm, h, m) |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1494 { |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1495 add_constraint (dim_vector (-1, 1)); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1496 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
|
1497 add_constraint (dim_vector (0, 0)); |
7527
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1498 } |
7523
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1499 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1500 row_vector_property (const row_vector_property& p) |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1501 : array_property (p) |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1502 { |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1503 add_constraint (dim_vector (-1, 1)); |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1504 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
|
1505 add_constraint (dim_vector (0, 0)); |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1506 } |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1507 |
7527
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1508 void add_constraint (const std::string& type) |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1509 { |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1510 array_property::add_constraint (type); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1511 } |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1512 |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1513 void add_constraint (const dim_vector& dims) |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1514 { |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1515 array_property::add_constraint (dims); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1516 } |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1517 |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1518 void add_constraint (const finite_type finite) |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1519 { |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1520 array_property::add_constraint (finite); |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1521 } |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1522 |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1523 void add_constraint (const std::string& type, double val, bool inclusive) |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1524 { |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1525 array_property::add_constraint (type, val, inclusive); |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1526 } |
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
1527 |
7527
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1528 void add_constraint (octave_idx_type len) |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1529 { |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1530 size_constraints.remove (dim_vector (1, -1)); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1531 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
|
1532 size_constraints.remove (dim_vector (0, 0)); |
7527
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1533 |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1534 add_constraint (dim_vector (1, len)); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1535 add_constraint (dim_vector (len, 1)); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1536 } |
7523
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1537 |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1538 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
|
1539 { |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1540 set (val); |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1541 return *this; |
d219e712c20e
make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents:
7526
diff
changeset
|
1542 } |
7523
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1543 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
1544 base_property * clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1545 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1546 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
|
1547 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1548 p->type_constraints = type_constraints; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1549 p->size_constraints = size_constraints; |
24277
ca03c9f3fa4b
Copy all constraints for row vector properties.
Markus Mützel <markus.muetzel@gmx.de>
parents:
24252
diff
changeset
|
1550 p->finite_constraint = finite_constraint; |
ca03c9f3fa4b
Copy all constraints for row vector properties.
Markus Mützel <markus.muetzel@gmx.de>
parents:
24252
diff
changeset
|
1551 p->minval = minval; |
ca03c9f3fa4b
Copy all constraints for row vector properties.
Markus Mützel <markus.muetzel@gmx.de>
parents:
24252
diff
changeset
|
1552 p->maxval = maxval; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1553 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1554 return p; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1555 } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1556 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1557 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1558 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
|
1559 { |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1560 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
|
1561 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1562 dim_vector dv = data.dims (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1563 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1564 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
|
1565 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1566 int tmp = dv(0); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1567 dv(0) = dv(1); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1568 dv(1) = tmp; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1569 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1570 data = data.reshape (dv); |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1571 } |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1572 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1573 return retval; |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1574 } |
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1575 |
7523
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1576 private: |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1577 OCTINTERP_API bool validate (const octave_value& v); |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1578 }; |
f2000f1971ab
new row_vector_property class
John W. Eaton <jwe@octave.org>
parents:
7471
diff
changeset
|
1579 |
7363 | 1580 // --------------------------------------------------------------------- |
1581 | |
1582 class bool_property : public radio_property | |
1583 { | |
1584 public: | |
7364 | 1585 bool_property (const std::string& nm, const graphics_handle& h, |
7363 | 1586 bool val) |
7364 | 1587 : 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
|
1588 { } |
7363 | 1589 |
7364 | 1590 bool_property (const std::string& nm, const graphics_handle& h, |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
1591 const char *val) |
24687
8b935067a257
Allow printing without updating qt visible or invisible figures (bug #52940).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24637
diff
changeset
|
1592 : radio_property (nm, h, radio_values (std::string (val) == "on" ? |
24635
b708857d634e
Correctly display boolean properties default values (bug #52768)
Sahil Yadav <yadavsahil5198@gmail.com>
parents:
24534
diff
changeset
|
1593 "{on}|off" : "on|{off}"), val) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1594 { } |
7363 | 1595 |
1596 bool_property (const bool_property& p) | |
1597 : radio_property (p) { } | |
1598 | |
1599 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
|
1600 |
7363 | 1601 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
|
1602 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1603 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1604 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1605 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1606 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
1607 base_property * clone (void) const { return new bool_property (*this); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1608 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1609 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1610 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
|
1611 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1612 if (val.is_bool_scalar ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1613 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
|
1614 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1615 return radio_property::do_set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1616 } |
7363 | 1617 }; |
1618 | |
1619 // --------------------------------------------------------------------- | |
1620 | |
1621 class handle_property : public base_property | |
1622 { | |
1623 public: | |
7364 | 1624 handle_property (const std::string& nm, const graphics_handle& h, |
7363 | 1625 const graphics_handle& val = graphics_handle ()) |
7364 | 1626 : base_property (nm, h), |
7363 | 1627 current_val (val) { } |
1628 | |
1629 handle_property (const handle_property& p) | |
1630 : base_property (p), current_val (p.current_val) { } | |
1631 | |
1632 octave_value get (void) const { return current_val.as_octave_value (); } | |
1633 | |
1634 graphics_handle handle_value (void) const { return current_val; } | |
1635 | |
1636 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
|
1637 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1638 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1639 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1640 } |
7363 | 1641 |
1642 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
|
1643 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1644 set (octave_value (h.value ())); |
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 } |
7363 | 1647 |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1648 void invalidate (void) |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
1649 { 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
|
1650 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
1651 base_property * clone (void) const { return new handle_property (*this); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1652 |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
1653 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
|
1654 { 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
|
1655 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1656 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1657 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
|
1658 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
|
1659 |
7363 | 1660 private: |
1661 graphics_handle current_val; | |
1662 }; | |
1663 | |
1664 // --------------------------------------------------------------------- | |
1665 | |
1666 class any_property : public base_property | |
1667 { | |
1668 public: | |
7364 | 1669 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
|
1670 const octave_value& m = Matrix ()) |
7364 | 1671 : base_property (nm, h), data (m) { } |
7363 | 1672 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1673 any_property (const any_property& p) |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1674 : base_property (p), data (p.data) { } |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1675 |
7363 | 1676 octave_value get (void) const { return data; } |
1677 | |
1678 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
|
1679 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1680 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1681 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1682 } |
7363 | 1683 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
1684 base_property * clone (void) const { return new any_property (*this); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1685 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1686 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1687 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
|
1688 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1689 data = v; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1690 return true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1691 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1692 |
7363 | 1693 private: |
1694 octave_value data; | |
1695 }; | |
1696 | |
1697 // --------------------------------------------------------------------- | |
1698 | |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1699 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
|
1700 { |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1701 public: |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1702 children_property (void) |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
1703 : 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
|
1704 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1705 do_init_children (Matrix ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1706 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1707 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1708 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
|
1709 const Matrix& val) |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
1710 : 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
|
1711 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1712 do_init_children (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1713 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1714 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1715 children_property (const children_property& p) |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
1716 : base_property (p), children_list () |
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 do_init_children (p.children_list); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1719 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1720 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1721 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
|
1722 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1723 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1724 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1725 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1726 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
1727 base_property * clone (void) const { return new children_property (*this); } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1728 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1729 bool remove_child (double val) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1730 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1731 return do_remove_child (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1732 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1733 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1734 void adopt (double val) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1735 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1736 do_adopt_child (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1737 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1738 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1739 Matrix get_children (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1740 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1741 return do_get_children (false); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1742 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1743 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1744 Matrix get_hidden (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1745 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1746 return do_get_children (true); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1747 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1748 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1749 Matrix get_all (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1750 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1751 return do_get_all_children (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1752 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1753 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1754 octave_value get (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1755 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1756 return octave_value (get_children ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1757 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1758 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1759 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
|
1760 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1761 do_delete_children (clear); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1762 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1763 |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
1764 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
|
1765 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1766 for (auto& hchild : children_list) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1767 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1768 if (hchild == old_gh) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1769 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1770 hchild = new_gh.value (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1771 return; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1772 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1773 } |
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 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
|
1776 } |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
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 private: |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1779 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
|
1780 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
|
1781 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
|
1782 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1783 protected: |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1784 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
|
1785 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1786 Matrix new_kids; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1787 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1788 try |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1789 { |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1790 new_kids = val.matrix_value (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1791 } |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22326
diff
changeset
|
1792 catch (octave::execution_exception& e) |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1793 { |
20756
200ae1d650b7
propagate octave_execution_exception objects through try/catch blocks
John W. Eaton <jwe@octave.org>
parents:
20738
diff
changeset
|
1794 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
|
1795 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1796 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1797 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
|
1798 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1799 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
|
1800 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1801 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
|
1802 bool add_hidden = true; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1803 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1804 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
|
1805 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1806 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
|
1807 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1808 Matrix t1 = visible_kids.sort (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1809 Matrix t2 = new_kids_column.sort (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1810 Matrix t3 = get_hidden ().sort (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1811 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1812 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
|
1813 is_ok = false; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1814 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1815 if (t1 == t3) |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1816 add_hidden = false; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1817 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1818 else |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1819 is_ok = false; |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1820 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1821 if (! is_ok) |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
1822 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
|
1823 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1824 if (is_ok) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1825 { |
19678
c17e1cefdbd3
Fix reordering graphics property children for hidden objects (bug #44211)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19666
diff
changeset
|
1826 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
|
1827 |
c17e1cefdbd3
Fix reordering graphics property children for hidden objects (bug #44211)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19666
diff
changeset
|
1828 if (add_hidden) |
c17e1cefdbd3
Fix reordering graphics property children for hidden objects (bug #44211)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19666
diff
changeset
|
1829 tmp.stack (get_hidden ()); |
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 children_list.clear (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1832 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1833 // 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
|
1834 // 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
|
1835 // the child list directly. |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1836 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1837 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
|
1838 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
|
1839 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1840 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1841 return is_ok; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1842 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1843 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1844 private: |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1845 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
|
1846 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1847 children_list.clear (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1848 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
|
1849 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
|
1850 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1851 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1852 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
|
1853 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1854 children_list.clear (); |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1855 children_list = val; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1856 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1857 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1858 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
|
1859 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1860 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
|
1861 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1862 Matrix retval (children_list.size (), 1); |
21568
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
21562
diff
changeset
|
1863 octave_idx_type i = 0; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1864 |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1865 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
|
1866 retval(i++) = hchild; |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1867 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1868 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1869 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1870 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1871 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
|
1872 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1873 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
|
1874 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1875 if (*it == child) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1876 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
1877 children_list.erase (it); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1878 return true; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1879 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1880 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1881 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1882 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1883 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
1884 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
|
1885 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1886 children_list.push_front (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1887 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
1888 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1889 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
|
1890 }; |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1891 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1892 // --------------------------------------------------------------------- |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
1893 |
7363 | 1894 class callback_property : public base_property |
1895 { | |
1896 public: | |
7364 | 1897 callback_property (const std::string& nm, const graphics_handle& h, |
7363 | 1898 const octave_value& m) |
24071
3f036b46a130
avoid heap-use-after-free in callback execution (bug #52024)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24030
diff
changeset
|
1899 : base_property (nm, h), callback (m) { } |
7363 | 1900 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1901 callback_property (const callback_property& p) |
24071
3f036b46a130
avoid heap-use-after-free in callback execution (bug #52024)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24030
diff
changeset
|
1902 : base_property (p), callback (p.callback) { } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1903 |
7363 | 1904 octave_value get (void) const { return callback; } |
1905 | |
7367 | 1906 OCTINTERP_API void execute (const octave_value& data = octave_value ()) const; |
7363 | 1907 |
10517 | 1908 bool is_defined (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1909 { |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23576
diff
changeset
|
1910 return (callback.is_defined () && ! callback.isempty ()); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1911 } |
10517 | 1912 |
7363 | 1913 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
|
1914 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1915 set (val); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1916 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1917 } |
7363 | 1918 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
1919 base_property * clone (void) const { return new callback_property (*this); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
1920 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1921 protected: |
8063
41bc700ff642
Trigger actions/listeners only for actual property change
Michael Goffioul
parents:
8061
diff
changeset
|
1922 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
|
1923 { |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1924 if (! validate (v)) |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1925 error (R"(invalid value for callback property "%s")", |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1926 get_name ().c_str ()); |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1927 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1928 callback = v; |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
1929 return true; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1930 return false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1931 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
1932 |
7363 | 1933 private: |
1934 OCTINTERP_API bool validate (const octave_value& v) const; | |
1935 | |
1936 private: | |
1937 octave_value callback; | |
1938 }; | |
1939 | |
1940 // --------------------------------------------------------------------- | |
1941 | |
1942 class property | |
1943 { | |
1944 public: | |
1945 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
|
1946 { } |
7363 | 1947 |
1948 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
|
1949 { if (persist) rep->count++; } |
7363 | 1950 |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
1951 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
|
1952 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1953 rep->count++; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1954 } |
7363 | 1955 |
1956 ~property (void) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1957 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1958 if (--rep->count == 0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1959 delete rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1960 } |
7363 | 1961 |
1962 bool ok (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1963 { return rep->ok (); } |
7363 | 1964 |
1965 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
|
1966 { return rep->get_name (); } |
7363 | 1967 |
1968 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
|
1969 { rep->set_name (name); } |
7363 | 1970 |
1971 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
|
1972 { return rep->get_parent (); } |
7363 | 1973 |
1974 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
|
1975 { rep->set_parent (h); } |
7363 | 1976 |
1977 bool is_hidden (void) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1978 { return rep->is_hidden (); } |
7363 | 1979 |
1980 void set_hidden (bool flag) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1981 { rep->set_hidden (flag); } |
7363 | 1982 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
1983 bool is_radio (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1984 { return rep->is_radio (); } |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
1985 |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
1986 int get_id (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1987 { return rep->get_id (); } |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
1988 |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
1989 void set_id (int d) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1990 { rep->set_id (d); } |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
1991 |
7363 | 1992 octave_value get (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1993 { return rep->get (); } |
7363 | 1994 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
1995 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
|
1996 bool do_notify_toolkit = true) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1997 { return rep->set (val, do_run, do_notify_toolkit); } |
7363 | 1998 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
1999 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
|
2000 { return rep->values_as_string (); } |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
2001 |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
2002 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
|
2003 { return rep->values_as_cell (); } |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
2004 |
7363 | 2005 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
|
2006 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2007 *rep = val; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2008 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2009 } |
7363 | 2010 |
2011 property& operator = (const property& p) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2012 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2013 if (rep && --rep->count == 0) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2014 delete rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2015 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2016 rep = p.rep; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2017 rep->count++; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2018 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2019 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2020 } |
7363 | 2021 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2022 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
|
2023 { rep->add_listener (v, mode); } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2024 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2025 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
|
2026 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
|
2027 { 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
|
2028 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2029 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
|
2030 { rep->run_listeners (mode); } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2031 |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
2032 OCTINTERP_API static |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2033 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
|
2034 const caseless_str& type, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2035 const octave_value_list& args); |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
2036 |
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
2037 property clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2038 { return property (rep->clone ()); } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
2039 |
20946 | 2040 #if 0 |
7363 | 2041 const string_property& as_string_property (void) const |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23433
diff
changeset
|
2042 { return *(dynamic_cast<string_property *> (rep)); } |
7363 | 2043 |
2044 const radio_property& as_radio_property (void) const | |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23433
diff
changeset
|
2045 { return *(dynamic_cast<radio_property *> (rep)); } |
7363 | 2046 |
2047 const color_property& as_color_property (void) const | |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23433
diff
changeset
|
2048 { return *(dynamic_cast<color_property *> (rep)); } |
7363 | 2049 |
2050 const double_property& as_double_property (void) const | |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23433
diff
changeset
|
2051 { return *(dynamic_cast<double_property *> (rep)); } |
7363 | 2052 |
2053 const bool_property& as_bool_property (void) const | |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23433
diff
changeset
|
2054 { return *(dynamic_cast<bool_property *> (rep)); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2055 |
7363 | 2056 const handle_property& as_handle_property (void) const |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23433
diff
changeset
|
2057 { return *(dynamic_cast<handle_property *> (rep)); } |
20946 | 2058 #endif |
7363 | 2059 |
2060 private: | |
2061 base_property *rep; | |
2062 }; | |
2063 | |
2064 // --------------------------------------------------------------------- | |
2065 | |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
2066 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
|
2067 |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
2068 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
|
2069 { |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
2070 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
|
2071 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
|
2072 { |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2073 const_iterator it; |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2074 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2075 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
|
2076 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
|
2077 return it; |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2078 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2079 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
|
2080 } |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2081 |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2082 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
|
2083 { |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2084 iterator it; |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2085 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2086 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
|
2087 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
|
2088 return it; |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2089 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2090 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
|
2091 } |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2092 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2093 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
|
2094 { |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2095 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
|
2096 |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2097 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
|
2098 |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2099 if (it != (*this).end ()) |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
2100 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
|
2101 |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2102 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
|
2103 } |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2104 |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2105 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
|
2106 { |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2107 iterator it = find (pname); |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2108 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2109 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
|
2110 { |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2111 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
|
2112 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
|
2113 } |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2114 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2115 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
|
2116 } |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2117 |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2118 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
|
2119 { |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2120 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
|
2121 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
|
2122 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
|
2123 } |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2124 |
19086
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2125 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
|
2126 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
2127 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
|
2128 } |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2129 |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2130 }; |
dc88c5784f74
Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19047
diff
changeset
|
2131 |
7363 | 2132 class property_list |
2133 { | |
2134 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
|
2135 typedef pval_vector pval_map_type; |
7363 | 2136 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
|
2137 |
7363 | 2138 typedef pval_map_type::iterator pval_map_iterator; |
2139 typedef pval_map_type::const_iterator pval_map_const_iterator; | |
2140 | |
2141 typedef plist_map_type::iterator plist_map_iterator; | |
2142 typedef plist_map_type::const_iterator plist_map_const_iterator; | |
2143 | |
2144 property_list (const plist_map_type& m = plist_map_type ()) | |
2145 : plist_map (m) { } | |
2146 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2147 ~property_list (void) = default; |
7363 | 2148 |
2149 void set (const caseless_str& name, const octave_value& val); | |
2150 | |
2151 octave_value lookup (const caseless_str& name) const; | |
2152 | |
2153 plist_map_iterator begin (void) { return plist_map.begin (); } | |
2154 plist_map_const_iterator begin (void) const { return plist_map.begin (); } | |
2155 | |
2156 plist_map_iterator end (void) { return plist_map.end (); } | |
2157 plist_map_const_iterator end (void) const { return plist_map.end (); } | |
2158 | |
2159 plist_map_iterator find (const std::string& go_name) | |
2160 { | |
2161 return plist_map.find (go_name); | |
2162 } | |
2163 | |
2164 plist_map_const_iterator find (const std::string& go_name) const | |
2165 { | |
2166 return plist_map.find (go_name); | |
2167 } | |
2168 | |
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
|
2169 octave_scalar_map as_struct (const std::string& prefix_arg) const; |
7363 | 2170 |
2171 private: | |
2172 plist_map_type plist_map; | |
2173 }; | |
2174 | |
2175 // --------------------------------------------------------------------- | |
2176 | |
6874 | 2177 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
|
2178 class graphics_object; |
6874 | 2179 |
7365 | 2180 class OCTINTERP_API base_properties |
6874 | 2181 { |
2182 public: | |
7176 | 2183 base_properties (const std::string& ty = "unknown", |
7363 | 2184 const graphics_handle& mh = graphics_handle (), |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2185 const graphics_handle& p = graphics_handle ()); |
6874 | 2186 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2187 virtual ~base_properties (void) = default; |
6874 | 2188 |
17625
bd1dd30ed202
graphics.in.h: Correct bad spelling of "unknown" in graphics_object_name().
Rik <rik@octave.org>
parents:
17544
diff
changeset
|
2189 virtual std::string graphics_object_name (void) const { return "unknown"; } |
6874 | 2190 |
2191 void mark_modified (void); | |
2192 | |
2193 void override_defaults (base_graphics_object& obj); | |
2194 | |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
2195 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
|
2196 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2197 panic_impossible (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2198 } |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
2199 |
6874 | 2200 // Look through DEFAULTS for properties with given CLASS_NAME, and |
2201 // apply them to the current object with set (virtual method). | |
2202 | |
2203 void set_from_list (base_graphics_object& obj, property_list& defaults); | |
2204 | |
7363 | 2205 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
|
2206 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2207 p.set_name (name); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2208 p.set_parent (__myhandle__); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2209 all_props[name] = p; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2210 } |
7363 | 2211 |
9972 | 2212 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
|
2213 |
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
9004
diff
changeset
|
2214 virtual octave_value get (const caseless_str& pname) const; |
7363 | 2215 |
9616
2093499ec9f4
avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents:
9585
diff
changeset
|
2216 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
|
2217 { |
2093499ec9f4
avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents:
9585
diff
changeset
|
2218 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
|
2219 } |
2093499ec9f4
avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents:
9585
diff
changeset
|
2220 |
2093499ec9f4
avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents:
9585
diff
changeset
|
2221 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
|
2222 { |
2093499ec9f4
avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents:
9585
diff
changeset
|
2223 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
|
2224 } |
2093499ec9f4
avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents:
9585
diff
changeset
|
2225 |
7379 | 2226 virtual octave_value get (bool all = false) const; |
7363 | 2227 |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
9004
diff
changeset
|
2228 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
|
2229 |
9585
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9582
diff
changeset
|
2230 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
|
2231 { |
06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents:
9582
diff
changeset
|
2232 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
|
2233 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
|
2234 } |
7864
56f781f38f0b
Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7862
diff
changeset
|
2235 |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2236 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
|
2237 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2238 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
|
2239 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2240 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
|
2241 { |
99ef3e58214e
Run children listeners after any adoption/deletion (bug #44242)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19697
diff
changeset
|
2242 children.run_listeners (); |
99ef3e58214e
Run children listeners after any adoption/deletion (bug #44242)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19697
diff
changeset
|
2243 mark_modified (); |
99ef3e58214e
Run children listeners after any adoption/deletion (bug #44242)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19697
diff
changeset
|
2244 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2245 } |
7386 | 2246 |
2247 virtual void adopt (const graphics_handle& h) | |
6874 | 2248 { |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2249 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
|
2250 children.run_listeners (); |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
2251 mark_modified (); |
6874 | 2252 } |
2253 | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2254 virtual graphics_toolkit get_toolkit (void) const; |
7419 | 2255 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2256 virtual Matrix |
20946 | 2257 get_boundingbox (bool /* finternal */ = false, |
2258 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
|
2259 { return Matrix (1, 4, 0.0); } |
7447 | 2260 |
7828
4739b6a1925c
Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7827
diff
changeset
|
2261 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
|
2262 |
12389
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
2263 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
|
2264 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2265 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
|
2266 listener_mode = POSTSET); |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2267 |
8299
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
2268 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
|
2269 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
|
2270 |
7363 | 2271 void set_tag (const octave_value& val) { tag = val; } |
7176 | 2272 |
6874 | 2273 void set_parent (const octave_value& val); |
2274 | |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2275 Matrix get_children (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2276 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2277 return children.get_children (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2278 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2279 |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2280 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
|
2281 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2282 return children.get_all (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2283 } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2284 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2285 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
|
2286 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2287 return children.get_hidden (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2288 } |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2289 |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
2290 void get_children_of_type (const caseless_str& type, bool get_invisible, |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
2291 bool traverse, |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
2292 std::list<graphics_object> &children_list) const; |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
2293 |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2294 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
|
2295 |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2296 void set___modified__ (const octave_value& val) { __modified__ = val; } |
7366 | 2297 |
6874 | 2298 void reparent (const graphics_handle& new_parent) { parent = new_parent; } |
2299 | |
7214 | 2300 // Update data limits for AXIS_TYPE (xdata, ydata, etc.) in the parent |
2301 // axes object. | |
2302 | |
7386 | 2303 virtual void update_axis_limits (const std::string& axis_type) const; |
7214 | 2304 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2305 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
|
2306 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
|
2307 |
20077
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
2308 virtual void update_uicontextmenu (void) const; |
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
2309 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2310 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
|
2311 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2312 children.delete_children (clear); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2313 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2314 |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
2315 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
|
2316 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2317 children.renumber (old_gh, new_gh); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2318 } |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
2319 |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
2320 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
|
2321 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2322 parent = new_gh; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2323 } |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
2324 |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2325 static property_list::pval_map_type factory_defaults (void); |
7222 | 2326 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2327 // 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
|
2328 // genprops.awk script. |
7222 | 2329 // |
2330 // 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
|
2331 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2332 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
|
2333 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
|
2334 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
|
2335 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
|
2336 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
|
2337 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2338 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
|
2339 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
|
2340 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
|
2341 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
|
2342 virtual bool is_zliminclude (void) const { return false; } |
8249 | 2343 |
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
|
2344 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
|
2345 |
9972 | 2346 std::set<std::string> dynamic_property_names (void) const; |
2347 | |
2348 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
|
2349 |
6874 | 2350 protected: |
9972 | 2351 std::set<std::string> dynamic_properties; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2352 |
9972 | 2353 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
|
2354 |
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
9004
diff
changeset
|
2355 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
|
2356 |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2357 octave_value get_dynamic (bool all = false) const; |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2358 |
9185
1e5c11890f85
check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents:
9004
diff
changeset
|
2359 property get_property_dynamic (const caseless_str& pname); |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2360 |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2361 BEGIN_BASE_PROPERTIES |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2362 // properties common to all objects |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2363 bool_property beingdeleted , "off" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2364 radio_property busyaction , "{queue}|cancel" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2365 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
|
2366 children_property children gf , Matrix () |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2367 bool_property clipping , "on" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2368 callback_property createfcn , Matrix () |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2369 callback_property deletefcn , Matrix () |
24395
41cf6ee90cb6
Better handling of "handlevisibility" property (bug #52621).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24277
diff
changeset
|
2370 radio_property handlevisibility u , "{on}|callback|off" |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2371 bool_property hittest , "on" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2372 bool_property interruptible , "on" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2373 handle_property parent fs , p |
24523
501986e12b8b
Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24501
diff
changeset
|
2374 radio_property pickableparts , "{visible}|all|none" |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2375 bool_property selected , "off" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2376 bool_property selectionhighlight , "on" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2377 string_property tag s , "" |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2378 string_property type frs , ty |
20077
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
2379 handle_property uicontextmenu u , graphics_handle () |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2380 any_property userdata , Matrix () |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2381 bool_property visible , "on" |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
2382 |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
2383 // Octave-specific properties |
22665
4ea5b0c3b10f
Make base graphics property __modified__ hidden (bug #49205).
Rik <rik@octave.org>
parents:
22631
diff
changeset
|
2384 bool_property __modified__ hs , "on" |
8061
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2385 graphics_handle __myhandle__ fhrs , mh |
f819e8992367
Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents:
8059
diff
changeset
|
2386 END_PROPERTIES |
7363 | 2387 |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
2388 virtual void update_handlevisibility (void); |
24395
41cf6ee90cb6
Better handling of "handlevisibility" property (bug #52621).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24277
diff
changeset
|
2389 |
7363 | 2390 protected: |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2391 struct cmp_caseless_str |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2392 { |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
2393 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
|
2394 { |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2395 std::string a1 = a; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2396 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
|
2397 std::string b1 = b; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2398 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
|
2399 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2400 return a1 < b1; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2401 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2402 }; |
8052
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
8023
diff
changeset
|
2403 |
961d4c52ffae
Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents:
8023
diff
changeset
|
2404 std::map<caseless_str, property, cmp_caseless_str> all_props; |
7363 | 2405 |
2406 protected: | |
2407 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
|
2408 { insert_property (name, property (&p, true)); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2409 |
22910
23847979b91e
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
2410 virtual void init (void) |
23847979b91e
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
2411 { |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
2412 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
|
2413 } |
6874 | 2414 }; |
2415 | |
7365 | 2416 class OCTINTERP_API base_graphics_object |
6874 | 2417 { |
2418 public: | |
2419 friend class graphics_object; | |
2420 | |
24252
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
2421 base_graphics_object (void) : toolkit_flag (false) { } |
6874 | 2422 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
2423 // No copying! |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
2424 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
2425 base_graphics_object (const base_graphics_object&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
2426 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
2427 base_graphics_object& operator = (const base_graphics_object&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
2428 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2429 virtual ~base_graphics_object (void) = default; |
6874 | 2430 |
2431 virtual void mark_modified (void) | |
2432 { | |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2433 if (! valid_object ()) |
7386 | 2434 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
|
2435 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2436 get_properties ().mark_modified (); |
6874 | 2437 } |
2438 | |
7386 | 2439 virtual void override_defaults (base_graphics_object& obj) |
6874 | 2440 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2441 if (! valid_object ()) |
7386 | 2442 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
|
2443 get_properties ().override_defaults (obj); |
6874 | 2444 } |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
2445 |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23401
diff
changeset
|
2446 void build_user_defaults_map (property_list::pval_map_type& def, |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2447 const std::string go_name) const; |
6874 | 2448 |
7386 | 2449 virtual void set_from_list (property_list& plist) |
6874 | 2450 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2451 if (! valid_object ()) |
7386 | 2452 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
|
2453 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2454 get_properties ().set_from_list (*this, plist); |
6874 | 2455 } |
2456 | |
7386 | 2457 virtual void set (const caseless_str& pname, const octave_value& pval) |
6874 | 2458 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2459 if (! valid_object ()) |
7386 | 2460 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
|
2461 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2462 get_properties ().set (pname, pval); |
6874 | 2463 } |
2464 | |
2465 virtual void set_defaults (const std::string&) | |
2466 { | |
2467 error ("base_graphics_object::set_defaults: invalid graphics object"); | |
2468 } | |
2469 | |
7379 | 2470 virtual octave_value get (bool all = false) const |
6874 | 2471 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2472 if (! valid_object ()) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
2473 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
|
2474 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2475 return get_properties ().get (all); |
6874 | 2476 } |
2477 | |
7386 | 2478 virtual octave_value get (const caseless_str& pname) const |
6874 | 2479 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2480 if (! valid_object ()) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
2481 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
|
2482 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2483 return get_properties ().get (pname); |
6874 | 2484 } |
2485 | |
7189 | 2486 virtual octave_value get_default (const caseless_str&) const; |
6874 | 2487 |
7189 | 2488 virtual octave_value get_factory_default (const caseless_str&) const; |
6874 | 2489 |
2490 virtual octave_value get_defaults (void) const | |
2491 { | |
2492 error ("base_graphics_object::get_defaults: invalid graphics object"); | |
2493 } | |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
2494 |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2495 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
|
2496 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2497 if (! valid_object ()) |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2498 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
|
2499 |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2500 return property_list (); |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2501 } |
6874 | 2502 |
2503 virtual octave_value get_factory_defaults (void) const | |
2504 { | |
2505 error ("base_graphics_object::get_factory_defaults: invalid graphics object"); | |
2506 } | |
2507 | |
18963
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
2508 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
|
2509 { |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
2510 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
|
2511 } |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
2512 |
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
|
2513 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
|
2514 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
2515 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
|
2516 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
2517 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
2518 virtual std::string values_as_string (void); |
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
2519 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
2520 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
|
2521 |
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
|
2522 virtual octave_scalar_map values_as_struct (void); |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
2523 |
6874 | 2524 virtual graphics_handle get_parent (void) const |
2525 { | |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2526 if (! valid_object ()) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
2527 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
|
2528 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2529 return get_properties ().get_parent (); |
6874 | 2530 } |
2531 | |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
2532 graphics_handle get_handle (void) const |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
2533 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2534 if (! valid_object ()) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
2535 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
|
2536 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2537 return get_properties ().get___myhandle__ (); |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
2538 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
2539 |
7386 | 2540 virtual void remove_child (const graphics_handle& h) |
6874 | 2541 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2542 if (! valid_object ()) |
7386 | 2543 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
|
2544 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2545 get_properties ().remove_child (h); |
6874 | 2546 } |
2547 | |
7386 | 2548 virtual void adopt (const graphics_handle& h) |
6874 | 2549 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2550 if (! valid_object ()) |
7386 | 2551 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
|
2552 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2553 get_properties ().adopt (h); |
6874 | 2554 } |
2555 | |
7386 | 2556 virtual void reparent (const graphics_handle& np) |
6874 | 2557 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2558 if (! valid_object ()) |
7386 | 2559 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
|
2560 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2561 get_properties ().reparent (np); |
6874 | 2562 } |
2563 | |
2564 virtual void defaults (void) const | |
2565 { | |
20962
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
2566 if (! valid_object ()) |
7386 | 2567 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
|
2568 |
3aa293be0e8d
maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
2569 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
|
2570 err_not_implemented (msg.c_str ()); |
6874 | 2571 } |
2572 | |
2573 virtual base_properties& get_properties (void) | |
2574 { | |
2575 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
|
2576 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
|
2577 return properties; |
6874 | 2578 } |
2579 | |
7222 | 2580 virtual const base_properties& get_properties (void) const |
2581 { | |
2582 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
|
2583 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
|
2584 return properties; |
7222 | 2585 } |
2586 | |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
2587 virtual void update_axis_limits (const std::string& axis_type); |
7214 | 2588 |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2589 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
|
2590 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
|
2591 |
6874 | 2592 virtual bool valid_object (void) const { return false; } |
2593 | |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2594 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
|
2595 |
7386 | 2596 virtual std::string type (void) const |
2597 { | |
2598 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
|
2599 : "unknown"); |
7386 | 2600 } |
6874 | 2601 |
2602 bool isa (const std::string& go_name) const | |
2603 { | |
2604 return type () == go_name; | |
2605 } | |
2606 | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2607 virtual graphics_toolkit get_toolkit (void) const |
7419 | 2608 { |
20976
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2609 if (! valid_object ()) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
2610 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
|
2611 |
0fd972b06a6f
maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20962
diff
changeset
|
2612 return get_properties ().get_toolkit (); |
7419 | 2613 } |
2614 | |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2615 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
|
2616 const octave_value& v, |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2617 listener_mode mode = POSTSET) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2618 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2619 if (valid_object ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2620 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
|
2621 } |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2622 |
8299
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
2623 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
|
2624 const octave_value& v, |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2625 listener_mode mode = POSTSET) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2626 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2627 if (valid_object ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2628 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
|
2629 } |
8299
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
2630 |
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
2631 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
|
2632 |
18963
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
2633 virtual void reset_default_properties (void); |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
2634 |
6874 | 2635 protected: |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2636 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
|
2637 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2638 if (! toolkit_flag) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2639 toolkit_flag = get_toolkit ().initialize (go); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2640 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2641 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2642 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
|
2643 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2644 if (toolkit_flag) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2645 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2646 get_toolkit ().finalize (go); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2647 toolkit_flag = false; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2648 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2649 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2650 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2651 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
|
2652 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2653 if (toolkit_flag) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2654 get_toolkit ().update (go, id); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2655 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2656 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2657 protected: |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
2658 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2659 // 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
|
2660 // 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
|
2661 bool toolkit_flag; |
6874 | 2662 }; |
2663 | |
7365 | 2664 class OCTINTERP_API graphics_object |
6874 | 2665 { |
2666 public: | |
24252
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
2667 |
6874 | 2668 graphics_object (void) : rep (new base_graphics_object ()) { } |
2669 | |
24252
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
2670 graphics_object (base_graphics_object *new_rep) : rep (new_rep) { } |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
2671 |
24991
831389905438
omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents:
24795
diff
changeset
|
2672 graphics_object (const graphics_object&) = default; |
831389905438
omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents:
24795
diff
changeset
|
2673 |
831389905438
omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents:
24795
diff
changeset
|
2674 graphics_object& operator = (const graphics_object&) = default; |
24252
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
2675 |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
2676 ~graphics_object (void) = default; |
6874 | 2677 |
2678 void mark_modified (void) { rep->mark_modified (); } | |
2679 | |
2680 void override_defaults (base_graphics_object& obj) | |
2681 { | |
2682 rep->override_defaults (obj); | |
2683 } | |
2684 | |
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
|
2685 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
|
2686 { |
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
2687 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
|
2688 } |
10600b2dd3c1
make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents:
20045
diff
changeset
|
2689 |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23401
diff
changeset
|
2690 void build_user_defaults_map (property_list::pval_map_type& def, |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2691 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
|
2692 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2693 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
|
2694 } |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2695 |
7214 | 2696 void set_from_list (property_list& plist) { rep->set_from_list (plist); } |
6874 | 2697 |
7189 | 2698 void set (const caseless_str& name, const octave_value& val) |
6874 | 2699 { |
2700 rep->set (name, val); | |
2701 } | |
2702 | |
2703 void set (const octave_value_list& args); | |
2704 | |
10056
33ba83a06a42
Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
9972
diff
changeset
|
2705 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
|
2706 octave_idx_type row); |
33ba83a06a42
Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
9972
diff
changeset
|
2707 |
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
|
2708 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
|
2709 |
33ba83a06a42
Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
9972
diff
changeset
|
2710 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
|
2711 const octave_value& val); |
33ba83a06a42
Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
9972
diff
changeset
|
2712 |
7214 | 2713 void set_defaults (const std::string& mode) { rep->set_defaults (mode); } |
2714 | |
7379 | 2715 octave_value get (bool all = false) const { return rep->get (all); } |
6874 | 2716 |
7189 | 2717 octave_value get (const caseless_str& name) const |
6874 | 2718 { |
2719 return name.compare ("default") | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2720 ? get_defaults () |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2721 : (name.compare ("factory") |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2722 ? get_factory_defaults () : rep->get (name)); |
6874 | 2723 } |
2724 | |
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
|
2725 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
|
2726 { |
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
|
2727 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
|
2728 } |
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
|
2729 |
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
|
2730 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
|
2731 { |
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
|
2732 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
|
2733 } |
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
|
2734 |
7189 | 2735 octave_value get_default (const caseless_str& name) const |
6874 | 2736 { |
2737 return rep->get_default (name); | |
2738 } | |
2739 | |
7189 | 2740 octave_value get_factory_default (const caseless_str& name) const |
6874 | 2741 { |
2742 return rep->get_factory_default (name); | |
2743 } | |
2744 | |
2745 octave_value get_defaults (void) const { return rep->get_defaults (); } | |
2746 | |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2747 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
|
2748 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2749 return rep->get_defaults_list (); |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2750 } |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
2751 |
6874 | 2752 octave_value get_factory_defaults (void) const |
2753 { | |
2754 return rep->get_factory_defaults (); | |
2755 } | |
2756 | |
18963
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
2757 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
|
2758 { |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
2759 return rep->get_factory_defaults_list (); |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
2760 } |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
2761 |
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
|
2762 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
|
2763 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
2764 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
|
2765 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
2766 |
10717
9d4a198614ab
Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents:
10596
diff
changeset
|
2767 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
|
2768 |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2769 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
|
2770 { |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
2771 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
|
2772 } |
ca84d3c9dc24
set: allow retrieving allowed values for individual properties
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
17822
diff
changeset
|
2773 |
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
|
2774 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
|
2775 |
6874 | 2776 graphics_handle get_parent (void) const { return rep->get_parent (); } |
2777 | |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
2778 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
|
2779 |
11250
830b940e7ff4
Turn xget_ancestor into regular API
Michael Goffioul <michael.goffioul@gmail.com>
parents:
11247
diff
changeset
|
2780 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
|
2781 |
7214 | 2782 void remove_child (const graphics_handle& h) { rep->remove_child (h); } |
2783 | |
2784 void adopt (const graphics_handle& h) { rep->adopt (h); } | |
2785 | |
2786 void reparent (const graphics_handle& h) { rep->reparent (h); } | |
6874 | 2787 |
2788 void defaults (void) const { rep->defaults (); } | |
2789 | |
2790 bool isa (const std::string& go_name) const { return rep->isa (go_name); } | |
2791 | |
2792 base_properties& get_properties (void) { return rep->get_properties (); } | |
2793 | |
7222 | 2794 const base_properties& get_properties (void) const |
2795 { | |
2796 return rep->get_properties (); | |
2797 } | |
2798 | |
7214 | 2799 void update_axis_limits (const std::string& axis_type) |
2800 { | |
2801 rep->update_axis_limits (axis_type); | |
2802 } | |
2803 | |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2804 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
|
2805 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
|
2806 { |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2807 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
|
2808 } |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
2809 |
6874 | 2810 bool valid_object (void) const { return rep->valid_object (); } |
2811 | |
8208 | 2812 std::string type (void) const { return rep->type (); } |
2813 | |
6874 | 2814 operator bool (void) const { return rep->valid_object (); } |
2815 | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2816 // 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
|
2817 // genprops.awk script. |
7222 | 2818 // |
2819 // 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
|
2820 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2821 octave_value get_alim (void) const |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2822 { return get_properties ().get_alim (); } |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2823 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2824 octave_value get_clim (void) const |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2825 { return get_properties ().get_clim (); } |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2826 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
2827 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
|
2828 { 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
|
2829 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
2830 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
|
2831 { return get_properties ().get_ylim (); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2832 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
2833 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
|
2834 { return get_properties ().get_zlim (); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2835 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2836 bool is_aliminclude (void) const |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2837 { return get_properties ().is_aliminclude (); } |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2838 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2839 bool is_climinclude (void) const |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2840 { 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
|
2841 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
2842 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
|
2843 { return get_properties ().is_xliminclude (); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2844 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
2845 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
|
2846 { return get_properties ().is_yliminclude (); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2847 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
2848 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
|
2849 { return get_properties ().is_zliminclude (); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2850 |
8249 | 2851 bool is_handle_visible (void) const |
2852 { return get_properties ().is_handle_visible (); } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
2853 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2854 graphics_toolkit get_toolkit (void) const { return rep->get_toolkit (); } |
7408 | 2855 |
7849
3249f64f69b2
Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7848
diff
changeset
|
2856 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
|
2857 listener_mode mode = POSTSET) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2858 { 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
|
2859 |
8299
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
2860 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
|
2861 listener_mode mode = POSTSET) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
2862 { rep->delete_property_listener (nm, v, mode); } |
25436
996d78102a71
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25431
diff
changeset
|
2863 |
25431
6782d1f0fe54
Delete listeners before invalidating graphics object.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25429
diff
changeset
|
2864 void remove_all_listeners (void) { rep->remove_all_listeners (); } |
8299
be9b14945774
Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents:
8291
diff
changeset
|
2865 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2866 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
|
2867 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2868 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
|
2869 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
2870 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
|
2871 |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
2872 void reset_default_properties (void) |
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
2873 { rep->reset_default_properties (); } |
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
2874 |
7408 | 2875 private: |
24252
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
2876 |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
2877 std::shared_ptr<base_graphics_object> rep; |
7408 | 2878 }; |
2879 | |
2880 // --------------------------------------------------------------------- | |
2881 | |
7365 | 2882 class OCTINTERP_API root_figure : public base_graphics_object |
6874 | 2883 { |
2884 public: | |
23763
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2885 |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2886 // The gh_manager constructor creates the single instance of |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2887 // the root_figure object. |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2888 |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2889 friend class gh_manager; |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2890 |
7821
f79dcba526a8
Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7527
diff
changeset
|
2891 class OCTINTERP_API properties : public base_properties |
6874 | 2892 { |
2893 public: | |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
2894 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
|
2895 |
14357
e7c74f56cd03
fltk toolkit requires figure units to be "pixels". Bug # 35430.
Ben Abbott <bpabbott@mac.com>
parents:
14324
diff
changeset
|
2896 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
|
2897 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
|
2898 |
6874 | 2899 // See the genprops.awk script for an explanation of the |
2900 // properties declarations. | |
2901 | |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
2902 // 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
|
2903 // monitorpositions, pointerlocation, pointerwindow. |
18764
89448a7523b2
Add some more callbacks for root properties (bug #42347).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18737
diff
changeset
|
2904 // 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
|
2905 // them will have no effect. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2906 |
20459
564e59f75ef8
Remove obsolete properties from root figure object.
Rik <rik@octave.org>
parents:
20428
diff
changeset
|
2907 // 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
|
2908 // 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
|
2909 // 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
|
2910 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
2911 // Programming note: Keep property list sorted if new ones are added. |
9778 | 2912 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
2913 BEGIN_PROPERTIES (root_figure, root) |
9778 | 2914 handle_property callbackobject Sr , graphics_handle () |
2915 array_property commandwindowsize r , Matrix (1, 2, 0) | |
7363 | 2916 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
|
2917 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
|
2918 array_property monitorpositions r , default_screensize () |
10949
848f3a13b7cf
Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents:
10948
diff
changeset
|
2919 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
|
2920 double_property pointerwindow r , 0.0 |
8560
5cc594679cdc
get display characteristics from system
John W. Eaton <jwe@octave.org>
parents:
8465
diff
changeset
|
2921 double_property screendepth r , default_screendepth () |
9778 | 2922 double_property screenpixelsperinch r , default_screenpixelsperinch () |
10949
848f3a13b7cf
Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents:
10948
diff
changeset
|
2923 array_property screensize r , default_screensize () |
9778 | 2924 bool_property showhiddenhandles , "off" |
25903
06c41d1ae5b1
Allow 'characters' as a value for the Units property of root object (bug #54742).
Rik <rik@octave.org>
parents:
25891
diff
changeset
|
2925 radio_property units U , "{pixels}|inches|centimeters|points|normalized|characters" |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
2926 // Hide base properties which don't make sense for root object |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
2927 //radio_property beingdeleted h , "{off}|on" |
6874 | 2928 END_PROPERTIES |
7822
edbaa13397ee
Implement callbackobject property in root object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7821
diff
changeset
|
2929 |
edbaa13397ee
Implement callbackobject property in root object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7821
diff
changeset
|
2930 private: |
edbaa13397ee
Implement callbackobject property in root object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7821
diff
changeset
|
2931 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
|
2932 |
6874 | 2933 }; |
2934 | |
2935 private: | |
23763
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2936 |
6874 | 2937 properties xproperties; |
2938 | |
23763
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2939 protected: |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2940 |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2941 root_figure (void) |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2942 : xproperties (0, graphics_handle ()), default_properties (), |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2943 factory_properties (init_factory_properties ()) |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2944 { } |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2945 |
6874 | 2946 public: |
2947 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
2948 ~root_figure (void) = default; |
6874 | 2949 |
23763
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2950 root_figure (const root_figure&) = delete; |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2951 |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2952 root_figure& operator = (const root_figure&) = delete; |
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
2953 |
6874 | 2954 void mark_modified (void) { } |
2955 | |
2956 void override_defaults (base_graphics_object& obj) | |
2957 { | |
2958 // Now override with our defaults. If the default_properties | |
2959 // list includes the properties for all defaults (line, | |
2960 // surface, etc.) then we don't have to know the type of OBJ | |
2961 // here, we just call its set function and let it decide which | |
2962 // properties from the list to use. | |
2963 obj.set_from_list (default_properties); | |
2964 } | |
2965 | |
7189 | 2966 void set (const caseless_str& name, const octave_value& value) |
6874 | 2967 { |
2968 if (name.compare ("default", 7)) | |
2969 // strip "default", pass rest to function that will | |
2970 // parse the remainder and add the element to the | |
2971 // default_properties map. | |
2972 default_properties.set (name.substr (7), value); | |
2973 else | |
2974 xproperties.set (name, value); | |
2975 } | |
2976 | |
7189 | 2977 octave_value get (const caseless_str& name) const |
6874 | 2978 { |
2979 octave_value retval; | |
2980 | |
2981 if (name.compare ("default", 7)) | |
2982 return get_default (name.substr (7)); | |
2983 else if (name.compare ("factory", 7)) | |
2984 return get_factory_default (name.substr (7)); | |
2985 else | |
2986 retval = xproperties.get (name); | |
2987 | |
2988 return retval; | |
2989 } | |
2990 | |
7189 | 2991 octave_value get_default (const caseless_str& name) const |
6874 | 2992 { |
2993 octave_value retval = default_properties.lookup (name); | |
2994 | |
2995 if (retval.is_undefined ()) | |
7847
40b16e04172a
Make backend switching work.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7846
diff
changeset
|
2996 { |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2997 // no default property found, use factory default |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2998 retval = factory_properties.lookup (name); |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
2999 |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
3000 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
|
3001 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
|
3002 } |
6874 | 3003 |
3004 return retval; | |
3005 } | |
3006 | |
7189 | 3007 octave_value get_factory_default (const caseless_str& name) const |
6874 | 3008 { |
3009 octave_value retval = factory_properties.lookup (name); | |
3010 | |
3011 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
|
3012 error ("get: invalid factory default property '%s'", name.c_str ()); |
6874 | 3013 |
3014 return retval; | |
3015 } | |
3016 | |
3017 octave_value get_defaults (void) const | |
3018 { | |
3019 return default_properties.as_struct ("default"); | |
3020 } | |
3021 | |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3022 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
|
3023 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3024 return default_properties; |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3025 } |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3026 |
6874 | 3027 octave_value get_factory_defaults (void) const |
3028 { | |
3029 return factory_properties.as_struct ("factory"); | |
3030 } | |
3031 | |
18963
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
3032 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
|
3033 { |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
3034 return factory_properties; |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
3035 } |
a30e1d20fd3c
Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents:
18961
diff
changeset
|
3036 |
6874 | 3037 base_properties& get_properties (void) { return xproperties; } |
3038 | |
7222 | 3039 const base_properties& get_properties (void) const { return xproperties; } |
3040 | |
6874 | 3041 bool valid_object (void) const { return true; } |
3042 | |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
3043 void reset_default_properties (void); |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
3044 |
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
|
3045 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
|
3046 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
3047 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
|
3048 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
|
3049 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
|
3050 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
|
3051 } |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
3052 |
6874 | 3053 private: |
23763
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
3054 |
6874 | 3055 property_list default_properties; |
3056 | |
23763
54aa9a3250b4
make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents:
23639
diff
changeset
|
3057 property_list factory_properties; |
6874 | 3058 |
3059 static property_list::plist_map_type init_factory_properties (void); | |
3060 }; | |
3061 | |
3062 // --------------------------------------------------------------------- | |
3063 | |
7365 | 3064 class OCTINTERP_API figure : public base_graphics_object |
6874 | 3065 { |
3066 public: | |
7445 | 3067 class OCTINTERP_API properties : public base_properties |
6874 | 3068 { |
3069 public: | |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
3070 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
|
3071 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3072 integerhandle = val; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3073 } |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
3074 |
8266
81b124f463f9
properly update currentaxes when axes are deleted
John W. Eaton <jwe@octave.org>
parents:
8263
diff
changeset
|
3075 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
|
3076 |
7366 | 3077 void set_visible (const octave_value& val); |
6874 | 3078 |
23774
41795b504a8b
don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents:
23763
diff
changeset
|
3079 graphics_toolkit get_toolkit (void) const; |
7408 | 3080 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3081 void set_toolkit (const graphics_toolkit& b); |
7439 | 3082 |
23774
41795b504a8b
don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents:
23763
diff
changeset
|
3083 void set___graphics_toolkit__ (const octave_value& val); |
7408 | 3084 |
19044
4c59f69fa52c
figure: define adopted axes "currentaxes" if none is defined (bug #41573)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19021
diff
changeset
|
3085 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
|
3086 |
13713
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3087 void set_position (const octave_value& val, |
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3088 bool do_notify_toolkit = true); |
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3089 |
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3090 void set_outerposition (const octave_value& val, |
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3091 bool do_notify_toolkit = true); |
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3092 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3093 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
|
3094 const Matrix& parent_pix_size = Matrix ()) const; |
7445 | 3095 |
13713
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3096 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
|
3097 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
|
3098 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3099 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
|
3100 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3101 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
|
3102 |
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
|
3103 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
|
3104 |
9d3a7ad94ee6
Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents:
10990
diff
changeset
|
3105 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
|
3106 |
8059
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
3107 std::string get_title (void) const; |
75c99d3f97d7
Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents:
8058
diff
changeset
|
3108 |
6874 | 3109 // See the genprops.awk script for an explanation of the |
3110 // properties declarations. | |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3111 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3112 // Programming note: Keep property list sorted if new ones are added. |
6874 | 3113 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
3114 BEGIN_PROPERTIES (figure) |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3115 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
|
3116 callback_property buttondownfcn , Matrix () |
7363 | 3117 callback_property closerequestfcn , "closereq" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3118 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
|
3119 array_property colormap , viridis_colormap () |
7363 | 3120 handle_property currentaxes S , graphics_handle () |
7405 | 3121 string_property currentcharacter r , "" |
3122 handle_property currentobject r , graphics_handle () | |
10517 | 3123 array_property currentpoint r , Matrix (2, 1, 0) |
7405 | 3124 bool_property dockcontrols , "off" |
11247
29b1f7d68665
make filename property of figure objects writable
John W. Eaton <jwe@octave.org>
parents:
11175
diff
changeset
|
3125 string_property filename , "" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3126 bool_property graphicssmoothing , "on" |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
3127 bool_property integerhandle S , "on" |
21323
030d4d6c2b58
Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents:
21289
diff
changeset
|
3128 bool_property inverthardcopy , "on" |
7405 | 3129 callback_property keypressfcn , Matrix () |
3130 callback_property keyreleasefcn , Matrix () | |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3131 radio_property menubar , "{figure}|none" |
7405 | 3132 string_property name , "" |
25273
ac6ba9f2fa41
Add new Figure graphic property "Number" (bug #53343).
Rik <rik@octave.org>
parents:
25173
diff
changeset
|
3133 array_property number rG , Matrix () |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3134 radio_property nextplot , "{add}|new|replace|replacechildren" |
7405 | 3135 bool_property numbertitle , "on" |
13713
d99aa455296e
Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
3136 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
|
3137 radio_property paperorientation U , "{portrait}|landscape" |
18773
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3138 array_property paperposition m , default_figure_paperposition () |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3139 // 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
|
3140 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
|
3141 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
|
3142 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
|
3143 radio_property paperunits Su , "{inches}|centimeters|normalized|points" |
7405 | 3144 radio_property pointer , "crosshair|fullcrosshair|{arrow}|ibeam|watch|topl|topr|botl|botr|left|top|right|bottom|circle|cross|fleur|custom|hand" |
3145 array_property pointershapecdata , Matrix (16, 16, 0) | |
3146 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
|
3147 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
|
3148 radio_property renderer m , "{opengl}|painters" |
7405 | 3149 radio_property renderermode , "{auto}|manual" |
3150 bool_property resize , "on" | |
21992
03c692adf563
maint: strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents:
21952
diff
changeset
|
3151 // FIXME: resizefcn has been deprecated by Matlab, and |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3152 // replaced with sizechangedfcn |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3153 // Eventually this will need to be hidden, and then removed. |
7405 | 3154 callback_property resizefcn , Matrix () |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3155 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
|
3156 callback_property sizechangedfcn , Matrix () |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3157 radio_property toolbar , "{auto}|figure|none" |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3158 radio_property units Su , "{pixels}|normalized|inches|centimeters|points|characters" |
7405 | 3159 callback_property windowbuttondownfcn , Matrix () |
3160 callback_property windowbuttonmotionfcn , Matrix () | |
3161 callback_property windowbuttonupfcn , Matrix () | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3162 callback_property windowkeypressfcn , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3163 callback_property windowkeyreleasefcn , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3164 callback_property windowscrollwheelfcn , Matrix () |
7405 | 3165 radio_property windowstyle , "{normal}|modal|docked" |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
3166 |
24687
8b935067a257
Allow printing without updating qt visible or invisible figures (bug #52940).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24637
diff
changeset
|
3167 // Overridden base property |
24637
3d78a7eb5aa4
Make "PickableParts" property for figures the fixed value of "visible".
Rik <rik@octave.org>
parents:
24635
diff
changeset
|
3168 // Property is not implemented for figures. |
3d78a7eb5aa4
Make "PickableParts" property for figures the fixed value of "visible".
Rik <rik@octave.org>
parents:
24635
diff
changeset
|
3169 // Hide it and set it to a default value that works. |
3d78a7eb5aa4
Make "PickableParts" property for figures the fixed value of "visible".
Rik <rik@octave.org>
parents:
24635
diff
changeset
|
3170 radio_property pickableparts h , "{visible}" |
3d78a7eb5aa4
Make "PickableParts" property for figures the fixed value of "visible".
Rik <rik@octave.org>
parents:
24635
diff
changeset
|
3171 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3172 // Octave-specific properties |
21684
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
21659
diff
changeset
|
3173 mutable string_property __gl_extensions__ hr , "" |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
21659
diff
changeset
|
3174 mutable string_property __gl_renderer__ hr , "" |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
21659
diff
changeset
|
3175 mutable string_property __gl_vendor__ hr , "" |
1449e3b98941
store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents:
21659
diff
changeset
|
3176 mutable string_property __gl_version__ hr , "" |
24687
8b935067a257
Allow printing without updating qt visible or invisible figures (bug #52940).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24637
diff
changeset
|
3177 bool_property __gl_window__ h , "off" |
23774
41795b504a8b
don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents:
23763
diff
changeset
|
3178 string_property __graphics_toolkit__ hs , default_graphics_toolkit () |
13699
dd9b32af0a01
Implement guidata/guihandles.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13324
diff
changeset
|
3179 any_property __guidata__ h , Matrix () |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3180 radio_property __mouse_mode__ hS , "{none}|pan|rotate|select|text|zoom" |
24687
8b935067a257
Allow printing without updating qt visible or invisible figures (bug #52940).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24637
diff
changeset
|
3181 bool_property __printing__ h , "off" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3182 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
|
3183 any_property __plot_stream__ h , Matrix () |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3184 any_property __rotate_mode__ h , Matrix () |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3185 any_property __zoom_mode__ h , Matrix () |
25884
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25867
diff
changeset
|
3186 double_property __device_pixel_ratio__ hU , 1.0 |
21948
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3187 |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3188 // Obsolete properties: doublebuffer, mincolormap, wvisual, wvisualmode, |
241d39c66e8f
Update graphics properties for figure object.
Rik <rik@octave.org>
parents:
21905
diff
changeset
|
3189 // xdisplay, xvisual, xvisualmode |
25172
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
3190 // FIXME: DEPRECATED: Remove in version 5. |
23201
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23124
diff
changeset
|
3191 bool_property doublebuffer hd , "on" |
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23124
diff
changeset
|
3192 double_property mincolormap hd , 64 |
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23124
diff
changeset
|
3193 string_property wvisual hmd , "" |
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23124
diff
changeset
|
3194 radio_property wvisualmode hd , "{auto}|manual" |
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23124
diff
changeset
|
3195 string_property xdisplay hd , "" |
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23124
diff
changeset
|
3196 string_property xvisual hmd , "" |
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23124
diff
changeset
|
3197 radio_property xvisualmode hd , "{auto}|manual" |
6874 | 3198 END_PROPERTIES |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
3199 |
7363 | 3200 protected: |
3201 void init (void) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3202 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3203 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
|
3204 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
|
3205 outerposition.add_constraint (dim_vector (1, 4)); |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
3206 outerposition.add_constraint (FINITE); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3207 paperposition.add_constraint (dim_vector (1, 4)); |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
3208 paperposition.add_constraint (FINITE); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3209 papersize.add_constraint (dim_vector (1, 2)); |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
3210 papersize.add_constraint (FINITE); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3211 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
|
3212 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
|
3213 position.add_constraint (dim_vector (1, 4)); |
23124
9e54152e382b
Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23116
diff
changeset
|
3214 position.add_constraint (FINITE); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3215 } |
7408 | 3216 |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
3217 private: |
18773
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3218 Matrix get_auto_paperposition (void); |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3219 |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3220 void update_paperpositionmode (void) |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3221 { |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3222 if (paperpositionmode.is ("auto")) |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3223 paperposition.set (get_auto_paperposition ()); |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3224 } |
70ea5a2856fe
Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18766
diff
changeset
|
3225 |
24395
41cf6ee90cb6
Better handling of "handlevisibility" property (bug #52621).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24277
diff
changeset
|
3226 void update_handlevisibility (void); |
41cf6ee90cb6
Better handling of "handlevisibility" property (bug #52621).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24277
diff
changeset
|
3227 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3228 mutable graphics_toolkit toolkit; |
6874 | 3229 }; |
3230 | |
3231 private: | |
3232 properties xproperties; | |
3233 | |
3234 public: | |
3235 figure (const graphics_handle& mh, const graphics_handle& p) | |
3236 : 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
|
3237 { } |
6874 | 3238 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3239 ~figure (void) = default; |
6874 | 3240 |
3241 void override_defaults (base_graphics_object& obj) | |
3242 { | |
3243 // Allow parent (root figure) to override first (properties knows how | |
3244 // to find the parent object). | |
3245 xproperties.override_defaults (obj); | |
3246 | |
3247 // Now override with our defaults. If the default_properties | |
3248 // list includes the properties for all defaults (line, | |
3249 // surface, etc.) then we don't have to know the type of OBJ | |
3250 // here, we just call its set function and let it decide which | |
3251 // properties from the list to use. | |
3252 obj.set_from_list (default_properties); | |
3253 } | |
3254 | |
7189 | 3255 void set (const caseless_str& name, const octave_value& value) |
6874 | 3256 { |
3257 if (name.compare ("default", 7)) | |
3258 // strip "default", pass rest to function that will | |
3259 // parse the remainder and add the element to the | |
3260 // default_properties map. | |
3261 default_properties.set (name.substr (7), value); | |
3262 else | |
3263 xproperties.set (name, value); | |
3264 } | |
3265 | |
7189 | 3266 octave_value get (const caseless_str& name) const |
6874 | 3267 { |
3268 octave_value retval; | |
3269 | |
3270 if (name.compare ("default", 7)) | |
3271 retval = get_default (name.substr (7)); | |
3272 else | |
3273 retval = xproperties.get (name); | |
3274 | |
3275 return retval; | |
3276 } | |
3277 | |
7189 | 3278 octave_value get_default (const caseless_str& name) const; |
6874 | 3279 |
3280 octave_value get_defaults (void) const | |
3281 { | |
3282 return default_properties.as_struct ("default"); | |
3283 } | |
3284 | |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3285 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
|
3286 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3287 return default_properties; |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3288 } |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
3289 |
6874 | 3290 base_properties& get_properties (void) { return xproperties; } |
3291 | |
7222 | 3292 const base_properties& get_properties (void) const { return xproperties; } |
3293 | |
6874 | 3294 bool valid_object (void) const { return true; } |
3295 | |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
3296 void reset_default_properties (void); |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
3297 |
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
|
3298 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
|
3299 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
3300 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
|
3301 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
|
3302 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
|
3303 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
|
3304 } |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
3305 |
6874 | 3306 private: |
3307 property_list default_properties; | |
3308 }; | |
3309 | |
3310 // --------------------------------------------------------------------- | |
3311 | |
7435 | 3312 class OCTINTERP_API graphics_xform |
3313 { | |
3314 public: | |
3315 graphics_xform (void) | |
12174 | 3316 : xform (xform_eye ()), xform_inv (xform_eye ()), |
12164
18e9a8da7d18
eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
12126
diff
changeset
|
3317 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
|
3318 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3319 zlim(1) = 1.0; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3320 } |
7435 | 3321 |
3322 graphics_xform (const Matrix& xm, const Matrix& xim, | |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
3323 const scaler& x, const scaler& y, const scaler& z, |
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
3324 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
|
3325 : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { } |
7435 | 3326 |
3327 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
|
3328 : 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
|
3329 sy (g.sy), sz (g.sz), zlim (g.zlim) { } |
7435 | 3330 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
3331 ~graphics_xform (void) = default; |
7435 | 3332 |
3333 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
|
3334 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3335 xform = g.xform; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3336 xform_inv = g.xform_inv; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3337 sx = g.sx; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3338 sy = g.sy; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3339 sz = g.sz; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3340 zlim = g.zlim; |
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 return *this; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3343 } |
7435 | 3344 |
3345 static ColumnVector xform_vector (double x, double y, double z); | |
3346 | |
3347 static Matrix xform_eye (void); | |
3348 | |
3349 ColumnVector transform (double x, double y, double z, | |
10553 | 3350 bool use_scale = true) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
3351 |
7435 | 3352 ColumnVector untransform (double x, double y, double z, |
10553 | 3353 bool use_scale = true) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
3354 |
10553 | 3355 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
|
3356 { return untransform (x, y, (zlim(0)+zlim(1))/2, use_scale); } |
7435 | 3357 |
3358 Matrix xscale (const Matrix& m) const { return sx.scale (m); } | |
3359 Matrix yscale (const Matrix& m) const { return sy.scale (m); } | |
3360 Matrix zscale (const Matrix& m) const { return sz.scale (m); } | |
3361 | |
7832
e06fdf7ea647
Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7830
diff
changeset
|
3362 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
|
3363 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3364 bool has_z = (m.columns () > 2); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3365 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3366 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
|
3367 && (! has_z || sz.is_linear ())) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3368 return m; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3369 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3370 Matrix retval (m.dims ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3371 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3372 int r = m.rows (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3373 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3374 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
|
3375 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3376 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
|
3377 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
|
3378 if (has_z) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3379 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
|
3380 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3381 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3382 return retval; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3383 } |
7832
e06fdf7ea647
Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7830
diff
changeset
|
3384 |
7435 | 3385 private: |
3386 Matrix xform; | |
3387 Matrix xform_inv; | |
3388 scaler sx, sy, sz; | |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
3389 Matrix zlim; |
7435 | 3390 }; |
3391 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3392 enum |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3393 { |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3394 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
|
3395 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
|
3396 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
|
3397 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
|
3398 }; |
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3399 |
7365 | 3400 class OCTINTERP_API axes : public base_graphics_object |
6874 | 3401 { |
3402 public: | |
7445 | 3403 class OCTINTERP_API properties : public base_properties |
6874 | 3404 { |
3405 public: | |
3406 void set_defaults (base_graphics_object& obj, const std::string& mode); | |
3407 | |
3408 void remove_child (const graphics_handle& h); | |
3409 | |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3410 void adopt (const graphics_handle& h); |
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3411 |
7427 | 3412 const scaler& get_x_scaler (void) const { return sx; } |
3413 const scaler& get_y_scaler (void) const { return sy; } | |
3414 const scaler& get_z_scaler (void) const { return sz; } | |
3415 | |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
3416 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
|
3417 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
|
3418 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
|
3419 bool only_text_height=false) const; |
7427 | 3420 |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
3421 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
|
3422 |
7828
4739b6a1925c
Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7827
diff
changeset
|
3423 void update_boundingbox (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3424 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3425 if (units_is ("normalized")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3426 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3427 sync_positions (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3428 base_properties::update_boundingbox (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3429 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3430 } |
7828
4739b6a1925c
Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7827
diff
changeset
|
3431 |
7427 | 3432 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
|
3433 void update_axes_layout (void); |
7427 | 3434 void update_aspectratios (void); |
3435 void update_transform (void) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3436 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3437 update_aspectratios (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3438 update_camera (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3439 update_axes_layout (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3440 } |
7427 | 3441 |
17098
786bcce466e9
Initialize the tightinset during initialization of axes.
Ben Abbott <bpabbott@mac.com>
parents:
17011
diff
changeset
|
3442 void sync_positions (void); |
786bcce466e9
Initialize the tightinset during initialization of axes.
Ben Abbott <bpabbott@mac.com>
parents:
17011
diff
changeset
|
3443 |
12389
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
3444 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
|
3445 void update_xlabel_position (void); |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
3446 void update_ylabel_position (void); |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
3447 void update_zlabel_position (void); |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
3448 void update_title_position (void); |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
3449 |
7435 | 3450 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
|
3451 { return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); } |
7435 | 3452 |
3453 Matrix get_transform_matrix (void) const { return x_render; } | |
3454 Matrix get_inverse_transform_matrix (void) const { return x_render_inv; } | |
3455 Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; } | |
3456 Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; } | |
3457 Matrix get_transform_zlim (void) const { return x_zlim; } | |
3458 | |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3459 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
|
3460 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
|
3461 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
|
3462 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
|
3463 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
|
3464 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
|
3465 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
|
3466 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
|
3467 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
|
3468 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
|
3469 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
|
3470 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
|
3471 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
|
3472 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
|
3473 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
|
3474 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
|
3475 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
|
3476 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
|
3477 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
|
3478 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
|
3479 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
|
3480 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
|
3481 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
|
3482 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
|
3483 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
|
3484 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
|
3485 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
|
3486 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
|
3487 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
|
3488 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
|
3489 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
|
3490 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
|
3491 bool get_layer2Dtop (void) const { return layer2Dtop; } |
23859
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23803
diff
changeset
|
3492 bool get_is2D (bool include_kids = false) const |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23803
diff
changeset
|
3493 { return (include_kids ? (is2D && ! has3Dkids) : is2D); } |
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23803
diff
changeset
|
3494 void set_has3Dkids (bool val) { has3Dkids = val; } |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3495 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
|
3496 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
|
3497 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
|
3498 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
|
3499 |
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
|
3500 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
|
3501 { 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
|
3502 |
1357bcae6e29
added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7836
diff
changeset
|
3503 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
|
3504 { 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
|
3505 |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3506 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
|
3507 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
|
3508 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
|
3509 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
|
3510 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
|
3511 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
|
3512 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3513 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
|
3514 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
|
3515 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
|
3516 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3517 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
|
3518 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
|
3519 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3520 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
|
3521 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
|
3522 |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3523 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
|
3524 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
|
3525 |
7855
f317f14516cb
Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7854
diff
changeset
|
3526 void unzoom (void); |
24395
41cf6ee90cb6
Better handling of "handlevisibility" property (bug #52621).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24277
diff
changeset
|
3527 void update_handlevisibility (void); |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3528 void push_zoom_stack (void); |
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
3529 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
|
3530 |
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
|
3531 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
|
3532 |
25884
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25867
diff
changeset
|
3533 void update_font (std::string prop = ""); |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25867
diff
changeset
|
3534 |
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
|
3535 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
|
3536 |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3537 void increase_num_lights (void) { num_lights++; } |
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3538 void decrease_num_lights (void) { num_lights--; } |
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3539 unsigned int get_num_lights (void) const { return num_lights; } |
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3540 |
7427 | 3541 private: |
23401
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3542 |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3543 scaler sx = scaler (); |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3544 scaler sy = scaler (); |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3545 scaler sz = scaler (); |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3546 |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3547 Matrix x_render = Matrix (); |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3548 Matrix x_render_inv = Matrix (); |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3549 Matrix x_gl_mat1 = Matrix (); |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3550 Matrix x_gl_mat2 = Matrix (); |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3551 Matrix x_zlim = Matrix (); |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3552 |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3553 std::list<octave_value> zoom_stack = std::list<octave_value> (); |
7427 | 3554 |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3555 // Axes layout data |
23401
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3556 int xstate = 0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3557 int ystate = 0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3558 int zstate = 0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3559 |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3560 double xPlane = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3561 double yPlane = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3562 double zPlane = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3563 |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3564 double xPlaneN = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3565 double yPlaneN = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3566 double zPlaneN = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3567 |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3568 double xpTick = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3569 double ypTick = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3570 double zpTick = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3571 |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3572 double xpTickN = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3573 double ypTickN = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3574 double zpTickN = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3575 |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3576 double fx = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3577 double fy = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3578 double fz = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3579 |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3580 double xticklen = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3581 double yticklen = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3582 double zticklen = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3583 |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3584 double xtickoffset = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3585 double ytickoffset = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3586 double ztickoffset = 0.0; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3587 |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3588 bool x2Dtop = false; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3589 bool y2Dright = false; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3590 bool layer2Dtop = false; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3591 bool is2D = false; |
23859
7148b237f94f
Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23803
diff
changeset
|
3592 bool has3Dkids = false; |
23401
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3593 bool xySym = false; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3594 bool xyzSym = false; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3595 bool zSign = false; |
e0c20a22da7e
eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents:
23396
diff
changeset
|
3596 bool nearhoriz = false; |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3597 |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3598 unsigned int num_lights = 0; |
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
3599 |
21209
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
3600 // 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
|
3601 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
|
3602 |
8249 | 3603 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
|
3604 const octave_value& v); |
8249 | 3605 |
8208 | 3606 void delete_text_child (handle_property& h); |
3607 | |
6874 | 3608 // See the genprops.awk script for an explanation of the |
3609 // properties declarations. | |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3610 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3611 // 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
|
3612 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
3613 BEGIN_PROPERTIES (axes) |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3614 radio_property activepositionproperty , "{outerposition}|position" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3615 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
|
3616 radio_property alimmode , "{auto}|manual" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3617 color_property ambientlightcolor , color_values (1, 1, 1) |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3618 bool_property box u , "off" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3619 radio_property boxstyle , "{back}|full" |
24127
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3620 row_vector_property cameraposition mu , Matrix (1, 3, 0.0) |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3621 radio_property camerapositionmode u , "{auto}|manual" |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3622 row_vector_property cameratarget mu , Matrix (1, 3, 0.0) |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3623 radio_property cameratargetmode u , "{auto}|manual" |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3624 row_vector_property cameraupvector mu , Matrix (1, 3, 0.0) |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3625 radio_property cameraupvectormode u , "{auto}|manual" |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3626 double_property cameraviewangle mu , 6.6086 |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3627 radio_property cameraviewanglemode u , "{auto}|manual" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3628 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
|
3629 radio_property climmode al , "{auto}|manual" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3630 radio_property clippingstyle , "{3dbox}|rectangle" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3631 color_property color , color_property (color_values (1, 1, 1), radio_values ("none")) |
23524
7c278572db66
Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
23457
diff
changeset
|
3632 array_property colormap sg , Matrix () |
7363 | 3633 array_property colororder , default_colororder () |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3634 double_property colororderindex , 1.0 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3635 array_property currentpoint , Matrix (2, 3, 0.0) |
23067
6825dd6bbe39
Change some axes properties to row_vector_property (bug #50048).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23057
diff
changeset
|
3636 row_vector_property dataaspectratio mu , Matrix (1, 3, 1.0) |
11167
51ac3a08e53c
Fix {d,pb}aspectratios for OpenGL backends.
Konstantinos Poulios <logari81@googlemail.com>
parents:
11163
diff
changeset
|
3637 radio_property dataaspectratiomode u , "{auto}|manual" |
23201
239a9fed80de
New mechanism to deprecate graphics properties (bug #50327)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23124
diff
changeset
|
3638 radio_property drawmode hd , "{normal}|fast" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3639 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
|
3640 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
|
3641 double_property fontsize u , 10 |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3642 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
|
3643 bool_property fontsmoothing , "on" |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3644 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
|
3645 double_property gridalpha m , 0.15 |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3646 radio_property gridalphamode , "{auto}|manual" |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3647 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
|
3648 radio_property gridcolormode , "{auto}|manual" |
22056
05ad23810150
Use default gridlinestyle of '-' for Matlab compatibility.
Rik <rik@octave.org>
parents:
22022
diff
changeset
|
3649 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
|
3650 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
|
3651 radio_property layer u , "{bottom}|top" |
17382
50b2863d10a6
Create Matlab compatible linestyleorder char matrices (bug #34906)
Rik <rik@octave.org>
parents:
17104
diff
changeset
|
3652 // FIXME: should be kind of string array. |
50b2863d10a6
Create Matlab compatible linestyleorder char matrices (bug #34906)
Rik <rik@octave.org>
parents:
17104
diff
changeset
|
3653 any_property linestyleorder S , "-" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3654 double_property linestyleorderindex , 1.0 |
7403 | 3655 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
|
3656 double_property minorgridalpha m , 0.25 |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3657 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
|
3658 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
|
3659 radio_property minorgridcolormode , "{auto}|manual" |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3660 radio_property minorgridlinestyle , "{:}|-|--|-.|none" |
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3661 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
|
3662 array_property outerposition u , default_axes_outerposition () |
23067
6825dd6bbe39
Change some axes properties to row_vector_property (bug #50048).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23057
diff
changeset
|
3663 row_vector_property plotboxaspectratio mu , Matrix (1, 3, 1.0) |
11167
51ac3a08e53c
Fix {d,pb}aspectratios for OpenGL backends.
Konstantinos Poulios <logari81@googlemail.com>
parents:
11163
diff
changeset
|
3664 radio_property plotboxaspectratiomode u , "{auto}|manual" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3665 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
|
3666 radio_property projection , "{orthographic}|perspective" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3667 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
|
3668 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
|
3669 radio_property tickdirmode u , "{auto}|manual" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3670 // 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
|
3671 radio_property ticklabelinterpreter , "{tex}|latex|none" |
14391
c9ec21bef97a
Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents:
14357
diff
changeset
|
3672 array_property ticklength u , default_axes_ticklength () |
7403 | 3673 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
|
3674 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
|
3675 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
|
3676 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
|
3677 // 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
|
3678 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
|
3679 array_property view u , default_axes_view () |
24976
47f25e164ab1
Delete graphics properties or allowed values scheduled for deprecation in 4.6
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24795
diff
changeset
|
3680 radio_property xaxislocation u , "{bottom}|top|origin" |
23001
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3681 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
|
3682 radio_property xcolormode , "{auto}|manual" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3683 radio_property xdir u , "{normal}|reverse" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3684 bool_property xgrid , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3685 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
|
3686 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
|
3687 radio_property xlimmode al , "{auto}|manual" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3688 bool_property xminorgrid , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3689 bool_property xminortick , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3690 radio_property xscale alu , "{linear}|log" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3691 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
|
3692 // 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
|
3693 any_property xticklabel S , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3694 radio_property xticklabelmode u , "{auto}|manual" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3695 double_property xticklabelrotation , 0.0 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3696 radio_property xtickmode u , "{auto}|manual" |
24976
47f25e164ab1
Delete graphics properties or allowed values scheduled for deprecation in 4.6
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24795
diff
changeset
|
3697 radio_property yaxislocation u , "{left}|right|origin" |
23001
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3698 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
|
3699 radio_property ycolormode , "{auto}|manual" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3700 radio_property ydir u , "{normal}|reverse" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3701 bool_property ygrid , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3702 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
|
3703 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
|
3704 radio_property ylimmode al , "{auto}|manual" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3705 bool_property yminorgrid , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3706 bool_property yminortick , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3707 radio_property yscale alu , "{linear}|log" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3708 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
|
3709 any_property yticklabel S , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3710 radio_property yticklabelmode u , "{auto}|manual" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3711 double_property yticklabelrotation , 0.0 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3712 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
|
3713 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
|
3714 radio_property zcolormode , "{auto}|manual" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3715 radio_property zdir u , "{normal}|reverse" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3716 bool_property zgrid , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3717 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
|
3718 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
|
3719 radio_property zlimmode al , "{auto}|manual" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3720 bool_property zminorgrid , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3721 bool_property zminortick , "off" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3722 radio_property zscale alu , "{linear}|log" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3723 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
|
3724 any_property zticklabel S , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3725 radio_property zticklabelmode u , "{auto}|manual" |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3726 double_property zticklabelrotation , 0.0 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3727 radio_property ztickmode u , "{auto}|manual" |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
3728 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3729 // Octave-specific properties |
24501
2f10c3265607
Make sure axes "colormap" property listeners are executed (bug #52799).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24452
diff
changeset
|
3730 array_property __colormap__ hu , Matrix () |
20258
530803d4f65f
Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents:
20232
diff
changeset
|
3731 double_property mousewheelzoom , 0.5 |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
3732 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3733 // 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
|
3734 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
|
3735 // hidden properties for inset |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
3736 array_property looseinset hu , Matrix (1, 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
|
3737 // hidden properties for minor ticks |
22623
76f1164d2135
Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
3738 row_vector_property xminortickvalues h , Matrix () |
76f1164d2135
Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
3739 row_vector_property yminortickvalues h , Matrix () |
76f1164d2135
Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
3740 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
|
3741 // 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
|
3742 double_property __fontsize_points__ hgr , 0 |
7189 | 3743 END_PROPERTIES |
6874 | 3744 |
7363 | 3745 protected: |
8249 | 3746 void init (void); |
7427 | 3747 |
3748 private: | |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3749 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3750 std::string |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3751 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
|
3752 { |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3753 std::string retval = scale; |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3754 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3755 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
|
3756 retval = "neglog"; |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3757 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3758 return retval; |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3759 } |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3760 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3761 void update_xscale (void) |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3762 { |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3763 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
|
3764 } |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3765 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3766 void update_yscale (void) |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3767 { |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3768 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
|
3769 } |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3770 |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3771 void update_zscale (void) |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3772 { |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
3773 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
|
3774 } |
7427 | 3775 |
23001
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3776 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
|
3777 void update_xcolor (void) |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3778 { update_label_color (xlabel, xcolor); } |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3779 |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3780 void update_ycolor (void) |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3781 { update_label_color (ylabel, ycolor); } |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3782 |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3783 void update_zcolor (void) |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3784 { update_label_color (zlabel, zcolor); } |
14f1738a56ae
Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22619
diff
changeset
|
3785 |
12440
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
3786 void update_view (void) { sync_positions (); } |
24127
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3787 |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3788 void update_cameraposition (void) { update_transform (); } |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3789 void update_cameratarget (void) { update_transform (); } |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3790 void update_cameraupvector (void) { update_transform (); } |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3791 void update_cameraviewangle (void) { update_transform (); } |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3792 |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3793 void update_camerapositionmode (void) |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3794 { |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3795 if (camerapositionmode_is ("auto")) |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3796 update_cameraposition (); |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3797 } |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3798 void update_cameratargetmode (void) |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3799 { |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3800 if (cameratargetmode_is ("auto")) |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3801 update_cameratarget (); |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3802 } |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3803 void update_cameraupvectormode (void) |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3804 { |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3805 if (cameraupvectormode_is ("auto")) |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3806 update_cameraupvector (); |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3807 } |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3808 void update_cameraviewanglemode (void) |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3809 { |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3810 if (cameraviewanglemode_is ("auto")) |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3811 update_cameraviewangle (); |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3812 } |
b188be2b962b
Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents:
24120
diff
changeset
|
3813 |
12441
b932ae4381da
improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12440
diff
changeset
|
3814 void update_dataaspectratio (void) { sync_positions (); } |
b932ae4381da
improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12440
diff
changeset
|
3815 void update_dataaspectratiomode (void) { sync_positions (); } |
b932ae4381da
improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12440
diff
changeset
|
3816 void update_plotboxaspectratio (void) { sync_positions (); } |
b932ae4381da
improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12440
diff
changeset
|
3817 void update_plotboxaspectratiomode (void) { sync_positions (); } |
7427 | 3818 |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3819 void update_layer (void) { update_axes_layout (); } |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3820 void update_box (void) |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3821 { |
24191
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3822 if (xticklabelmode.is ("auto")) |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3823 calc_ticklabels (xtick, xticklabel, xscale.is ("log"), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3824 xaxislocation_is ("origin"), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3825 yscale.is ("log") ? 2 : |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3826 (yaxislocation_is ("origin") ? 0 : |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3827 (yaxislocation_is ("left") ? -1 : 1)), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3828 xlim); |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3829 if (yticklabelmode.is ("auto")) |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3830 calc_ticklabels (ytick, yticklabel, yscale.is ("log"), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3831 yaxislocation_is ("origin"), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3832 xscale.is ("log") ? 2 : |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3833 (xaxislocation_is ("origin") ? 0 : |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3834 (xaxislocation_is ("bottom") ? -1 : 1)), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3835 ylim); |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3836 } |
12503
2c66314447f1
update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents:
12496
diff
changeset
|
3837 void update_yaxislocation (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3838 { |
19652
5b4fd7ebcfc6
Update "tightinset" when "x/yaxislocation" is changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19597
diff
changeset
|
3839 sync_positions (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3840 update_axes_layout (); |
24191
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3841 if (xticklabelmode.is ("auto")) |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3842 calc_ticklabels (xtick, xticklabel, xscale.is ("log"), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3843 xaxislocation_is ("origin"), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3844 yscale.is ("log") ? 2 : |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3845 (yaxislocation_is ("origin") ? 0 : |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3846 (yaxislocation_is ("left") ? -1 : 1)), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3847 xlim); |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3848 if (yticklabelmode.is ("auto")) |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3849 calc_ticklabels (ytick, yticklabel, yscale.is ("log"), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3850 yaxislocation_is ("origin"), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3851 xscale.is ("log") ? 2 : |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3852 (xaxislocation_is ("origin") ? 0 : |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3853 (xaxislocation_is ("bottom") ? -1 : 1)), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3854 ylim); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3855 update_ylabel_position (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3856 } |
12503
2c66314447f1
update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents:
12496
diff
changeset
|
3857 void update_xaxislocation (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3858 { |
19652
5b4fd7ebcfc6
Update "tightinset" when "x/yaxislocation" is changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19597
diff
changeset
|
3859 sync_positions (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3860 update_axes_layout (); |
24191
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3861 if (xticklabelmode.is ("auto")) |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3862 calc_ticklabels (xtick, xticklabel, xscale.is ("log"), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3863 xaxislocation_is ("origin"), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3864 yscale.is ("log") ? 2 : |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3865 (yaxislocation_is ("origin") ? 0 : |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3866 (yaxislocation_is ("left") ? -1 : 1)), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3867 xlim); |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3868 if (yticklabelmode.is ("auto")) |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3869 calc_ticklabels (ytick, yticklabel, yscale.is ("log"), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3870 yaxislocation_is ("origin"), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3871 xscale.is ("log") ? 2 : |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3872 (xaxislocation_is ("origin") ? 0 : |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3873 (xaxislocation_is ("bottom") ? -1 : 1)), |
fdd67d871a72
Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24127
diff
changeset
|
3874 ylim); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3875 update_xlabel_position (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3876 } |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3877 |
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
3878 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
|
3879 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
|
3880 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
|
3881 |
14391
c9ec21bef97a
Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents:
14357
diff
changeset
|
3882 void update_ticklength (void); |
c9ec21bef97a
Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents:
14357
diff
changeset
|
3883 void update_tickdir (void) { update_ticklength (); } |
c9ec21bef97a
Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents:
14357
diff
changeset
|
3884 void update_tickdirmode (void) { update_ticklength (); } |
7446 | 3885 |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
3886 void update_xtick (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3887 { |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
3888 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
|
3889 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
|
3890 if (xticklabelmode.is ("auto")) |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3891 calc_ticklabels (xtick, xticklabel, xscale.is ("log"), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3892 xaxislocation_is ("origin"), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3893 yscale.is ("log") ? 2 : |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3894 (yaxislocation_is ("origin") ? 0 : |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3895 (yaxislocation_is ("left") ? -1 : 1)), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3896 xlim); |
19659
a9516bc4c55c
Update axes "tightinset" when "x/y/ztick" have changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19652
diff
changeset
|
3897 sync_positions (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3898 } |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
3899 void update_ytick (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3900 { |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
3901 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
|
3902 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
|
3903 if (yticklabelmode.is ("auto")) |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3904 calc_ticklabels (ytick, yticklabel, yscale.is ("log"), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3905 yaxislocation_is ("origin"), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3906 xscale.is ("log") ? 2 : |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3907 (xaxislocation_is ("origin") ? 0 : |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3908 (xaxislocation_is ("bottom") ? -1 : 1)), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3909 ylim); |
19659
a9516bc4c55c
Update axes "tightinset" when "x/y/ztick" have changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19652
diff
changeset
|
3910 sync_positions (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3911 } |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
3912 void update_ztick (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3913 { |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
3914 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
|
3915 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
|
3916 if (zticklabelmode.is ("auto")) |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3917 calc_ticklabels (ztick, zticklabel, zscale.is ("log"), false, 2, zlim); |
19659
a9516bc4c55c
Update axes "tightinset" when "x/y/ztick" have changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19652
diff
changeset
|
3918 sync_positions (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3919 } |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
3920 |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
3921 void update_xtickmode (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3922 { |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
3923 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
|
3924 update_xtick (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3925 } |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
3926 void update_ytickmode (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3927 { |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
3928 if (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
|
3929 update_ytick (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3930 } |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
3931 void update_ztickmode (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3932 { |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
3933 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
|
3934 update_ztick (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3935 } |
11394
ecd87194adb6
Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents:
11385
diff
changeset
|
3936 |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
3937 void update_xticklabelmode (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3938 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3939 if (xticklabelmode.is ("auto")) |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3940 calc_ticklabels (xtick, xticklabel, xscale.is ("log"), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3941 xaxislocation_is ("origin"), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3942 yscale.is ("log") ? 2 : |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3943 (yaxislocation_is ("origin") ? 0 : |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3944 (yaxislocation_is ("left") ? -1 : 1)), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3945 xlim); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3946 } |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
3947 void update_yticklabelmode (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3948 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3949 if (yticklabelmode.is ("auto")) |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3950 calc_ticklabels (ytick, yticklabel, yscale.is ("log"), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3951 yaxislocation_is ("origin"), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3952 xscale.is ("log") ? 2 : |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3953 (xaxislocation_is ("origin") ? 0 : |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3954 (xaxislocation_is ("bottom") ? -1 : 1)), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3955 ylim); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3956 } |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
3957 void update_zticklabelmode (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3958 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3959 if (zticklabelmode.is ("auto")) |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
3960 calc_ticklabels (ztick, zticklabel, zscale.is ("log"), false, 2, zlim); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
3961 } |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
3962 |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
3963 void update_fontname (void) |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
3964 { |
22723
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3965 update_font ("fontname"); |
19684
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
3966 sync_positions (); |
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
3967 } |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
3968 void update_fontsize (void) |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
3969 { |
22723
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3970 update_font ("fontsize"); |
19684
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
3971 sync_positions (); |
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
3972 } |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
3973 void update_fontangle (void) |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
3974 { |
22723
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3975 update_font ("fontangle"); |
19684
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
3976 sync_positions (); |
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
3977 } |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
3978 void update_fontweight (void) |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
3979 { |
22723
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3980 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
|
3981 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
|
3982 } |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3983 |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3984 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
|
3985 { |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3986 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
|
3987 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
|
3988 } |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3989 |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3990 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
|
3991 { |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3992 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
|
3993 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
|
3994 } |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3995 |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3996 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
|
3997 { |
03cebe1fb0e3
Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22710
diff
changeset
|
3998 update_font ("fontweight"); |
19684
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
3999 sync_positions (); |
2b93834e5ede
Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19678
diff
changeset
|
4000 } |
12777
6c1d0f03c331
Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents:
12685
diff
changeset
|
4001 |
12440
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4002 void update_outerposition (void) |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4003 { |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4004 set_activepositionproperty ("outerposition"); |
17011
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4005 caseless_str old_units = get_units (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4006 set_units ("normalized"); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4007 Matrix outerbox = outerposition.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4008 Matrix innerbox = position.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4009 Matrix linset = looseinset.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4010 Matrix tinset = tightinset.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4011 outerbox(2) = outerbox(2) + outerbox(0); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4012 outerbox(3) = outerbox(3) + outerbox(1); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4013 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
|
4014 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
|
4015 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
|
4016 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
|
4017 innerbox(2) = innerbox(2) - innerbox(0); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4018 innerbox(3) = innerbox(3) - innerbox(1); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4019 position = innerbox; |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4020 set_units (old_units); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4021 update_transform (); |
12440
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4022 } |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4023 |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4024 void update_position (void) |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4025 { |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4026 set_activepositionproperty ("position"); |
17011
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4027 caseless_str old_units = get_units (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4028 set_units ("normalized"); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4029 Matrix outerbox = outerposition.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4030 Matrix innerbox = position.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4031 Matrix linset = looseinset.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4032 Matrix tinset = tightinset.get ().matrix_value (); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4033 innerbox(2) = innerbox(2) + innerbox(0); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4034 innerbox(3) = innerbox(3) + innerbox(1); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4035 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
|
4036 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
|
4037 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
|
4038 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
|
4039 outerbox(2) = outerbox(2) - outerbox(0); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4040 outerbox(3) = outerbox(3) - outerbox(1); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4041 outerposition = outerbox; |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4042 set_units (old_units); |
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4043 update_transform (); |
12440
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4044 } |
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
|
4045 |
17011
350cad34b0f8
Simplify syncing axes "position", "outerposition", and "looseinset".
Ben Abbott <bpabbott@mac.com>
parents:
16892
diff
changeset
|
4046 void update_looseinset (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4047 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4048 caseless_str old_units = get_units (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4049 set_units ("normalized"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4050 Matrix innerbox = position.get ().matrix_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4051 innerbox(2) = innerbox(2) + innerbox(0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4052 innerbox(3) = innerbox(3) + innerbox(1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4053 Matrix outerbox = outerposition.get ().matrix_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4054 outerbox(2) = outerbox(2) + outerbox(0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4055 outerbox(3) = outerbox(3) + outerbox(1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4056 Matrix linset = looseinset.get ().matrix_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4057 Matrix tinset = tightinset.get ().matrix_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4058 if (activepositionproperty.is ("position")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4059 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4060 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
|
4061 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
|
4062 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
|
4063 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
|
4064 outerbox(2) = outerbox(2) - outerbox(0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4065 outerbox(3) = outerbox(3) - outerbox(1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4066 outerposition = outerbox; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4067 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4068 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4069 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4070 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
|
4071 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
|
4072 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
|
4073 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
|
4074 innerbox(2) = innerbox(2) - innerbox(0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4075 innerbox(3) = innerbox(3) - innerbox(1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4076 position = innerbox; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4077 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4078 set_units (old_units); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4079 update_transform (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4080 } |
12467
2f83974d5a6d
implement looseinset property for axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12443
diff
changeset
|
4081 |
7827
3584f37eac69
better tick and limit handling, still missing logscale support
Shai Ayal <shaiay@sourceforge.net>
parents:
7826
diff
changeset
|
4082 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
|
4083 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
|
4084 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
|
4085 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
|
4086 void calc_ticklabels (const array_property& ticks, any_property& labels, |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4087 bool is_logscale, const bool is_origin, |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4088 const int other_axislocation, |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4089 const array_property& axis_lims); |
12334
63dc132a1000
Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents:
12327
diff
changeset
|
4090 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
|
4091 const string_vector& ticklabels, |
63dc132a1000
Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents:
12327
diff
changeset
|
4092 const Matrix& limits); |
63dc132a1000
Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents:
12327
diff
changeset
|
4093 |
7854
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4094 void fix_limits (array_property& lims) |
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4095 { |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23576
diff
changeset
|
4096 if (lims.get ().isempty ()) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4097 return; |
7854
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4098 |
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4099 Matrix l = lims.get ().matrix_value (); |
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4100 if (l(0) > l(1)) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4101 { |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4102 l(0) = 0; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4103 l(1) = 1; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4104 lims = l; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4105 } |
7854
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4106 else if (l(0) == l(1)) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4107 { |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4108 l(0) -= 0.5; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4109 l(1) += 0.5; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4110 lims = l; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
4111 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4112 } |
7446 | 4113 |
12440
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4114 Matrix calc_tightbox (const Matrix& init_pos); |
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4115 |
23524
7c278572db66
Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
23457
diff
changeset
|
4116 void set_colormap (const octave_value& val) |
7c278572db66
Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
23457
diff
changeset
|
4117 { |
7c278572db66
Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
23457
diff
changeset
|
4118 set___colormap__ (val); |
7c278572db66
Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
23457
diff
changeset
|
4119 } |
7c278572db66
Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
23457
diff
changeset
|
4120 |
24501
2f10c3265607
Make sure axes "colormap" property listeners are executed (bug #52799).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24452
diff
changeset
|
4121 void update___colormap__ (void) |
2f10c3265607
Make sure axes "colormap" property listeners are executed (bug #52799).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24452
diff
changeset
|
4122 { |
2f10c3265607
Make sure axes "colormap" property listeners are executed (bug #52799).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24452
diff
changeset
|
4123 colormap.run_listeners (POSTSET); |
2f10c3265607
Make sure axes "colormap" property listeners are executed (bug #52799).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24452
diff
changeset
|
4124 } |
2f10c3265607
Make sure axes "colormap" property listeners are executed (bug #52799).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24452
diff
changeset
|
4125 |
23524
7c278572db66
Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
23457
diff
changeset
|
4126 octave_value get_colormap (void) const; |
7c278572db66
Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
23457
diff
changeset
|
4127 |
7446 | 4128 public: |
13132
e3e8ca96f923
Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents:
12965
diff
changeset
|
4129 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
|
4130 double min_pos, double max_neg, |
24030
ec3d37eeafa2
Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23859
diff
changeset
|
4131 const bool logscale); |
ec3d37eeafa2
Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23859
diff
changeset
|
4132 |
ec3d37eeafa2
Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23859
diff
changeset
|
4133 void check_axis_limits (Matrix &limits, const Matrix kids, |
ec3d37eeafa2
Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23859
diff
changeset
|
4134 const bool logscale, char &update_type); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4135 |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
4136 void update_xlim () |
7446 | 4137 { |
24030
ec3d37eeafa2
Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23859
diff
changeset
|
4138 update_axis_limits ("xlim"); |
ec3d37eeafa2
Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23859
diff
changeset
|
4139 |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4140 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
|
4141 xtickmode.is ("auto"), xscale.is ("log")); |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4142 if (xticklabelmode.is ("auto")) |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4143 calc_ticklabels (xtick, xticklabel, xscale.is ("log"), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4144 xaxislocation.is ("origin"), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4145 yscale.is ("log") ? 2 : |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4146 (yaxislocation_is ("origin") ? 0 : |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4147 (yaxislocation_is ("left") ? -1 : 1)), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4148 xlim); |
7855
f317f14516cb
Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7854
diff
changeset
|
4149 |
7854
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4150 fix_limits (xlim); |
7855
f317f14516cb
Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7854
diff
changeset
|
4151 |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4152 update_xscale (); |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4153 |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
4154 update_axes_layout (); |
7446 | 4155 } |
4156 | |
19663
dfea01b3425f
more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents:
19659
diff
changeset
|
4157 void update_ylim (void) |
7446 | 4158 { |
24030
ec3d37eeafa2
Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23859
diff
changeset
|
4159 update_axis_limits ("ylim"); |
ec3d37eeafa2
Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23859
diff
changeset
|
4160 |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4161 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
|
4162 ytickmode.is ("auto"), yscale.is ("log")); |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4163 if (yticklabelmode.is ("auto")) |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4164 calc_ticklabels (ytick, yticklabel, yscale.is ("log"), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4165 yaxislocation_is ("origin"), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4166 xscale.is ("log") ? 2 : |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4167 (xaxislocation_is ("origin") ? 0 : |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4168 (xaxislocation_is ("bottom") ? -1 : 1)), |
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4169 ylim); |
7854
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4170 |
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4171 fix_limits (ylim); |
7855
f317f14516cb
Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7854
diff
changeset
|
4172 |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4173 update_yscale (); |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4174 |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
4175 update_axes_layout (); |
7446 | 4176 } |
4177 | |
4178 void update_zlim (void) | |
4179 { | |
24030
ec3d37eeafa2
Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23859
diff
changeset
|
4180 update_axis_limits ("zlim"); |
ec3d37eeafa2
Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23859
diff
changeset
|
4181 |
22710
0cbe4714ce1b
Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents:
22665
diff
changeset
|
4182 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
|
4183 ztickmode.is ("auto"), zscale.is ("log")); |
9347
3da821b161e9
imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents:
9188
diff
changeset
|
4184 if (zticklabelmode.is ("auto")) |
23116
868daa374c49
Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents:
23084
diff
changeset
|
4185 calc_ticklabels (ztick, zticklabel, zscale.is ("log"), false, 2, zlim); |
7854
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4186 |
228858e69bd1
added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents:
7850
diff
changeset
|
4187 fix_limits (zlim); |
7855
f317f14516cb
Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7854
diff
changeset
|
4188 |
14324
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4189 update_zscale (); |
5a2b012b10c7
allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents:
14314
diff
changeset
|
4190 |
12327
2ad37783bf01
Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents:
12324
diff
changeset
|
4191 update_axes_layout (); |
7446 | 4192 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4193 |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4194 void trigger_normals_calc (void); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4195 |
6874 | 4196 }; |
4197 | |
4198 private: | |
4199 properties xproperties; | |
4200 | |
4201 public: | |
4202 axes (const graphics_handle& mh, const graphics_handle& p) | |
4203 : base_graphics_object (), xproperties (mh, p), default_properties () | |
4204 { | |
19087
3e0720bd6bfc
Fix setting axes default x/y/zlabel with string values (bug #34755)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19086
diff
changeset
|
4205 xproperties.update_transform (); |
6874 | 4206 } |
4207 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
4208 ~axes (void) = default; |
6874 | 4209 |
4210 void override_defaults (base_graphics_object& obj) | |
4211 { | |
4212 // Allow parent (figure) to override first (properties knows how | |
4213 // to find the parent object). | |
4214 xproperties.override_defaults (obj); | |
4215 | |
4216 // Now override with our defaults. If the default_properties | |
4217 // list includes the properties for all defaults (line, | |
4218 // surface, etc.) then we don't have to know the type of OBJ | |
4219 // here, we just call its set function and let it decide which | |
4220 // properties from the list to use. | |
4221 obj.set_from_list (default_properties); | |
4222 } | |
4223 | |
7189 | 4224 void set (const caseless_str& name, const octave_value& value) |
6874 | 4225 { |
4226 if (name.compare ("default", 7)) | |
4227 // strip "default", pass rest to function that will | |
4228 // parse the remainder and add the element to the | |
4229 // default_properties map. | |
4230 default_properties.set (name.substr (7), value); | |
4231 else | |
4232 xproperties.set (name, value); | |
4233 } | |
4234 | |
4235 void set_defaults (const std::string& mode) | |
4236 { | |
4237 xproperties.set_defaults (*this, mode); | |
4238 } | |
4239 | |
7189 | 4240 octave_value get (const caseless_str& name) const |
6874 | 4241 { |
4242 octave_value retval; | |
4243 | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4244 // FIXME: finish this. |
6874 | 4245 if (name.compare ("default", 7)) |
4246 retval = get_default (name.substr (7)); | |
4247 else | |
4248 retval = xproperties.get (name); | |
4249 | |
4250 return retval; | |
4251 } | |
4252 | |
7189 | 4253 octave_value get_default (const caseless_str& name) const; |
6874 | 4254 |
4255 octave_value get_defaults (void) const | |
4256 { | |
4257 return default_properties.as_struct ("default"); | |
4258 } | |
4259 | |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
4260 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
|
4261 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
4262 return default_properties; |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
4263 } |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
4264 |
6874 | 4265 base_properties& get_properties (void) { return xproperties; } |
4266 | |
7222 | 4267 const base_properties& get_properties (void) const { return xproperties; } |
4268 | |
7214 | 4269 void update_axis_limits (const std::string& axis_type); |
4270 | |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
4271 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
|
4272 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
|
4273 |
6874 | 4274 bool valid_object (void) const { return true; } |
4275 | |
10722
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
4276 void reset_default_properties (void); |
755fcb5baad3
Add the reset built function
David Bateman <dbateman@free.fr>
parents:
10717
diff
changeset
|
4277 |
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
|
4278 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
|
4279 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4280 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
|
4281 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
|
4282 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
|
4283 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
|
4284 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4285 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
4286 protected: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
4287 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
|
4288 |
6874 | 4289 private: |
4290 property_list default_properties; | |
4291 }; | |
4292 | |
4293 // --------------------------------------------------------------------- | |
4294 | |
7365 | 4295 class OCTINTERP_API line : public base_graphics_object |
6874 | 4296 { |
4297 public: | |
7821
f79dcba526a8
Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7527
diff
changeset
|
4298 class OCTINTERP_API properties : public base_properties |
6874 | 4299 { |
4300 public: | |
4301 // See the genprops.awk script for an explanation of the | |
4302 // properties declarations. | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4303 // Programming note: Keep property list sorted if new ones are added. |
7366 | 4304 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
4305 BEGIN_PROPERTIES (line) |
20738
f90295782d60
Accept color value of "none" for line objects (bug #44224).
Rik <rik@octave.org>
parents:
20730
diff
changeset
|
4306 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
|
4307 string_property displayname , "" |
25172
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
4308 // FIXME: DEPRECATED: Remove erasemode property in version 5 |
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
4309 // (rm all instances in file). |
21905
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
4310 radio_property erasemode h , "{normal}|none|xor|background" |
25172
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
4311 // FIXME: DEPRECATED: Remove interpreter property in version 6. |
23258
218a49aea031
Deprecate "interpreter" property in primitive graphic objects (partial fix for bug #50496).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
4312 radio_property interpreter hd , "{tex}|none|latex" |
22759
39f39eb4e476
Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22755
diff
changeset
|
4313 radio_property linejoin , "{round}|miter|chamfer" |
7363 | 4314 radio_property linestyle , "{-}|--|:|-.|none" |
4315 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
|
4316 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
|
4317 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
|
4318 color_property markerfacecolor , color_property (radio_values ("auto|{none}"), color_values (0, 0, 0)) |
7363 | 4319 double_property markersize , 6 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4320 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
|
4321 string_property xdatasource , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4322 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
|
4323 string_property ydatasource , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4324 row_vector_property zdata u , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4325 string_property zdatasource , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4326 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4327 // 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
|
4328 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
|
4329 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
|
4330 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
|
4331 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
|
4332 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
|
4333 bool_property zliminclude hl , "off" |
6874 | 4334 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
|
4335 |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4336 protected: |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4337 void init (void) |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
4338 { |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
4339 linewidth.add_constraint ("min", 0, false); |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
4340 markersize.add_constraint ("min", 0, false); |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
4341 } |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4342 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4343 private: |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4344 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
|
4345 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
|
4346 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4347 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
|
4348 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4349 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
|
4350 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4351 void update_zdata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4352 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4353 set_zlim (zdata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4354 set_zliminclude (get_zdata ().numel () > 0); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4355 } |
6874 | 4356 }; |
4357 | |
4358 private: | |
4359 properties xproperties; | |
4360 | |
4361 public: | |
4362 line (const graphics_handle& mh, const graphics_handle& p) | |
4363 : 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
|
4364 { } |
6874 | 4365 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
4366 ~line (void) = default; |
6874 | 4367 |
4368 base_properties& get_properties (void) { return xproperties; } | |
4369 | |
7222 | 4370 const base_properties& get_properties (void) const { return xproperties; } |
4371 | |
6874 | 4372 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
|
4373 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4374 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
|
4375 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4376 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
|
4377 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
|
4378 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
|
4379 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
|
4380 } |
6874 | 4381 }; |
4382 | |
4383 // --------------------------------------------------------------------- | |
4384 | |
7365 | 4385 class OCTINTERP_API text : public base_graphics_object |
6874 | 4386 { |
4387 public: | |
7821
f79dcba526a8
Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7527
diff
changeset
|
4388 class OCTINTERP_API properties : public base_properties |
6874 | 4389 { |
4390 public: | |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
4391 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
|
4392 |
25884
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25867
diff
changeset
|
4393 void update_text_extent (void); |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25867
diff
changeset
|
4394 |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25867
diff
changeset
|
4395 void update_font (void); |
4e108574385c
Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents:
25867
diff
changeset
|
4396 |
14448
7a49519913e3
Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents:
14391
diff
changeset
|
4397 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
|
4398 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4399 octave_value new_val (val); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4400 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4401 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
|
4402 { |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4403 dim_vector dv (1, 3); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4404 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4405 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
|
4406 } |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4407 |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4408 if (position.set (new_val, false)) |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4409 { |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4410 set_positionmode ("manual"); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4411 update_position (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4412 position.run_listeners (POSTSET); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4413 mark_modified (); |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4414 } |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4415 else |
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
4416 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
|
4417 } |
7a49519913e3
Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents:
14391
diff
changeset
|
4418 |
6874 | 4419 // See the genprops.awk script for an explanation of the |
4420 // properties declarations. | |
4421 | |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
4422 BEGIN_PROPERTIES (text) |
17646
993ea21b7e03
graphics.in.h: Text "edgecolor" property should default to "none".
Rik <rik@octave.org>
parents:
17645
diff
changeset
|
4423 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
|
4424 color_property color u , color_values (0, 0, 0) |
17645
85a057ad1ba6
Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents:
17631
diff
changeset
|
4425 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
|
4426 bool_property editing , "off" |
21905
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
4427 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
|
4428 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
|
4429 radio_property fontangle u , "{normal}|italic|oblique" |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4430 string_property fontname u , OCTAVE_DEFAULT_FONTNAME |
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4431 double_property fontsize u , 10 |
19047
1288a2f27769
Handle non "points" fontunits properties (bug # 40158)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19044
diff
changeset
|
4432 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
|
4433 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
|
4434 radio_property horizontalalignment mu , "{left}|center|right" |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4435 radio_property interpreter u , "{tex}|none|latex" |
7377 | 4436 radio_property linestyle , "{-}|--|:|-.|none" |
4437 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
|
4438 double_property margin , 2 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4439 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
|
4440 double_property rotation mu , 0 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4441 text_label_property string u , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4442 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
|
4443 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
|
4444 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4445 // 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
|
4446 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
|
4447 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
|
4448 row_vector_property zlim hlr , Matrix () |
11281
3f952c6973f7
graphics.h.in: Change intended for 11272.
Ben Abbott <bpabbott@mac.com>
parents:
11250
diff
changeset
|
4449 bool_property xliminclude hl , "off" |
3f952c6973f7
graphics.h.in: Change intended for 11272.
Ben Abbott <bpabbott@mac.com>
parents:
11250
diff
changeset
|
4450 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
|
4451 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
|
4452 // hidden properties for auto-positioning |
12389
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4453 radio_property positionmode hu , "{auto}|manual" |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4454 radio_property rotationmode hu , "{auto}|manual" |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4455 radio_property horizontalalignmentmode hu , "{auto}|manual" |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4456 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
|
4457 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
|
4458 // 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
|
4459 double_property __fontsize_points__ hgr , 0 |
6874 | 4460 END_PROPERTIES |
4461 | |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4462 Matrix get_data_position (void) const; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
11394
diff
changeset
|
4463 Matrix get_extent_matrix (void) const; |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
11394
diff
changeset
|
4464 const uint8NDArray& get_pixels (void) const { return pixels; } |
21209
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
4465 |
67d2965af0b5
revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents:
21200
diff
changeset
|
4466 // 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
|
4467 octave::text_renderer txt_renderer; |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4468 |
7363 | 4469 protected: |
4470 void init (void) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4471 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4472 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
|
4473 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
|
4474 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
|
4475 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
|
4476 cached_units = get_units (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4477 update_font (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4478 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4479 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4480 private: |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4481 void update_position (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4482 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4483 Matrix pos = get_data_position (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4484 Matrix lim; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4485 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4486 lim = Matrix (1, 3, pos(0)); |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23449
diff
changeset
|
4487 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
|
4488 set_xlim (lim); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4489 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4490 lim = Matrix (1, 3, pos(1)); |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23449
diff
changeset
|
4491 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
|
4492 set_ylim (lim); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4493 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4494 if (pos.numel () == 3) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4495 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4496 lim = Matrix (1, 3, pos(2)); |
23450
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23449
diff
changeset
|
4497 lim(2) = (lim(2) <= 0 ? octave::numeric_limits<double>::Inf () |
855122b993da
maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents:
23449
diff
changeset
|
4498 : lim(2)); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4499 set_zliminclude ("on"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4500 set_zlim (lim); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4501 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4502 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4503 set_zliminclude ("off"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4504 } |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4505 |
12389
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4506 void request_autopos (void); |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4507 void update_positionmode (void) { request_autopos (); } |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4508 void update_rotationmode (void) { request_autopos (); } |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4509 void update_horizontalalignmentmode (void) { request_autopos (); } |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4510 void update_verticalalignmentmode (void) { request_autopos (); } |
5367bd36b9f8
implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents:
12334
diff
changeset
|
4511 |
12440
2ed62b9f949e
synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents:
12433
diff
changeset
|
4512 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
|
4513 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
|
4514 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
|
4515 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
|
4516 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
|
4517 void update_fontangle (void) { update_font (); update_text_extent (); } |
23210
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
4518 |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23258
diff
changeset
|
4519 void update_fontweight (void) |
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23258
diff
changeset
|
4520 { |
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23258
diff
changeset
|
4521 update_font (); |
23210
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
4522 update_text_extent (); |
25172
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
4523 // FIXME: DEPRECATED: Remove warning with demi and light in |
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
4524 // version 6. |
23210
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
4525 if (fontweight.is ("demi") || fontweight.is ("light")) |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
4526 warning_with_id ("Octave:deprecated-property", |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
4527 "Setting 'fontweight' to '%s' is deprecated, \ |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
4528 use 'normal' or 'bold'.", fontweight.current_value ().c_str ()); |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
4529 } |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
4530 |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4531 void update_interpreter (void) { update_text_extent (); } |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
11394
diff
changeset
|
4532 void update_horizontalalignment (void) { update_text_extent (); } |
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
11394
diff
changeset
|
4533 void update_verticalalignment (void) { update_text_extent (); } |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4534 |
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4535 void update_units (void); |
19047
1288a2f27769
Handle non "points" fontunits properties (bug # 40158)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19044
diff
changeset
|
4536 void update_fontunits (const caseless_str& old_fontunits); |
10402
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4537 |
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4538 private: |
9f2bf537a651
Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10317
diff
changeset
|
4539 std::string cached_units; |
11455
2be9e22796d2
improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents:
11394
diff
changeset
|
4540 uint8NDArray pixels; |
6874 | 4541 }; |
4542 | |
4543 private: | |
4544 properties xproperties; | |
4545 | |
4546 public: | |
4547 text (const graphics_handle& mh, const graphics_handle& p) | |
4548 : base_graphics_object (), xproperties (mh, p) | |
4549 { | |
12433
02669a1aa070
regexp.cc: avoid deprecated Array<T>:resize function
John W. Eaton <jwe@octave.org>
parents:
12389
diff
changeset
|
4550 xproperties.set_clipping ("off"); |
6874 | 4551 } |
4552 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
4553 ~text (void) = default; |
6874 | 4554 |
4555 base_properties& get_properties (void) { return xproperties; } | |
4556 | |
7222 | 4557 const base_properties& get_properties (void) const { return xproperties; } |
4558 | |
6874 | 4559 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
|
4560 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4561 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
|
4562 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4563 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
|
4564 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
|
4565 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
|
4566 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
|
4567 } |
6874 | 4568 }; |
4569 | |
4570 // --------------------------------------------------------------------- | |
4571 | |
7365 | 4572 class OCTINTERP_API image : public base_graphics_object |
6874 | 4573 { |
4574 public: | |
7821
f79dcba526a8
Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7527
diff
changeset
|
4575 class OCTINTERP_API properties : public base_properties |
6874 | 4576 { |
4577 public: | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4578 bool is_aliminclude (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4579 { 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
|
4580 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
|
4581 { return aliminclude.current_value (); } |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4582 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4583 bool is_climinclude (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4584 { 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
|
4585 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
|
4586 { 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
|
4587 |
9680
73153525df9a
initial implementation of OpenGL image rendering
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9620
diff
changeset
|
4588 octave_value get_color_data (void) const; |
73153525df9a
initial implementation of OpenGL image rendering
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9620
diff
changeset
|
4589 |
19324
68db8396c378
Make "image ()" use the default image cdata
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19087
diff
changeset
|
4590 void initialize_data (void) { update_cdata (); } |
68db8396c378
Make "image ()" use the default image cdata
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19087
diff
changeset
|
4591 |
6874 | 4592 // See the genprops.awk script for an explanation of the |
4593 // properties declarations. | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4594 // Programming note: Keep property list sorted if new ones are added. |
6874 | 4595 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
4596 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
|
4597 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
|
4598 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
|
4599 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
|
4600 radio_property cdatamapping al , "scaled|{direct}" |
21905
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
4601 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
|
4602 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
|
4603 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
|
4604 // hidden properties for limit computation |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4605 row_vector_property alim hlr , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4606 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
|
4607 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
|
4608 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
|
4609 bool_property aliminclude hlg , "on" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4610 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
|
4611 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
|
4612 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
|
4613 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
|
4614 radio_property ydatamode ha , "{auto}|manual" |
6874 | 4615 END_PROPERTIES |
4616 | |
7363 | 4617 protected: |
4618 void init (void) | |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4619 { |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4620 xdata.add_constraint (2); |
20273
b8c1b3e9aa91
Fix segfault when '[]' used for row_vector_property.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
4621 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
|
4622 ydata.add_constraint (2); |
20273
b8c1b3e9aa91
Fix segfault when '[]' used for row_vector_property.
Rik <rik@octave.org>
parents:
20181
diff
changeset
|
4623 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
|
4624 cdata.add_constraint ("double"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4625 cdata.add_constraint ("single"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4626 cdata.add_constraint ("logical"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4627 cdata.add_constraint ("uint8"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4628 cdata.add_constraint ("uint16"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4629 cdata.add_constraint ("int16"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4630 cdata.add_constraint ("real"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4631 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
|
4632 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
|
4633 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
|
4634 alphadata.add_constraint ("double"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4635 alphadata.add_constraint ("uint8"); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4636 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4637 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4638 private: |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4639 void update_alphadata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4640 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4641 if (alphadatamapping_is ("scaled")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4642 set_alim (alphadata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4643 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4644 alim = alphadata.get_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4645 } |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4646 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4647 void update_cdata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4648 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4649 if (cdatamapping_is ("scaled")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4650 set_clim (cdata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4651 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4652 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
|
4653 |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4654 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
|
4655 update_xdata (); |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4656 |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4657 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
|
4658 update_ydata (); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4659 } |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4660 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4661 void update_xdata (void) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4662 { |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23576
diff
changeset
|
4663 if (xdata.get ().isempty ()) |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4664 set_xdatamode ("auto"); |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4665 |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4666 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
|
4667 { |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4668 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
|
4669 set_xdatamode ("auto"); |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4670 } |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4671 |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4672 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
|
4673 float dp = pixel_xsize (); |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4674 |
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4675 limits(0) = limits(0) - dp; |
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4676 limits(1) = limits(1) + dp; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4677 set_xlim (limits); |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4678 } |
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4679 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4680 void update_ydata (void) |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4681 { |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23576
diff
changeset
|
4682 if (ydata.get ().isempty ()) |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4683 set_ydatamode ("auto"); |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4684 |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4685 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
|
4686 { |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4687 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
|
4688 set_ydatamode ("auto"); |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4689 } |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4690 |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4691 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
|
4692 float dp = pixel_ysize (); |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4693 |
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4694 limits(0) = limits(0) - dp; |
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4695 limits(1) = limits(1) + dp; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
4696 set_ylim (limits); |
9687
86aa08bbc887
image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents:
9680
diff
changeset
|
4697 } |
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 |
18899
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4699 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
|
4700 { |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4701 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
|
4702 Matrix data; |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4703 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
|
4704 { |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4705 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
|
4706 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
|
4707 } |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4708 return data; |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4709 } |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4710 |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4711 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
|
4712 { |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4713 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
|
4714 Matrix data; |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4715 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
|
4716 { |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4717 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
|
4718 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
|
4719 } |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4720 return data; |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4721 } |
3d9e503aea2c
Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18850
diff
changeset
|
4722 |
11076
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4723 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
|
4724 { |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4725 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
|
4726 float dp; |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4727 |
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
|
4728 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
|
4729 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
|
4730 else |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4731 { |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4732 if (limits(1) == limits(2)) |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4733 dp = 0.5; |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4734 else |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4735 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
|
4736 } |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4737 return dp; |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4738 } |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4739 |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4740 public: |
21562
6c2fd62db1f7
maint: Eliminate accidental double spaces in code.
Rik <rik@octave.org>
parents:
21367
diff
changeset
|
4741 float pixel_xsize (void) |
11076
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4742 { |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4743 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
|
4744 } |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4745 |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4746 float pixel_ysize (void) |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4747 { |
b748b86cb8c1
fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents:
11075
diff
changeset
|
4748 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
|
4749 } |
6874 | 4750 }; |
4751 | |
4752 private: | |
4753 properties xproperties; | |
4754 | |
4755 public: | |
4756 image (const graphics_handle& mh, const graphics_handle& p) | |
4757 : base_graphics_object (), xproperties (mh, p) | |
4758 { | |
19324
68db8396c378
Make "image ()" use the default image cdata
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19087
diff
changeset
|
4759 xproperties.initialize_data (); |
6874 | 4760 } |
4761 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
4762 ~image (void) = default; |
6874 | 4763 |
4764 base_properties& get_properties (void) { return xproperties; } | |
4765 | |
7222 | 4766 const base_properties& get_properties (void) const { return xproperties; } |
4767 | |
6874 | 4768 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
|
4769 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4770 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
|
4771 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
4772 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
|
4773 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
|
4774 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
|
4775 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
|
4776 } |
6874 | 4777 }; |
4778 | |
4779 // --------------------------------------------------------------------- | |
4780 | |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4781 class OCTINTERP_API light : public base_graphics_object |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4782 { |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4783 public: |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4784 class OCTINTERP_API properties : public base_properties |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4785 { |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4786 // 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
|
4787 // properties declarations. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4788 // 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
|
4789 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4790 BEGIN_PROPERTIES (light) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4791 color_property color , color_values (1, 1, 1) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4792 array_property position , default_light_position () |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4793 radio_property style , "{infinite}|local" |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
4794 bool_property visible U , "on" |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4795 END_PROPERTIES |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4796 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4797 protected: |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4798 void init (void) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4799 { |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4800 position.add_constraint (dim_vector (1, 3)); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4801 } |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4802 }; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4803 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4804 private: |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4805 properties xproperties; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4806 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4807 public: |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4808 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
|
4809 : base_graphics_object (), xproperties (mh, p) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4810 { } |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4811 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
4812 ~light (void) = default; |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4813 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4814 base_properties& get_properties (void) { return xproperties; } |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4815 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4816 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
|
4817 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4818 bool valid_object (void) const { return true; } |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4819 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4820 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
|
4821 { |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4822 bool retval = xproperties.has_readonly_property (pname); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4823 if (! retval) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4824 retval = base_properties::has_readonly_property (pname); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4825 return retval; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4826 } |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4827 |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4828 protected: |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4829 void initialize (const graphics_object& go); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4830 }; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4831 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4832 // --------------------------------------------------------------------- |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
21782
diff
changeset
|
4833 |
7365 | 4834 class OCTINTERP_API patch : public base_graphics_object |
6874 | 4835 { |
4836 public: | |
7821
f79dcba526a8
Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7527
diff
changeset
|
4837 class OCTINTERP_API properties : public base_properties |
6874 | 4838 { |
4839 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
|
4840 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
|
4841 |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4842 // 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
|
4843 // The patch should then be ignored by the renderer. |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23401
diff
changeset
|
4844 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
|
4845 { |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4846 msg = bad_data_msg; |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4847 return ! msg.empty (); |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
4848 } |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4849 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4850 bool is_aliminclude (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4851 { 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
|
4852 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
|
4853 { 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
|
4854 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4855 bool is_climinclude (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4856 { 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
|
4857 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
|
4858 { return climinclude.current_value (); } |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4859 |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
4860 bool get_do_lighting (void) const; |
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
4861 |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25273
diff
changeset
|
4862 std::list<std::list<octave_idx_type>> coplanar_last_idx; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25273
diff
changeset
|
4863 |
6874 | 4864 // See the genprops.awk script for an explanation of the |
4865 // properties declarations. | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4866 // Programming note: Keep property list sorted if new ones are added. |
6874 | 4867 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
4868 BEGIN_PROPERTIES (patch) |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4869 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
|
4870 double_property ambientstrength , 0.3 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4871 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
|
4872 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
|
4873 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
|
4874 double_property diffusestrength , 0.6 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4875 string_property displayname , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4876 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
|
4877 color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4878 radio_property edgelighting u , "{none}|flat|gouraud|phong" |
21905
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
4879 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
|
4880 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
|
4881 color_property facecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4882 radio_property facelighting u , "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
|
4883 array_property facenormals m , Matrix () |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4884 radio_property facenormalsmode u , "{auto}|manual" |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4885 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
|
4886 array_property facevertexalphadata , Matrix () |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4887 array_property facevertexcdata u , Matrix () |
25172
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
4888 // FIXME: DEPRECATED: Remove interpreter property in version 6. |
23258
218a49aea031
Deprecate "interpreter" property in primitive graphic objects (partial fix for bug #50496).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
4889 radio_property interpreter hd , "{tex}|none|latex" |
7363 | 4890 radio_property linestyle , "{-}|--|:|-.|none" |
4891 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
|
4892 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
|
4893 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
|
4894 color_property markerfacecolor , color_property (radio_values ("{none}|auto|flat"), color_values (0, 0, 0)) |
7363 | 4895 double_property markersize , 6 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4896 double_property specularcolorreflectance , 1.0 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4897 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
|
4898 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
|
4899 array_property vertexnormals m , Matrix () |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4900 radio_property vertexnormalsmode u , "{auto}|manual" |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4901 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
|
4902 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
|
4903 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
|
4904 array_property zdata u , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4905 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4906 // hidden properties for limit computation |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4907 row_vector_property alim hlr , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4908 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
|
4909 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
|
4910 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
|
4911 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
|
4912 bool_property aliminclude hlg , "on" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
4913 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
|
4914 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
|
4915 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
|
4916 bool_property zliminclude hl , "on" |
6874 | 4917 END_PROPERTIES |
4918 | |
7363 | 4919 protected: |
4920 void init (void) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4921 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
4922 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
|
4923 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
|
4924 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
|
4925 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
|
4926 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
|
4927 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
|
4928 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
|
4929 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
|
4930 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
|
4931 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
|
4932 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
|
4933 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
|
4934 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
|
4935 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
|
4936 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
|
4937 |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
4938 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
|
4939 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
|
4940 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
|
4941 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
|
4942 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
|
4943 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
|
4944 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
|
4945 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
|
4946 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
|
4947 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
|
4948 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
|
4949 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4950 |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4951 public: |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4952 void update_normals (bool reset) |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4953 { |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4954 update_face_normals (reset); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4955 update_vertex_normals (reset); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4956 } |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4957 |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4958 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
4959 private: |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4960 std::string bad_data_msg; |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4961 |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4962 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
|
4963 |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4964 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
|
4965 |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4966 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
|
4967 |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4968 void update_fvc (void); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4969 |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4970 void update_xdata (void) |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4971 { |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23576
diff
changeset
|
4972 if (get_xdata ().isempty ()) |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4973 { |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4974 // For compatibility with matlab behavior, |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4975 // 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
|
4976 // 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
|
4977 set_ydata (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4978 set_zdata (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4979 set_cdata (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4980 set_faces (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4981 } |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4982 else |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4983 { |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4984 update_fvc (); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4985 update_normals (true); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
4986 } |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4987 |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4988 set_xlim (xdata.get_limits ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4989 } |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4990 |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4991 void update_ydata (void) |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
4992 { |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23576
diff
changeset
|
4993 if (get_ydata ().isempty ()) |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4994 { |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4995 set_xdata (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4996 set_zdata (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4997 set_cdata (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4998 set_faces (Matrix ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
4999 } |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5000 else |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5001 { |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5002 update_fvc (); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5003 update_normals (true); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5004 } |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5005 |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5006 set_ylim (ydata.get_limits ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5007 } |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5008 |
19597
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
5009 void update_zdata (void) |
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
5010 { |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5011 update_fvc (); |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5012 update_normals (true); |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5013 set_zlim (zdata.get_limits ()); |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5014 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
diff
changeset
|
5015 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5016 void update_cdata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5017 { |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5018 update_fvc (); |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5019 update_normals (false); |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5020 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5021 if (cdatamapping_is ("scaled")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5022 set_clim (cdata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5023 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5024 clim = cdata.get_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5025 } |
18901
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5026 |
df972b9d080a
Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18899
diff
changeset
|
5027 void update_data (void); |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5028 |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5029 void calc_face_normals (Matrix& normals); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5030 void update_face_normals (bool reset); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5031 void update_vertex_normals (bool reset); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5032 |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5033 void update_edgelighting (void) |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5034 { |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5035 update_face_normals (false); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5036 } |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5037 |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5038 void update_facelighting (void) |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5039 { |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5040 update_normals (false); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5041 } |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5042 |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5043 void update_facenormalsmode (void) |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5044 { |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5045 update_face_normals (false); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5046 } |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5047 |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5048 void update_vertexnormalsmode (void) |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5049 { |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5050 update_vertex_normals (false); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5051 } |
6874 | 5052 }; |
5053 | |
5054 private: | |
5055 properties xproperties; | |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5056 property_list default_properties; |
6874 | 5057 |
5058 public: | |
5059 patch (const graphics_handle& mh, const graphics_handle& p) | |
5060 : 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
|
5061 { } |
6874 | 5062 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5063 ~patch (void) = default; |
6874 | 5064 |
5065 base_properties& get_properties (void) { return xproperties; } | |
5066 | |
7222 | 5067 const base_properties& get_properties (void) const { return xproperties; } |
5068 | |
6874 | 5069 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
|
5070 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5071 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
|
5072 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5073 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
|
5074 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
|
5075 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
|
5076 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
|
5077 } |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5078 |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5079 void reset_default_properties (void); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5080 |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5081 protected: |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5082 void initialize (const graphics_object& go); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25423
diff
changeset
|
5083 |
6874 | 5084 }; |
5085 | |
5086 // --------------------------------------------------------------------- | |
5087 | |
7365 | 5088 class OCTINTERP_API surface : public base_graphics_object |
6874 | 5089 { |
5090 public: | |
7821
f79dcba526a8
Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7527
diff
changeset
|
5091 class OCTINTERP_API properties : public base_properties |
6874 | 5092 { |
5093 public: | |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5094 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
|
5095 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5096 bool is_aliminclude (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5097 { 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
|
5098 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
|
5099 { 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
|
5100 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5101 bool is_climinclude (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5102 { 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
|
5103 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
|
5104 { return climinclude.current_value (); } |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5105 |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
5106 bool get_do_lighting (void) const; |
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
5107 |
6874 | 5108 // See the genprops.awk script for an explanation of the |
5109 // properties declarations. | |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5110 // Programming note: Keep property list sorted if new ones are added. |
6874 | 5111 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
5112 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
|
5113 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
|
5114 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
|
5115 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
|
5116 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
|
5117 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
|
5118 radio_property cdatamapping al , "{scaled}|direct" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5119 string_property cdatasource , "" |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5120 double_property diffusestrength , 0.6 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5121 string_property displayname , "" |
7846
d7737a4268b7
Fix typos in property names (edgealpha/facealpha).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7844
diff
changeset
|
5122 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
|
5123 color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5124 radio_property edgelighting u , "{none}|flat|gouraud|phong" |
21905
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
5125 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
|
5126 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
|
5127 color_property facecolor , color_property (radio_values ("none|{flat}|interp|texturemap"), color_values (0, 0, 0)) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5128 radio_property facelighting u , "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
|
5129 array_property facenormals m , Matrix () |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5130 radio_property facenormalsmode u , "{auto}|manual" |
25172
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
5131 // FIXME: DEPRECATED: Remove interpreter property in version 6. |
23258
218a49aea031
Deprecate "interpreter" property in primitive graphic objects (partial fix for bug #50496).
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
5132 radio_property interpreter hd , "{tex}|none|latex" |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5133 radio_property linestyle , "{-}|--|:|-.|none" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5134 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
|
5135 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
|
5136 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
|
5137 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
|
5138 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
|
5139 radio_property meshstyle , "{both}|row|column" |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5140 double_property specularcolorreflectance , 1 |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5141 double_property specularexponent , 10 |
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5142 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
|
5143 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
|
5144 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
|
5145 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
|
5146 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
|
5147 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
|
5148 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
|
5149 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
|
5150 string_property zdatasource , "" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5151 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5152 // hidden properties for limit computation |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5153 row_vector_property alim hlr , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5154 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
|
5155 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
|
5156 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
|
5157 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
|
5158 bool_property aliminclude hlg , "on" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5159 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
|
5160 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
|
5161 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
|
5162 bool_property zliminclude hl , "on" |
6874 | 5163 END_PROPERTIES |
5164 | |
7363 | 5165 protected: |
5166 void init (void) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5167 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5168 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
|
5169 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
|
5170 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
|
5171 cdata.add_constraint ("double"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5172 cdata.add_constraint ("single"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5173 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
|
5174 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
|
5175 alphadata.add_constraint ("double"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5176 alphadata.add_constraint ("uint8"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5177 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
|
5178 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
|
5179 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
|
5180 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
|
5181 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
|
5182 |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5183 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
|
5184 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
|
5185 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
|
5186 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
|
5187 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
|
5188 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
|
5189 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
|
5190 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
|
5191 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
|
5192 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
|
5193 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
|
5194 } |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5195 |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5196 public: |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5197 void update_normals (bool reset) |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5198 { |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5199 update_face_normals (reset); |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5200 update_vertex_normals (reset); |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5201 } |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5202 |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5203 |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5204 private: |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5205 void update_alphadata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5206 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5207 if (alphadatamapping_is ("scaled")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5208 set_alim (alphadata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5209 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5210 alim = alphadata.get_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5211 } |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5212 |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5213 void update_cdata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5214 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5215 if (cdatamapping_is ("scaled")) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5216 set_clim (cdata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5217 else |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5218 clim = cdata.get_limits (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5219 } |
7829
8ca8e97e8c0a
Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7828
diff
changeset
|
5220 |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5221 void update_xdata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5222 { |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5223 update_normals (true); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5224 set_xlim (xdata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5225 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11577
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 void update_ydata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5228 { |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5229 update_normals (true); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5230 set_ylim (ydata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5231 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5232 |
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5233 void update_zdata (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5234 { |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5235 update_normals (true); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5236 set_zlim (zdata.get_limits ()); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5237 } |
7862
8f3459a90bf3
Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7860
diff
changeset
|
5238 |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5239 void update_face_normals (bool reset); |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5240 void update_vertex_normals (bool reset); |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5241 |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5242 void update_facenormalsmode (void) |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5243 { update_face_normals (false); } |
21654
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5244 |
a0ebc922fd52
Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents:
21568
diff
changeset
|
5245 void update_vertexnormalsmode (void) |
25867
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5246 { update_vertex_normals (false); } |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5247 |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5248 void update_edgelighting (void) |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5249 { update_normals (false); } |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5250 |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5251 void update_facelighting (void) |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5252 { update_normals (false); } |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5253 |
49ffa78f9243
Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25449
diff
changeset
|
5254 |
6874 | 5255 }; |
5256 | |
5257 private: | |
5258 properties xproperties; | |
5259 | |
5260 public: | |
5261 surface (const graphics_handle& mh, const graphics_handle& p) | |
5262 : 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
|
5263 { } |
6874 | 5264 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5265 ~surface (void) = default; |
6874 | 5266 |
5267 base_properties& get_properties (void) { return xproperties; } | |
5268 | |
7222 | 5269 const base_properties& get_properties (void) const { return xproperties; } |
5270 | |
6874 | 5271 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
|
5272 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5273 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
|
5274 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5275 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
|
5276 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
|
5277 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
|
5278 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
|
5279 } |
6874 | 5280 }; |
5281 | |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5282 // --------------------------------------------------------------------- |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5283 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5284 class OCTINTERP_API hggroup : public base_graphics_object |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5285 { |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5286 public: |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5287 class OCTINTERP_API properties : public base_properties |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5288 { |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5289 public: |
25423
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
5290 void remove_child (const graphics_handle& h); |
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
5291 |
13b1b9a0d9c5
Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
5292 void adopt (const graphics_handle& h); |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5293 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5294 // 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
|
5295 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5296 // 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
|
5297 |
8247
e41f420875db
set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents:
8222
diff
changeset
|
5298 BEGIN_PROPERTIES (hggroup) |
15519
f915996325b7
Add missing DisplayName and EraseMode properties to hggroups (bug #37442)
Ben Abbott <bpabbott@mac.com>
parents:
15468
diff
changeset
|
5299 string_property displayname , "" |
21905
0c3f7fec9c1e
Hide "erasemode" graphics property ahead of eventual removal.
Rik <rik@octave.org>
parents:
21880
diff
changeset
|
5300 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
|
5301 |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5302 // hidden properties for limit computation |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5303 row_vector_property alim hr , Matrix () |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5304 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
|
5305 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
|
5306 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
|
5307 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
|
5308 bool_property aliminclude h , "on" |
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5309 bool_property climinclude h , "on" |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5310 bool_property xliminclude h , "on" |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5311 bool_property yliminclude h , "on" |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5312 bool_property zliminclude h , "on" |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5313 END_PROPERTIES |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5314 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5315 private: |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5316 void update_limits (void) const; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5317 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5318 void update_limits (const graphics_handle& h) const; |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5319 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5320 protected: |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5321 void init (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5322 { } |
11175
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
5323 |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5324 }; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5325 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5326 private: |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5327 properties xproperties; |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5328 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5329 public: |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5330 hggroup (const graphics_handle& mh, const graphics_handle& p) |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5331 : 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
|
5332 { } |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5333 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5334 ~hggroup (void) = default; |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5335 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5336 base_properties& get_properties (void) { return xproperties; } |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5337 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5338 const base_properties& get_properties (void) const { return xproperties; } |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5339 |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5340 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
|
5341 |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5342 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
|
5343 |
c0a95a5c6d25
Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents:
11167
diff
changeset
|
5344 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
|
5345 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
|
5346 |
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
|
5347 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
|
5348 { |
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 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
|
5350 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
|
5351 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
|
5352 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
|
5353 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5354 |
7865
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5355 }; |
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 // --------------------------------------------------------------------- |
b74039822fd2
Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents:
7864
diff
changeset
|
5358 |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5359 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
|
5360 { |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5361 public: |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5362 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
|
5363 { |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5364 public: |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5365 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
|
5366 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5367 base_properties::remove_child (h); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5368 } |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5369 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5370 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
|
5371 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5372 base_properties::adopt (h); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5373 } |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5374 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5375 // 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
|
5376 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5377 // 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
|
5378 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5379 BEGIN_PROPERTIES (uimenu) |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5380 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
|
5381 callback_property callback , Matrix () |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5382 bool_property checked , "off" |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5383 bool_property enable , "on" |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5384 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
|
5385 string_property label , "" |
20045
ae12edf69bce
Set default uimenu position property to 0 (Bug #44770)
John Donoghue
parents:
19987
diff
changeset
|
5386 double_property position , 0 |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5387 bool_property separator , "off" |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5388 |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5389 // 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
|
5390 string_property __fltk_label__ h , "" |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5391 any_property __object__ h , Matrix () |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5392 END_PROPERTIES |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5393 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5394 protected: |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5395 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
|
5396 { |
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5397 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
|
5398 } |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5399 }; |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5400 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5401 private: |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5402 properties xproperties; |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5403 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5404 public: |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5405 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
|
5406 : 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
|
5407 { } |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5408 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5409 ~uimenu (void) = default; |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5410 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5411 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
|
5412 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5413 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
|
5414 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5415 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
|
5416 |
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
|
5417 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
|
5418 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5419 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
|
5420 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
|
5421 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
|
5422 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
|
5423 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5424 |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5425 }; |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5426 |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5427 // --------------------------------------------------------------------- |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
11089
diff
changeset
|
5428 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5429 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
|
5430 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5431 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5432 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
|
5433 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5434 public: |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20171
diff
changeset
|
5435 |
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20171
diff
changeset
|
5436 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
|
5437 { dependent_obj_list.push_back (gh); } |
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5438 |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20171
diff
changeset
|
5439 // FIXME: the list may contain duplicates. |
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20171
diff
changeset
|
5440 // Should we return only unique elements? |
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20171
diff
changeset
|
5441 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
|
5442 { return dependent_obj_list; } |
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5443 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5444 // 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
|
5445 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5446 // 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
|
5447 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5448 BEGIN_PROPERTIES (uicontextmenu) |
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
|
5449 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
|
5450 array_property position , Matrix (1, 2, 0.0) |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5451 |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5452 // Octave-specific properties |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5453 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
|
5454 END_PROPERTIES |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5455 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5456 protected: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5457 void init (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5458 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5459 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
|
5460 position.add_constraint (dim_vector (2, 1)); |
20171
b70f8da6dcd3
Default uicontextmenu visible to 'off' (Bug #44939)
John Donoghue
parents:
20077
diff
changeset
|
5461 visible.set (octave_value (false)); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5462 } |
20077
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5463 |
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5464 private: |
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5465 // 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
|
5466 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
|
5467 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5468 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5469 private: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5470 properties xproperties; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5471 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5472 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5473 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
|
5474 : 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
|
5475 { } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5476 |
20077
69f92e0affd2
Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20051
diff
changeset
|
5477 ~uicontextmenu (void); |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5478 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5479 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
|
5480 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5481 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
|
5482 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5483 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
|
5484 |
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
|
5485 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
|
5486 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5487 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
|
5488 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
|
5489 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
|
5490 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
|
5491 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5492 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5493 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5494 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5495 // --------------------------------------------------------------------- |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5496 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5497 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
|
5498 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5499 public: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5500 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
|
5501 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5502 public: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5503 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
|
5504 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
|
5505 |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
5506 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
|
5507 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5508 // 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
|
5509 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5510 // 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
|
5511 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5512 BEGIN_PROPERTIES (uicontrol) |
25429
ecc488aa56a0
Change default ui* objects color for compatibility (bug #53805)
Guillaume Flandin <guillaume.offline@gmail.com>
parents:
25425
diff
changeset
|
5513 color_property backgroundcolor , color_values (0.94, 0.94, 0.94) |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5514 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
|
5515 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
|
5516 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
|
5517 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
|
5518 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
|
5519 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
|
5520 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
|
5521 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
|
5522 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
|
5523 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
|
5524 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
|
5525 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
|
5526 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
|
5527 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
|
5528 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
|
5529 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
|
5530 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
|
5531 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
|
5532 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
|
5533 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
|
5534 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
|
5535 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
|
5536 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
|
5537 radio_property verticalalignment , "top|{middle}|bottom" |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5538 |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5539 // Octave-specific properties |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5540 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
|
5541 END_PROPERTIES |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5542 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5543 private: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5544 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
|
5545 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5546 protected: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5547 void init (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5548 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5549 cdata.add_constraint ("double"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5550 cdata.add_constraint ("single"); |
25891
54635fcf99b8
uicontrol: Allow uint8 for "cdata" (bug #54697).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25884
diff
changeset
|
5551 cdata.add_constraint ("uint8"); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5552 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
|
5553 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
|
5554 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
|
5555 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
|
5556 cached_units = get_units (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5557 } |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5558 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5559 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
|
5560 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5561 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
|
5562 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
|
5563 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
|
5564 void update_fontangle (void) { update_text_extent (); } |
23210
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5565 |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23258
diff
changeset
|
5566 void update_fontweight (void) |
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23258
diff
changeset
|
5567 { |
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23258
diff
changeset
|
5568 update_text_extent (); |
25172
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
5569 // FIXME: DEPRECATED: Remove warning with demi and light in |
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
5570 // version 6. |
23210
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5571 if (fontweight.is ("demi") || fontweight.is ("light")) |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5572 warning_with_id ("Octave:deprecated-property", |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5573 "Setting 'fontweight' to '%s' is deprecated, \ |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5574 use 'normal' or 'bold'.", fontweight.current_value ().c_str ()); |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5575 } |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5576 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5577 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
|
5578 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5579 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
|
5580 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5581 }; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5582 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5583 private: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5584 properties xproperties; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5585 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5586 public: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5587 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
|
5588 : 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
|
5589 { } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5590 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5591 ~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
|
5592 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5593 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
|
5594 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5595 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
|
5596 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5597 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
|
5598 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5599 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
|
5600 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5601 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
|
5602 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
|
5603 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
|
5604 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
|
5605 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5606 }; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5607 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5608 // --------------------------------------------------------------------- |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5609 |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5610 class OCTINTERP_API uibuttongroup : public base_graphics_object |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5611 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5612 public: |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5613 class OCTINTERP_API properties : public base_properties |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5614 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5615 public: |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5616 Matrix get_boundingbox (bool internal = false, |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5617 const Matrix& parent_pix_size = Matrix ()) const; |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5618 |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
5619 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
|
5620 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5621 // See the genprops.awk script for an explanation of the |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5622 // properties declarations. |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5623 // 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
|
5624 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5625 BEGIN_PROPERTIES (uibuttongroup) |
25429
ecc488aa56a0
Change default ui* objects color for compatibility (bug #53805)
Guillaume Flandin <guillaume.offline@gmail.com>
parents:
25425
diff
changeset
|
5626 color_property backgroundcolor , color_values (0.94, 0.94, 0.94) |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5627 radio_property bordertype , "none|{etchedin}|etchedout|beveledin|beveledout|line" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5628 double_property borderwidth , 1 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5629 bool_property clipping , "on" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5630 radio_property fontangle , "{normal}|italic|oblique" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5631 string_property fontname , OCTAVE_DEFAULT_FONTNAME |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5632 double_property fontsize , 10 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5633 radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels" |
23210
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5634 radio_property fontweight u , "light|{normal}|demi|bold" |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5635 color_property foregroundcolor , color_values (0, 0, 0) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5636 color_property highlightcolor , color_values (1, 1, 1) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5637 array_property position , default_panel_position () |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5638 callback_property resizefcn , Matrix () |
24120
0d446e938f1f
maint: clean up code formatting in generated graphics.h
Mike Miller <mtmiller@octave.org>
parents:
24071
diff
changeset
|
5639 handle_property selectedobject S , graphics_handle () |
0d446e938f1f
maint: clean up code formatting in generated graphics.h
Mike Miller <mtmiller@octave.org>
parents:
24071
diff
changeset
|
5640 callback_property selectionchangedfcn , Matrix () |
25449
d2d9701d2dcb
Change default ShadowColor property to match Matlab (bug #53805).
Rik <rik@octave.org>
parents:
25436
diff
changeset
|
5641 color_property shadowcolor , color_values (0.7, 0.7, 0.7) |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5642 callback_property sizechangedfcn , Matrix () |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5643 radio_property units S , "{normalized}|inches|centimeters|points|pixels|characters" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5644 string_property title , "" |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5645 radio_property titleposition , "{lefttop}|centertop|righttop|leftbottom|centerbottom|rightbottom" |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5646 |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5647 // Octave-specific properties |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5648 any_property __object__ h , Matrix () |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5649 END_PROPERTIES |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5650 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5651 protected: |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5652 void init (void) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5653 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5654 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
|
5655 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
|
5656 fontsize.add_constraint ("min", 0.0, false); |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5657 } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5658 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5659 // void update_text_extent (void); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5660 // void update_string (void) { update_text_extent (); } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5661 // void update_fontname (void) { update_text_extent (); } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5662 // void update_fontsize (void) { update_text_extent (); } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5663 // void update_fontangle (void) { update_text_extent (); } |
23210
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5664 |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23258
diff
changeset
|
5665 void update_fontweight (void) |
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23258
diff
changeset
|
5666 { |
25172
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
5667 // FIXME: DEPRECATED: Remove this warning in version 6. |
23210
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5668 if (fontweight.is ("demi") || fontweight.is ("light")) |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5669 warning_with_id ("Octave:deprecated-property", |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5670 "Setting 'fontweight' to '%s' is deprecated, \ |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5671 use 'normal' or 'bold'.", fontweight.current_value ().c_str ()); |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5672 } |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5673 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5674 void update_units (const caseless_str& old_units); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5675 void update_fontunits (const caseless_str& old_units); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5676 |
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 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5679 private: |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5680 properties xproperties; |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5681 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5682 public: |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5683 uibuttongroup (const graphics_handle& mh, const graphics_handle& p) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5684 : base_graphics_object (), xproperties (mh, p) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5685 { } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5686 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5687 ~uibuttongroup (void) = default; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5688 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5689 base_properties& get_properties (void) { return xproperties; } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5690 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5691 const base_properties& get_properties (void) const { return xproperties; } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5692 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5693 bool valid_object (void) const { return true; } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5694 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5695 bool has_readonly_property (const caseless_str& pname) const |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5696 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5697 bool retval = xproperties.has_readonly_property (pname); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5698 if (! retval) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5699 retval = base_properties::has_readonly_property (pname); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5700 return retval; |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5701 } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5702 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5703 }; |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5704 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5705 // --------------------------------------------------------------------- |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
21789
diff
changeset
|
5706 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5707 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
|
5708 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5709 public: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5710 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
|
5711 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5712 public: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5713 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
|
5714 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
|
5715 |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
5716 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
|
5717 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5718 // 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
|
5719 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5720 // 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
|
5721 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5722 BEGIN_PROPERTIES (uipanel) |
25429
ecc488aa56a0
Change default ui* objects color for compatibility (bug #53805)
Guillaume Flandin <guillaume.offline@gmail.com>
parents:
25425
diff
changeset
|
5723 color_property backgroundcolor , color_values (0.94, 0.94, 0.94) |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5724 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
|
5725 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
|
5726 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
|
5727 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
|
5728 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
|
5729 radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels" |
23210
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5730 radio_property fontweight u , "light|{normal}|demi|bold" |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5731 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
|
5732 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
|
5733 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
|
5734 callback_property resizefcn , Matrix () |
25449
d2d9701d2dcb
Change default ShadowColor property to match Matlab (bug #53805).
Rik <rik@octave.org>
parents:
25436
diff
changeset
|
5735 color_property shadowcolor , color_values (0.7, 0.7, 0.7) |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5736 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
|
5737 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
|
5738 radio_property units S , "{normalized}|inches|centimeters|points|pixels|characters" |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5739 // Octave-specific properties |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5740 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
|
5741 END_PROPERTIES |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5742 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5743 protected: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5744 void init (void) |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19834
diff
changeset
|
5745 { |
22831
96228c17a66a
Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22759
diff
changeset
|
5746 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
|
5747 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
|
5748 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
|
5749 } |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
18819
diff
changeset
|
5750 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5751 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
|
5752 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
|
5753 |
23396
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23258
diff
changeset
|
5754 void update_fontweight (void) |
945b53af4655
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
23258
diff
changeset
|
5755 { |
25172
7b1b504c2f12
update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
5756 // FIXME: DEPRECATED: Remove this warning in version 6. |
23210
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5757 if (fontweight.is ("demi") || fontweight.is ("light")) |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5758 warning_with_id ("Octave:deprecated-property", |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5759 "Setting 'fontweight' to '%s' is deprecated, \ |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5760 use 'normal' or 'bold'.", fontweight.current_value ().c_str ()); |
3a298e07002c
Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
23201
diff
changeset
|
5761 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5762 }; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5763 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5764 private: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5765 properties xproperties; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5766 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5767 public: |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5768 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
|
5769 : 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
|
5770 { } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5771 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5772 ~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
|
5773 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5774 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
|
5775 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5776 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
|
5777 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5778 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
|
5779 |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5780 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
|
5781 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5782 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
|
5783 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
|
5784 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
|
5785 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
|
5786 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5787 }; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5788 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5789 // --------------------------------------------------------------------- |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
5790 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5791 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
|
5792 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5793 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5794 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
|
5795 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5796 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5797 // 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
|
5798 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5799 // 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
|
5800 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5801 BEGIN_PROPERTIES (uitoolbar) |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5802 // Octave-specific properties |
20593
3af34e1ef330
Preliminary inclusion of uixx objects properties in the manual (bug #46076)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
20545
diff
changeset
|
5803 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
|
5804 END_PROPERTIES |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5805 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5806 protected: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5807 void init (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5808 { } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5809 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5810 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5811 private: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5812 properties xproperties; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5813 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5814 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5815 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
|
5816 : 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
|
5817 { } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5818 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5819 ~uitoolbar (void) = default; |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5820 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5821 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
|
5822 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5823 // 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
|
5824 // 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
|
5825 xproperties.override_defaults (obj); |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5826 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5827 // 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
|
5828 // 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
|
5829 // 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
|
5830 // 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
|
5831 // 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
|
5832 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
|
5833 } |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5834 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5835 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
|
5836 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5837 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
|
5838 // 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
|
5839 // 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
|
5840 // default_properties map. |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5841 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
|
5842 else |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5843 xproperties.set (name, value); |
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 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5846 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
|
5847 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5848 octave_value retval; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5849 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5850 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
|
5851 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
|
5852 else |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5853 retval = xproperties.get (name); |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5854 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5855 return retval; |
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 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5858 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
|
5859 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5860 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
|
5861 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5862 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
|
5863 } |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5864 |
19666
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
5865 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
|
5866 { |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
5867 return default_properties; |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
5868 } |
e7df12f37f71
Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
19663
diff
changeset
|
5869 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5870 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
|
5871 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5872 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
|
5873 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5874 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
|
5875 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5876 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
|
5877 |
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
|
5878 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
|
5879 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5880 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
|
5881 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
|
5882 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
|
5883 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
|
5884 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5885 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5886 private: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5887 property_list default_properties; |
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 |
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 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5892 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
|
5893 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5894 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5895 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
|
5896 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5897 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5898 // 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
|
5899 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5900 // 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
|
5901 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5902 BEGIN_PROPERTIES (uipushtool) |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5903 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
|
5904 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
|
5905 bool_property enable , "on" |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5906 bool_property separator , "off" |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5907 string_property tooltipstring , "" |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5908 |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5909 // Octave-specific properties |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5910 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
|
5911 END_PROPERTIES |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5912 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5913 protected: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5914 void init (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5915 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5916 cdata.add_constraint ("double"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5917 cdata.add_constraint ("single"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5918 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
|
5919 } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5920 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5921 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5922 private: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5923 properties xproperties; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5924 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5925 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5926 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
|
5927 : 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
|
5928 { } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5929 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5930 ~uipushtool (void) = default; |
13703
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 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
|
5933 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5934 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
|
5935 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5936 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
|
5937 |
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
|
5938 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
|
5939 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5940 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
|
5941 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
|
5942 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
|
5943 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
|
5944 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
5945 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5946 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5947 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5948 // --------------------------------------------------------------------- |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5949 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5950 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
|
5951 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5952 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5953 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
|
5954 { |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5955 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5956 // 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
|
5957 // properties declarations. |
17099
a033fd3669c0
Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents:
17098
diff
changeset
|
5958 // 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
|
5959 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5960 BEGIN_PROPERTIES (uitoggletool) |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5961 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
|
5962 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
|
5963 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
|
5964 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
|
5965 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
|
5966 bool_property separator , "off" |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5967 bool_property state , "off" |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5968 string_property tooltipstring , "" |
24452
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5969 |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5970 // Octave-specific properties |
55ddb7a4cca2
Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents:
24451
diff
changeset
|
5971 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
|
5972 END_PROPERTIES |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5973 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5974 protected: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5975 void init (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5976 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5977 cdata.add_constraint ("double"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5978 cdata.add_constraint ("single"); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
5979 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
|
5980 } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5981 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5982 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5983 private: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5984 properties xproperties; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5985 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5986 public: |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5987 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
|
5988 : 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
|
5989 { } |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5990 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
5991 ~uitoggletool (void) = default; |
13703
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 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
|
5994 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5995 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
|
5996 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
5997 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
|
5998 |
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
|
5999 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
|
6000 { |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
6001 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
|
6002 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
|
6003 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
|
6004 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
|
6005 } |
8d5cb159fbc7
Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18119
diff
changeset
|
6006 |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6007 }; |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6008 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6009 // --------------------------------------------------------------------- |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13699
diff
changeset
|
6010 |
6874 | 6011 octave_value |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
6012 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
|
6013 const std::string& func); |
6874 | 6014 bool |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
6015 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
|
6016 const octave_value& arg, const std::string& func); |
6874 | 6017 |
6018 // --------------------------------------------------------------------- | |
6019 | |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6020 class graphics_event; |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6021 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6022 class |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6023 base_graphics_event |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6024 { |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6025 public: |
25960
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6026 enum priority { INTERRUPT, QUEUE, CANCEL }; |
24252
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6027 |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6028 friend class graphics_event; |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6029 |
25960
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6030 base_graphics_event (void) |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6031 : m_busyaction (QUEUE) |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6032 { }; |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6033 |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6034 base_graphics_event (int busyaction) |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6035 : m_busyaction (busyaction) |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6036 { }; |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6037 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
6038 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
|
6039 |
25960
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6040 int get_busyaction (void) { return m_busyaction; }; |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6041 |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6042 virtual void execute (void) = 0; |
25960
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6043 |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6044 private: |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6045 int m_busyaction; |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6046 }; |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6047 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6048 class |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6049 graphics_event |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6050 { |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6051 public: |
24252
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6052 |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6053 typedef void (*event_fcn) (void*); |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6054 |
24252
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6055 graphics_event (void) = default; |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6056 |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6057 graphics_event (base_graphics_event *new_rep) : rep (new_rep) { } |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6058 |
24991
831389905438
omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents:
24795
diff
changeset
|
6059 graphics_event (const graphics_event&) = default; |
24252
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6060 |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6061 ~graphics_event (void) = default; |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6062 |
24991
831389905438
omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents:
24795
diff
changeset
|
6063 graphics_event& operator = (const graphics_event&) = default; |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6064 |
25960
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6065 int get_busyaction (void) |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6066 { |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6067 if (ok ()) |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6068 return rep->get_busyaction (); |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6069 else |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6070 error ("graphics_event::busyaction: invalid graphics_event"); |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6071 } |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6072 |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6073 void execute (void) |
24252
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6074 { |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6075 if (ok ()) |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6076 rep->execute (); |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6077 } |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6078 |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6079 bool ok (void) const { return (rep != nullptr); } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6080 |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6081 static graphics_event |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6082 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
|
6083 const std::string& name, |
25960
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6084 const octave_value& data = Matrix (), |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6085 int busyaction = base_graphics_event::QUEUE); |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6086 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6087 static graphics_event |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6088 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
|
6089 const octave_value& cb, |
25960
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6090 const octave_value& data = Matrix (), |
ae9d6a491c06
Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25903
diff
changeset
|
6091 int busyaction = base_graphics_event::QUEUE); |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6092 |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6093 static graphics_event |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
6094 create_function_event (event_fcn fcn, void *data = nullptr); |
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 static graphics_event |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6097 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
|
6098 const octave_value& value, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6099 bool notify_toolkit = true); |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6100 private: |
24252
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6101 |
f8c263f961c1
use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents:
24191
diff
changeset
|
6102 std::shared_ptr <base_graphics_event> rep; |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6103 }; |
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6104 |
7365 | 6105 class OCTINTERP_API gh_manager |
6874 | 6106 { |
6107 protected: | |
6108 | |
6109 gh_manager (void); | |
6110 | |
6111 public: | |
6112 | |
13992
e1f76bfe0452
apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents:
13985
diff
changeset
|
6113 static void create_instance (void); |
e1f76bfe0452
apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents:
13985
diff
changeset
|
6114 |
6874 | 6115 static bool instance_ok (void) |
6116 { | |
6117 bool retval = true; | |
6118 | |
6119 if (! instance) | |
13992
e1f76bfe0452
apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents:
13985
diff
changeset
|
6120 create_instance (); |
6874 | 6121 |
6122 if (! instance) | |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
6123 error ("unable to create gh_manager!"); |
6874 | 6124 |
6125 return retval; | |
6126 } | |
6127 | |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23774
diff
changeset
|
6128 static void cleanup_instance (void) { delete instance; instance = nullptr; } |
13992
e1f76bfe0452
apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents:
13985
diff
changeset
|
6129 |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6130 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
|
6131 { |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6132 return instance_ok () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6133 ? 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
|
6134 : graphics_handle (); |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6135 } |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6136 |
6874 | 6137 static void free (const graphics_handle& h) |
6138 { | |
6139 if (instance_ok ()) | |
6140 instance->do_free (h); | |
6141 } | |
6142 | |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6143 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
|
6144 const graphics_handle& new_gh) |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6145 { |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6146 if (instance_ok ()) |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6147 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
|
6148 } |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6149 |
6874 | 6150 static graphics_handle lookup (double val) |
6151 { | |
6152 return instance_ok () ? instance->do_lookup (val) : graphics_handle (); | |
6153 } | |
6154 | |
10265
8c583af2cf64
validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents:
10161
diff
changeset
|
6155 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
|
6156 { |
8c583af2cf64
validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents:
10161
diff
changeset
|
6157 return val.is_real_scalar () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6158 ? 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
|
6159 } |
8c583af2cf64
validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents:
10161
diff
changeset
|
6160 |
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
|
6161 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
|
6162 { |
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
|
6163 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
|
6164 } |
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
|
6165 |
6874 | 6166 static graphics_object get_object (const graphics_handle& h) |
6167 { | |
6168 return instance_ok () ? instance->do_get_object (h) : graphics_object (); | |
6169 } | |
6170 | |
6171 static graphics_handle | |
6172 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
|
6173 const graphics_handle& parent, |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6174 bool integer_figure_handle = false, |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6175 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
|
6176 bool do_notify_toolkit = true) |
6874 | 6177 { |
6178 return instance_ok () | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6179 ? 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
|
6180 integer_figure_handle, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6181 do_createfcn, do_notify_toolkit) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6182 : graphics_handle (); |
6874 | 6183 } |
6184 | |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6185 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
|
6186 bool do_notify_toolkit = true) |
6874 | 6187 { |
6188 return instance_ok () | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6189 ? 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
|
6190 : graphics_handle (); |
6874 | 6191 } |
6192 | |
6193 static void push_figure (const graphics_handle& h) | |
6194 { | |
6195 if (instance_ok ()) | |
6196 instance->do_push_figure (h); | |
6197 } | |
6198 | |
6199 static void pop_figure (const graphics_handle& h) | |
6200 { | |
6201 if (instance_ok ()) | |
6202 instance->do_pop_figure (h); | |
6203 } | |
6204 | |
6205 static graphics_handle current_figure (void) | |
6206 { | |
6207 return instance_ok () | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6208 ? instance->do_current_figure () : graphics_handle (); |
6874 | 6209 } |
6210 | |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6211 static Matrix handle_list (bool show_hidden = false) |
6874 | 6212 { |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6213 return instance_ok () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6214 ? instance->do_handle_list (show_hidden) : Matrix (); |
6874 | 6215 } |
6216 | |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6217 static void lock (void) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6218 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6219 if (instance_ok ()) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6220 instance->do_lock (); |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6221 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6222 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6223 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
|
6224 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6225 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
|
6226 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
|
6227 else |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6228 return false; |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6229 } |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6230 |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6231 static void unlock (void) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6232 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6233 if (instance_ok ()) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6234 instance->do_unlock (); |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6235 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6236 |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6237 static Matrix figure_handle_list (bool show_hidden = false) |
6874 | 6238 { |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6239 return instance_ok () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6240 ? instance->do_figure_handle_list (show_hidden) : Matrix (); |
6874 | 6241 } |
6242 | |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6243 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
|
6244 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
|
6245 { |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6246 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
|
6247 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
|
6248 } |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6249 |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6250 static void execute_callback (const graphics_handle& h, |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
6251 const std::string& name, |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
6252 const octave_value& data = Matrix ()) |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6253 { |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6254 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
|
6255 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6256 if (true) |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6257 { |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6258 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
|
6259 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6260 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
|
6261 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6262 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
|
6263 cb = go.get (name); |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6264 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6265 |
20545
c547458dc10e
eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents:
20459
diff
changeset
|
6266 execute_callback (h, cb, data); |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6267 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6268 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6269 static void execute_callback (const graphics_handle& h, |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
6270 const octave_value& cb, |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
6271 const octave_value& data = Matrix ()) |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6272 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6273 if (instance_ok ()) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6274 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
|
6275 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6276 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6277 static void post_callback (const graphics_handle& h, |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
6278 const std::string& name, |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10289
diff
changeset
|
6279 const octave_value& data = Matrix ()) |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6280 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6281 if (instance_ok ()) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6282 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
|
6283 } |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6284 |
23457
21baad6b35c4
maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
6285 static void post_function (graphics_event::event_fcn fcn, void *data = nullptr) |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6286 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6287 if (instance_ok ()) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6288 instance->do_post_function (fcn, data); |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6289 } |
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 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
|
6292 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
|
6293 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6294 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
|
6295 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
|
6296 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6297 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6298 static int process_events (void) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6299 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6300 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
|
6301 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6302 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6303 static int flush_events (void) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6304 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6305 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
|
6306 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6307 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6308 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
|
6309 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6310 if (instance_ok ()) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6311 instance->do_enable_event_processing (enable); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6312 } |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6313 |
8249 | 6314 static bool is_handle_visible (const graphics_handle& h) |
6315 { | |
6316 bool retval = false; | |
6317 | |
6318 graphics_object go = get_object (h); | |
6319 | |
6320 if (go.valid_object ()) | |
6321 retval = go.is_handle_visible (); | |
6322 | |
6323 return retval; | |
6324 } | |
6325 | |
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
|
6326 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
|
6327 { |
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
|
6328 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
|
6329 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
|
6330 } |
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
|
6331 |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6332 public: |
23057
bb7513d73673
move mutex classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23012
diff
changeset
|
6333 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
|
6334 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6335 public: |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6336 auto_lock (bool wait = true) |
23057
bb7513d73673
move mutex classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23012
diff
changeset
|
6337 : octave::autolock (instance_ok () |
bb7513d73673
move mutex classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23012
diff
changeset
|
6338 ? instance->graphics_lock |
bb7513d73673
move mutex classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23012
diff
changeset
|
6339 : octave::mutex (), |
bb7513d73673
move mutex classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23012
diff
changeset
|
6340 wait) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6341 { } |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6342 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6343 // 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
|
6344 |
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22831
diff
changeset
|
6345 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
|
6346 |
89756f2f085b
use c++11 style for deleting default copy constructor and assignment operator
John W. Eaton <jwe@octave.org>
parents:
22831
diff
changeset
|
6347 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
|
6348 }; |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6349 |
6874 | 6350 private: |
6351 | |
6352 static gh_manager *instance; | |
6353 | |
6354 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
|
6355 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
|
6356 const_iterator; |
6874 | 6357 |
6358 typedef std::set<graphics_handle>::iterator free_list_iterator; | |
6359 typedef std::set<graphics_handle>::const_iterator const_free_list_iterator; | |
6360 | |
6361 typedef std::list<graphics_handle>::iterator figure_list_iterator; | |
6362 typedef std::list<graphics_handle>::const_iterator const_figure_list_iterator; | |
6363 | |
6364 // A map of handles to graphics objects. | |
6365 std::map<graphics_handle, graphics_object> handle_map; | |
6366 | |
6367 // The available graphics handles. | |
6368 std::set<graphics_handle> handle_free_list; | |
6369 | |
6370 // The next handle available if handle_free_list is empty. | |
7286 | 6371 double next_handle; |
6874 | 6372 |
6373 // The allocated figure handles. Top of the stack is most recently | |
6374 // created. | |
6375 std::list<graphics_handle> figure_list; | |
6376 | |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
6377 // The lock for accessing the graphics sytsem. |
23057
bb7513d73673
move mutex classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23012
diff
changeset
|
6378 octave::mutex graphics_lock; |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6379 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
6380 // 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
|
6381 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
|
6382 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
6383 // The stack of callback objects. |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6384 std::list<graphics_object> callback_objects; |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6385 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6386 // 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
|
6387 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
|
6388 |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6389 graphics_handle do_get_handle (bool integer_figure_handle); |
6874 | 6390 |
6391 void do_free (const graphics_handle& h); | |
6392 | |
13816
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6393 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
|
6394 const graphics_handle& new_gh); |
7ee18dc46bbb
new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents:
13810
diff
changeset
|
6395 |
6874 | 6396 graphics_handle do_lookup (double val) |
6397 { | |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6398 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
|
6399 : handle_map.find (val)); |
6874 | 6400 |
6401 return (p != handle_map.end ()) ? p->first : graphics_handle (); | |
6402 } | |
6403 | |
6404 graphics_object do_get_object (const graphics_handle& h) | |
6405 { | |
7379 | 6406 iterator p = (h.ok () ? handle_map.find (h) : handle_map.end ()); |
6874 | 6407 |
6408 return (p != handle_map.end ()) ? p->second : graphics_object (); | |
6409 } | |
6410 | |
6411 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
|
6412 const graphics_handle& p, |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6413 bool integer_figure_handle, |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6414 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
|
6415 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
|
6416 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6417 graphics_handle do_make_figure_handle (double val, bool do_notify_toolkit); |
6874 | 6418 |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6419 Matrix do_handle_list (bool show_hidden) |
6874 | 6420 { |
6421 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
|
6422 |
6874 | 6423 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
|
6424 for (const auto& h_iter : handle_map) |
7056 | 6425 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6426 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
|
6427 |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6428 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
|
6429 retval(i++) = h.value (); |
7056 | 6430 } |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6431 |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6432 retval.resize (1, i); |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6433 |
6874 | 6434 return retval; |
6435 } | |
6436 | |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6437 Matrix do_figure_handle_list (bool show_hidden) |
6874 | 6438 { |
6439 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
|
6440 |
6874 | 6441 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
|
6442 for (const auto& hfig : figure_list) |
7056 | 6443 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6444 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
|
6445 retval(i++) = hfig.value (); |
7056 | 6446 } |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6447 |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6448 retval.resize (1, i); |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6449 |
6874 | 6450 return retval; |
6451 } | |
6452 | |
6453 void do_push_figure (const graphics_handle& h); | |
6454 | |
6455 void do_pop_figure (const graphics_handle& h); | |
6456 | |
6457 graphics_handle do_current_figure (void) const | |
6458 { | |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6459 graphics_handle retval; |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6460 |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6461 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
|
6462 { |
21880
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6463 if (is_handle_visible (hfig)) |
a6952c880cec
maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents:
21824
diff
changeset
|
6464 retval = hfig; |
13801
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6465 } |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6466 |
195ff3561152
allow figure handles to be non-integers
John W. Eaton <jwe@octave.org>
parents:
13799
diff
changeset
|
6467 return retval; |
6874 | 6468 } |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6469 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6470 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
|
6471 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6472 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
|
6473 |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6474 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
|
6475 |
13281
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6476 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
|
6477 |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6478 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
|
6479 const octave_value& data); |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6480 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
6481 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
|
6482 const octave_value& data); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
6483 |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23447
diff
changeset
|
6484 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
|
6485 |
18119
ec9b35e60f95
style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents:
18118
diff
changeset
|
6486 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
|
6487 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
|
6488 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6489 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
|
6490 |
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
|
6491 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
|
6492 |
9397
394c7adb488f
graphics.h.in (gh_manager::restore_gcbo): fix decl for unwind-protect
John W. Eaton <jwe@octave.org>
parents:
9347
diff
changeset
|
6493 static void restore_gcbo (void) |
7936
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6494 { |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6495 if (instance_ok ()) |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6496 instance->do_restore_gcbo (); |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6497 } |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6498 |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6499 void do_restore_gcbo (void); |
78400fde223e
Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents:
7902
diff
changeset
|
6500 |
7964
9cd3ee5298a0
Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents:
7936
diff
changeset
|
6501 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
|
6502 |
834f904a3dcb
Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13236
diff
changeset
|
6503 void do_enable_event_processing (bool enable = true); |
6874 | 6504 }; |
6505 | |
13132
e3e8ca96f923
Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents:
12965
diff
changeset
|
6506 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
|
6507 double& min_pos, double& max_neg, |
9455 | 6508 const Matrix& kids, char limit_type); |
6874 | 6509 |
10917
888c75785221
Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents:
10792
diff
changeset
|
6510 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
|
6511 |
6874 | 6512 // This function is NOT equivalent to the scripting language function gcf. |
7365 | 6513 OCTINTERP_API graphics_handle gcf (void); |
6874 | 6514 |
6515 // This function is NOT equivalent to the scripting language function gca. | |
7365 | 6516 OCTINTERP_API graphics_handle gca (void); |
6874 | 6517 |
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
|
6518 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
|
6519 |
6874 | 6520 #endif |