annotate libinterp/corefcn/graphics.in.h @ 27734:a9780be9ecbc

move graphics_toolkit class inside octave namespace * graphics-toolkit.h, graphics-toolkit.cc: Move base_graphics_toolkit and graphics_toolkit classes inside octave namespace. Change all uses outside of octave namespace as needed. Provide deprecated typedefs for old names in global namespace.
author John W. Eaton <jwe@octave.org>
date Thu, 21 Nov 2019 18:41:08 -0500
parents 5b9067c17e4b
children 8c1cb06468db
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
1 /*
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2
26376
00f796120a6d maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 26371
diff changeset
3 Copyright (C) 2007-2019 John W. Eaton
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
16
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6962
diff changeset
18 along with Octave; see the file COPYING. If not, see
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
20
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
21 */
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
22
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
28 #include <cctype>
23639
b488e958d024 Use modf, pow from C++ std library.
Rik <rik@octave.org>
parents: 23583
diff changeset
29 #include <cmath>
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
30
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
31 #include <algorithm>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
32 #include <list>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
35 #include <set>
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
36 #include <sstream>
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
37 #include <string>
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
38
11075
4e31d44a9763 extract caseless_str class to separate header file
John W. Eaton <jwe@octave.org>
parents: 11074
diff changeset
39 #include "caseless-str.h"
9004
17ba311ef110 add one more missing include
Jaroslav Hajek <highegg@gmail.com>
parents: 8944
diff changeset
40
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
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
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
57 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
58
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
59 class base_scaler
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
60 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
61 public:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
62 base_scaler (void) { }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
4e3b073e910e [project @ 2008-02-02 18:23:50 by jwe]
jwe
parents: 7439
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
91 };
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
92
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
93 class lin_scaler : public base_scaler
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
94 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
95 public:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
96 lin_scaler (void) { }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
97
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
98 Matrix scale (const Matrix& m) const { return m; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
102 double scale (double d) const { return d; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
103
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
104 double unscale (double d) const { return d; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
109 };
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
110
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
111 class log_scaler : public base_scaler
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
112 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
113 public:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
114 log_scaler (void) { }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
115
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
116 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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
133
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
136
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
137 double unscale (double d) const
23639
b488e958d024 Use modf, pow from C++ std library.
Rik <rik@octave.org>
parents: 23583
diff changeset
138 { return std::pow (10.0, d); }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
b488e958d024 Use modf, pow from C++ std library.
Rik <rik@octave.org>
parents: 23583
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
189 };
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
190
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
191 class scaler
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
192 {
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
193 public:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
194 scaler (void) : rep (new base_scaler ()) { }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
208 ~scaler (void) { delete rep; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
209
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
218
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
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 {
26383
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
227 if (&s != this)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
228 {
26383
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
229 if (rep)
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
230 {
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
231 delete rep;
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
232 rep = nullptr;
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
233 }
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
234
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
235 rep = s.rep->clone ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
236 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
237
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
238 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
239 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
240
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
241 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
242 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
243 if (rep)
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 delete rep;
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23774
diff changeset
246 rep = nullptr;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
247 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
248
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
249 if (s == "log")
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
250 rep = new log_scaler ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
251 else if (s == "neglog")
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
252 rep = new neg_log_scaler ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
253 else if (s == "linear")
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
254 rep = new lin_scaler ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
255 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
256 rep = new base_scaler ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
257
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
258 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
259 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
260
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
261 private:
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
262 base_scaler *rep;
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
263 };
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
264
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
265 // ---------------------------------------------------------------------
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
266
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
267 class property;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
268
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
269 // FIXME: These values should probably be defined inside a namespace or
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
270 // class, but which one is most appropriate? For now, prefix with
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
271 // "GCB_" to avoid conflict with PERSISTENT token ID used in the lexer.
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
272 // The lexer token IDs should probably also be fixed...
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
273
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
274 enum listener_mode { GCB_POSTSET, GCB_PERSISTENT, GCB_PREDELETE };
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
275
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
276 class base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
277 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
278 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
279 friend class property;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
280
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
281 public:
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
282 base_property (void)
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
283 : 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
284 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
285
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
286 base_property (const std::string& s, const graphics_handle& h)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
287 : 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
288 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
289
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
290 base_property (const base_property& p)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
291 : id (-1), count (1), name (p.name), parent (p.parent),
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
292 hidden (p.hidden), listeners ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
293 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
294
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
295 virtual ~base_property (void) = default;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
296
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
297 bool ok (void) const { return parent.ok (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
298
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
299 std::string get_name (void) const { return name; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
300
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
301 void set_name (const std::string& s) { name = s; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
302
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
303 graphics_handle get_parent (void) const { return parent; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
304
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
305 void set_parent (const graphics_handle& h) { parent = h; }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
306
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
307 bool is_hidden (void) const { return hidden; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
308
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
309 void set_hidden (bool flag) { hidden = flag; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
310
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
311 virtual bool is_radio (void) const { return false; }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
312
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
313 int get_id (void) const { return id; }
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
314
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
315 void set_id (int d) { id = d; }
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
316
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
317 // Sets property value, notifies graphics toolkit.
8058
ca39c21fa4b8 [mq]: generic_octave_to_backend_nofitication
John W. Eaton <jwe@octave.org>
parents: 8052
diff changeset
318 // If do_run is true, runs associated listeners.
13321
5ea207067ee5 Export base_property::set.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13307
diff changeset
319 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
320 bool do_notify_toolkit = true);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
321
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
322 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
323 {
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
324 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
325 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
326
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
327 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
328 {
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
329 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
330 }
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
331
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
332 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
333 {
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
334 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
335 }
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
336
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
337 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
338 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
339 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
340 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
341 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
342
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
343 void add_listener (const octave_value& v, listener_mode mode = GCB_POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
344 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
345 octave_value_list& l = listeners[mode];
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
346 l.resize (l.length () + 1, v);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
347 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
348
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
349 void delete_listener (const octave_value& v = octave_value (),
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
350 listener_mode mode = GCB_POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
351 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
352 octave_value_list& l = listeners[mode];
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
353
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
354 if (v.is_defined ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
355 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
356 bool found = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
357 int i;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
358
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
359 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
360 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
361 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
362 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
363 found = true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
364 break;
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 if (found)
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 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
370 l(j) = l(j + 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
371
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
372 l.resize (l.length () - 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
373 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
374 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
375 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
376 {
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
377 if (mode == GCB_PERSISTENT)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
378 l.resize (0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
379 else
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 octave_value_list lnew (0);
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
382 octave_value_list& lp = listeners[GCB_PERSISTENT];
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
383 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
384 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
385 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
386 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
387 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
388 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
389 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
390 break;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
391 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
392 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
393 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
394 l = lnew;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
395 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
396 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
397
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
398 }
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
399
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
400 OCTINTERP_API void run_listeners (listener_mode mode = GCB_POSTSET);
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
401
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
402 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
403 { return new base_property (*this); }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
404
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
405 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
406 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
407 {
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
408 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
409 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
410
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
411 private:
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
412 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
413 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
414 listener_map_iterator;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
415 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
416 listener_map_const_iterator;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
417
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
418 private:
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
419 int id;
27446
c23aee2104de consistently use octave_idx_type for reference counts
John W. Eaton <jwe@octave.org>
parents: 27432
diff changeset
420 octave::refcount<octave_idx_type> count;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
421 std::string name;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
422 graphics_handle parent;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
423 bool hidden;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
424 listener_map listeners;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
425 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
426
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
427 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
428
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
429 class string_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
430 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
431 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
432 string_property (const std::string& s, const graphics_handle& h,
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
433 const std::string& val = "")
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
434 : base_property (s, h), str (val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
435
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
436 string_property (const string_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
437 : base_property (p), str (p.str) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
438
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
439 octave_value get (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
440 { return octave_value (str); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
441
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
442 std::string string_value (void) const { return str; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
443
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
444 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
445 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
446 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
447 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
448 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
449
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
450 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
451
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
452 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
453 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
454 {
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
455 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
456 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
457 get_name ().c_str ());
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
458
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
459 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
460
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
461 if (new_str != str)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
462 {
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
463 str = new_str;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
464 return true;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
465 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
466 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
467 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
468
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
469 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
470 std::string str;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
471 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
472
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
473 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
474
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
475 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
476 {
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
477 public:
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
478 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
479
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
480 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
481 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
482 const desired_enum& typ = string_t)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
483 : 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
484 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
485 size_t pos = 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
486
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
487 while (true)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
488 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
489 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
490
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
491 if (new_pos == std::string::npos)
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 str.append (val.substr (pos));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
494 break;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
495 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
496 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
497 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
498
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
499 pos = new_pos + 1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
500 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
501 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
502
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
503 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
504 const Cell& c, const char& sep = '|',
830f27544bb7 Accept char array inputs for linestyleorder property (bug #34906).
Rik <rik@octave.org>
parents: 16832
diff changeset
505 const desired_enum& typ = string_t)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
506 : 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
507 {
23575
e95738a119da maint: Deprecate is_cellstr and replace with iscellstr.
Rik <rik@octave.org>
parents: 23564
diff changeset
508 if (! c.iscellstr ())
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
509 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
510 get_name ().c_str ());
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
511
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
512 string_vector strings (c.numel ());
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
513
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
514 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
515 strings[i] = c(i).string_value ();
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
516
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
517 str = strings;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
518 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
519
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
520 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
521 : 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
522 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
523
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
524 octave_value get (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 if (desired_type == string_t)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
527 return octave_value (string_value ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
528 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
529 return octave_value (cell_value ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
530 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
531
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
532 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
533 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
534 std::string s;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
535
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20181
diff changeset
536 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
537 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
538 s += str[i];
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20181
diff changeset
539 if (i != str.numel () - 1)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
540 s += separator;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
541 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
542
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
543 return s;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
544 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
545
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
546 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
547
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
548 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
549
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
550 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
551 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
552 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
553 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
554 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
555
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
556 base_property * clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
557 { 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
558
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
559 protected:
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
560 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
561 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
562 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
563 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
564 bool replace = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
565 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
566 string_vector strings;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
567 size_t pos = 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
568
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
569 // Split single string on delimiter (usually '|')
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
570 while (pos != std::string::npos)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
571 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
572 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
573
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
574 if (new_pos == std::string::npos)
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 strings.append (new_str.substr (pos));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
577 break;
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 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
580 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
581
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
582 pos = new_pos + 1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
583 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
584
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
585 if (str.numel () == strings.numel ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
586 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
587 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
588 if (strings[i] != str[i])
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
589 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
590 replace = true;
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
591 break;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
592 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
593 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
594 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
595 replace = true;
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 desired_type = string_t;
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 if (replace)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
600 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
601 str = strings;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
602 return true;
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 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
605 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
606 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
607 bool replace = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
608 charMatrix chm = val.char_matrix_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
609 octave_idx_type nel = chm.rows ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
610 string_vector strings (nel);
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 if (nel != str.numel ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
613 replace = true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
614 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
615 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
616 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
617 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
618 replace = 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
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
621 desired_type = string_t;
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 if (replace)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
624 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
625 str = strings;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
626 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
627 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
628 }
23575
e95738a119da maint: Deprecate is_cellstr and replace with iscellstr.
Rik <rik@octave.org>
parents: 23564
diff changeset
629 else if (val.iscellstr ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
630 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
631 bool replace = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
632 Cell new_cell = val.cell_value ();
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 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
635
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20181
diff changeset
636 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
637
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20181
diff changeset
638 if (nel != str.numel ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
639 replace = true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
640 else
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 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
643 {
10585
9f55d3ce490a avoid crash when setting graphics property from cellstr object
John W. Eaton <jwe@octave.org>
parents: 10566
diff changeset
644 if (strings[i] != str[i])
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
645 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
646 replace = true;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
647 break;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
648 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
649 }
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 desired_type = cell_t;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
653
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
654 if (replace)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
655 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
656 str = strings;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
657 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
658 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
659 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
660 else
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
661 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
662 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
663
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
664 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
665 }
10135
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
666
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
667 private:
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
668 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
669 char separator;
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
670 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
671 };
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
672
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
673 // ---------------------------------------------------------------------
4516a0c97ced Handle linestyleorder. Remove @ markers. Treat edgecolor, markeredgecolor and markerfacecolor correctly in scatter.
David Bateman <dbateman@free.fr>
parents: 10121
diff changeset
674
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
675 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
676 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
677 public:
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
678 enum type { char_t, cellstr_t };
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
679
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
680 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
681 const std::string& val = "")
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
682 : 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
683 { }
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 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
686 const NDArray& nda)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
687 : 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
688 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
689 octave_idx_type nel = nda.numel ();
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 value.resize (nel);
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 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
694 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
695 std::ostringstream buf;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
696 buf << nda(i);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
697 value[i] = buf.str ();
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 }
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 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
702 const Cell& c)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
703 : 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
704 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
705 octave_idx_type nel = c.numel ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
706
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
707 value.resize (nel);
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 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
710 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
711 octave_value tmp = c(i);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
712
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
713 if (tmp.is_string ())
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
714 value[i] = c(i).string_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
715 else
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 double d = c(i).double_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
718
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
719 std::ostringstream buf;
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
720 buf << d;
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
721 value[i] = buf.str ();
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
722 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
723 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
724 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
725
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
726 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
727 : 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
728 { }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
729
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
730 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
731 {
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
732 octave_value tmp = get ();
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
733 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
734 }
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
735
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
736 octave_value get (void) const
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
737 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
738 if (stored_type == char_t)
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
739 return octave_value (char_value ());
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
740 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
741 return octave_value (cell_value ());
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
742 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
743
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
744 std::string string_value (void) const
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
745 {
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20990
diff changeset
746 return value.empty () ? "" : value[0];
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
747 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
748
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
749 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
750
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
751 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
752
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
753 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
754
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
755 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
756 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
757 set (val);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
758 return *this;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
759 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
760
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
761 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
762
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
763 protected:
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
764
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
765 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
766 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
767 if (val.is_string ())
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
768 {
20990
fc9cca99b2de Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents: 20976
diff changeset
769 value = val.string_vector_value ();
12959
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 stored_type = char_t;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
772 }
23576
00e518162fda maint: Deprecate is_cell and replace with iscell.
Rik <rik@octave.org>
parents: 23575
diff changeset
773 else if (val.iscell ())
12959
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 Cell c = val.cell_value ();
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 octave_idx_type nel = c.numel ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
778
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
779 value.resize (nel);
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 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
782 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
783 octave_value tmp = c(i);
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
784
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
785 if (tmp.is_string ())
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
786 value[i] = c(i).string_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
787 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
788 {
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
789 double d = c(i).double_value ();
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
790
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
791 std::ostringstream buf;
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
792 buf << d;
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
793 value[i] = buf.str ();
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
794 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
795 }
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
796
22bc9ec80c2c allow multi-line string property for text objects using cell arrays or char matrices
Ben Abbott <bpabbott@mac.com>
parents: 12959
diff changeset
797 stored_type = cellstr_t;
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
798 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
799 else
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
800 {
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
801 NDArray nda;
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
802
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
803 try
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
804 {
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
805 nda = val.array_value ();
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
806 }
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
807 catch (octave::execution_exception& e)
12959
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
808 {
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
809 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
810 get_name ().c_str ());
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
811 }
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
812
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
813 octave_idx_type nel = nda.numel ();
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 value.resize (nel);
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
816
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
817 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
818 {
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
819 std::ostringstream buf;
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
820 buf << nda(i);
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
821 value[i] = buf.str ();
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
822 }
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
823
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
824 stored_type = char_t;
12959
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 return true;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
828 }
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
829
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
830 private:
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
831 string_vector value;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
832 type stored_type;
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
833 };
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
834
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
835 // ---------------------------------------------------------------------
0c86ae6f7c34 new text_label_property graphics property type
John W. Eaton <jwe@octave.org>
parents: 12777
diff changeset
836
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
837 class radio_values
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
838 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
839 public:
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20990
diff changeset
840 OCTINTERP_API radio_values (const std::string& opt_string = "");
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
841
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
842 radio_values (const radio_values& a)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
843 : default_val (a.default_val), possible_vals (a.possible_vals) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
844
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
845 radio_values& operator = (const radio_values& a)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
846 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
847 if (&a != this)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
848 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
849 default_val = a.default_val;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
850 possible_vals = a.possible_vals;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
851 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
852
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
853 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
854 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
855
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
856 std::string default_value (void) const { return default_val; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
857
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
858 bool validate (const std::string& val, std::string& match)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
859 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
860 bool retval = true;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
861
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
862 if (! contains (val, match))
20956
850e3d2533d4 maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents: 20955
diff changeset
863 error ("invalid value = %s", val.c_str ());
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
864
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
865 return retval;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
866 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
867
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
868 bool contains (const std::string& val, std::string& match)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
869 {
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
870 size_t k = 0;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
871
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
872 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
873
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
874 std::string first_match;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
875
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
876 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
877 {
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
878 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
879 {
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
880 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
881 {
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
882 // 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
883 // 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
884 // 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
885 match = possible_val;
13236
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
886 return true;
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 else
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 == 0)
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
891 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
892
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
893 k++;
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 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
896 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
897
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
898 if (k == 1)
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
899 {
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
900 match = first_match;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
901 return true;
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
902 }
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
903 else
8bb526fb3349 allow radio values for graphics properaties to be abbreviated
John W. Eaton <jwe@octave.org>
parents: 13132
diff changeset
904 return false;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
905 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
906
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
907 std::string values_as_string (void) const;
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
908
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
909 Cell values_as_cell (void) const;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
910
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
911 octave_idx_type nelem (void) const { return possible_vals.size (); }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
912
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
913 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
914 // Might also want to cache
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
915 std::string default_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
916 std::set<caseless_str> possible_vals;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
917 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
918
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
919 class radio_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
920 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
921 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
922 radio_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
923 const radio_values& v = radio_values ())
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
924 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
925 vals (v), current_val (v.default_value ()) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
926
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
927 radio_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
928 const std::string& v)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
929 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
930 vals (v), current_val (vals.default_value ()) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
931
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
932 radio_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
933 const radio_values& v, const std::string& def)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
934 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
935 vals (v), current_val (def) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
936
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
937 radio_property (const radio_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
938 : base_property (p), vals (p.vals), current_val (p.current_val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
939
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
940 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
941
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
942 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
943
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
944 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
945
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
946 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
947
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
948 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
949 { return v.compare (current_val); }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
950
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
951 bool is_radio (void) const { return true; }
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
952
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
953 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
954 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
955 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
956 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
957 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
958
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
959 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
960
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
961 protected:
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
962 bool do_set (const octave_value& newval)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
963 {
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
964 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
965 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
966 get_name ().c_str ());
20962
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 std::string s = newval.string_value ();
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 std::string match;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
971
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
972 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
973 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
974 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
975
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
976 if (match != current_val)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
977 {
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
978 if (s.length () != match.length ())
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
979 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
980 "%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
981 "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
982 match.c_str ());
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
983 current_val = match;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
984 return true;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
985 }
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
986 return false;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
987 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
988
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
989 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
990 radio_values vals;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
991 std::string current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
992 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
993
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
994 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
995
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
996 class color_values
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
997 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
998 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
999 color_values (double r = 0, double g = 0, double b = 1)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1000 : xrgb (1, 3)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1001 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1002 xrgb(0) = r;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1003 xrgb(1) = g;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1004 xrgb(2) = b;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1005
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1006 validate ();
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1007 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1008
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1009 color_values (const std::string& str)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1010 : xrgb (1, 3)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1011 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1012 if (! str2rgb (str))
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1013 error ("invalid color specification: %s", str.c_str ());
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1014 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1015
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1016 color_values (const color_values& c)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1017 : xrgb (c.xrgb)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1018 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1019
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1020 color_values& operator = (const color_values& c)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1021 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1022 if (&c != this)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1023 xrgb = c.xrgb;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1024
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1025 return *this;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1026 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1027
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1028 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
1029 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1030 return (xrgb(0) == c.xrgb(0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1031 && xrgb(1) == c.xrgb(1)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1032 && xrgb(2) == c.xrgb(2));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1033 }
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1034
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1035 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
1036 { return ! (*this == c); }
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1037
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1038 Matrix rgb (void) const { return xrgb; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1039
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1040 operator octave_value (void) const { return xrgb; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1041
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1042 void validate (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1043 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1044 for (int i = 0; i < 3; i++)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1045 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1046 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
1047 error ("invalid RGB color specification");
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1048 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1049 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1050
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1051 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1052 Matrix xrgb;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1053
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1054 OCTINTERP_API bool str2rgb (const std::string& str);
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1055 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1056
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1057 class color_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1058 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1059 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1060 color_property (const color_values& c, const radio_values& v)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1061 : base_property ("", graphics_handle ()),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1062 current_type (color_t), color_val (c), radio_val (v),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1063 current_val (v.default_value ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1064 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1065
17645
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
1066 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
1067 : base_property ("", graphics_handle ()),
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
1068 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
1069 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
1070 { }
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
1071
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1072 color_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1073 const color_values& c = color_values (),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1074 const radio_values& v = radio_values ())
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1075 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1076 current_type (color_t), color_val (c), radio_val (v),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1077 current_val (v.default_value ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1078 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1079
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1080 color_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1081 const radio_values& v)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1082 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1083 current_type (radio_t), color_val (color_values ()), radio_val (v),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1084 current_val (v.default_value ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1085 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1086
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1087 color_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1088 const std::string& v)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1089 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1090 current_type (radio_t), color_val (color_values ()), radio_val (v),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1091 current_val (radio_val.default_value ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1092 { }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1093
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1094 color_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1095 const color_property& v)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1096 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1097 current_type (v.current_type), color_val (v.color_val),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1098 radio_val (v.radio_val), current_val (v.current_val)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1099 { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1100
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1101 color_property (const color_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1102 : base_property (p), current_type (p.current_type),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1103 color_val (p.color_val), radio_val (p.radio_val),
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1104 current_val (p.current_val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1105
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1106 octave_value get (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1107 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1108 if (current_type == color_t)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1109 return color_val.rgb ();
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1110
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1111 return current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1112 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1113
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1114 bool is_rgb (void) const { return (current_type == color_t); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1115
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1116 bool is_radio (void) const { return (current_type == radio_t); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1117
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1118 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
1119 { return (is_radio () && current_val == v); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1120
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1121 Matrix rgb (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1122 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1123 if (current_type != color_t)
20726
25d676f9619c Preface error() messages with name of function when possible.
Rik <rik@octave.org>
parents: 20711
diff changeset
1124 error ("color has no RGB value");
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1125
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1126 return color_val.rgb ();
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1127 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1128
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1129 const std::string& current_value (void) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1130 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1131 if (current_type != radio_t)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1132 error ("color has no radio value");
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1133
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1134 return current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1135 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1136
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1137 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
1138 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1139 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1140 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1141 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1142
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1143 operator octave_value (void) const { return get (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1144
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1145 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
1146
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1147 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
1148 { 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
1149
f0236b444356 Allow set(h) to work if the handle includes color properties
David Bateman <dbateman@free.fr>
parents: 10722
diff changeset
1150 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
1151
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1152 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1153 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
1154
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1155 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1156 enum current_enum { color_t, radio_t } current_type;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1157 color_values color_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1158 radio_values radio_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1159 std::string current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1160 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1161
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1162 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1163
23124
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1164 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
1165 {
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1166 NO_CHECK,
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1167 FINITE,
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1168 NOT_NAN,
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1169 NOT_INF
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1170 };
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1171 class double_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1172 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1173 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1174 double_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1175 double d = 0)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1176 : 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
1177 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
1178 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
1179 maxval (std::pair<double, bool> (octave_NaN, true)) { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1180
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1181 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
1182 : 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
1183 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
1184 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
1185 maxval (std::pair<double, bool> (octave_NaN, true)) { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1186
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1187 octave_value get (void) const { return octave_value (current_val); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1188
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1189 double double_value (void) const { return current_val; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1190
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1191 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
1192 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1193 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1194 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1195 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1196
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1197 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
1198 {
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1199 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
1200
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1201 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
1202 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
1203 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
1204
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1205 return p;
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1206 }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1207
22831
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
1208 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
1209 {
22831
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
1210 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
1211 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
1212 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
1213 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
1214 }
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
1215
23124
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1216 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
1217 { finite_constraint = finite; }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1218
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1219 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1220 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
1221 {
23582
0cc2011d800e maint: Deprecate is_real_type and replace with isreal.
Rik <rik@octave.org>
parents: 23577
diff changeset
1222 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
1223 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
1224 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
1225
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
1226 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
1227
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 // 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
1229 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
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 (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
1232 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
1233 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
1234 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
1235 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
1236 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
1237 }
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
1238
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
1239 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
1240 {
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
1241 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
1242 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
1243 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
1244 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
1245 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
1246 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
1247 }
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
1248
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
1249 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
1250 else if (finite_constraint == FINITE)
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 if (! octave::math::isfinite (new_val))
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
1253 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
1254 }
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
1255 else if (finite_constraint == NOT_NAN)
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
1256 {
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
1257 if (octave::math::isnan (new_val))
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
1258 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
1259 }
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
1260 else if (finite_constraint == NOT_INF)
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
1261 {
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
1262 if (octave::math::isinf (new_val))
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
1263 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
1264 }
23124
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1265
20976
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
1266 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
1267 {
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
1268 current_val = new_val;
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
1269 return true;
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
1270 }
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
1271
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1272 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1273 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1274
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1275 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1276 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
1277 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
1278 std::pair<double, bool> minval, maxval;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1279 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1280
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1281 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1282
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1283 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
1284 {
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1285 public:
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1286 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
1287 : 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
1288 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
1289 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
1290 { }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1291
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1292 double_radio_property (const std::string& nm, const graphics_handle& h,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
1293 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
1294 : 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
1295 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
1296 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
1297 { }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1298
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1299 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
1300 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
1301 : 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
1302 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
1303 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
1304 { }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1305
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1306 double_radio_property (const double_radio_property& p)
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1307 : base_property (p), current_type (p.current_type),
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1308 dval (p.dval), radio_val (p.radio_val),
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1309 current_val (p.current_val) { }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1310
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1311 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
1312 {
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1313 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
1314 return dval;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1315
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1316 return current_val;
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
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1319 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
1320
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1321 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
1322
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1323 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
1324 { 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
1325
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1326 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
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 != double_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 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
1330
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1331 return dval;
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 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
1335 {
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1336 if (current_type != radio_t)
26107
05dfcb24ef12 Supply missing arguments to variable length *printf functions (bug #55046).
Rik <rik@octave.org>
parents: 26055
diff changeset
1337 error ("%s: property has no radio value", get_name ().c_str ());
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1338
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1339 return current_val;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1340 }
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1341
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1342 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
1343 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1344 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1345 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1346 }
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1347
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1348 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
1349
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1350 base_property * clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1351 { return new double_radio_property (*this); }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1352
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1353 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1354 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
1355
7844
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1356 private:
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1357 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
1358 double dval;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1359 radio_values radio_val;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1360 std::string current_val;
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1361 };
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1362
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1363 // ---------------------------------------------------------------------
3d60445d3638 Add new double_radio_property class for alpha values.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7842
diff changeset
1364
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1365 class array_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1366 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1367 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
1368 array_property (void)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1369 : 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
1370 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
1371 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
1372 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
1373 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
1374 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1375 get_data_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1376 }
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
1377
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1378 array_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1379 const octave_value& m)
23583
b7747a2c88b2 maint: Deprecate is_sparse_type and replace with issparse.
Rik <rik@octave.org>
parents: 23582
diff changeset
1380 : 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
1381 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
1382 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
1383 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
1384 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
1385 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1386 get_data_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1387 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1388
7848
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
1389 // 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
1390 // 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
1391 // copy constraints.
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
1392 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
1393 : 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
1394 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
1395 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
1396 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
1397 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
1398 { }
7848
6bb2bbc2bf45 Remove data_property, replace with array_property or row_vector_property.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7847
diff changeset
1399
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1400 octave_value get (void) const { return data; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1401
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1402 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
1403 { type_constraints.insert (type); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1404
7524
a653856aa3e1 array_value::add_constraint: pass dim_vector as const reference, not value
John W. Eaton <jwe@octave.org>
parents: 7523
diff changeset
1405 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
1406 { size_constraints.push_back (dims); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1407
23124
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1408 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
1409 { 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
1410
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1411 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
1412 {
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1413 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
1414 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
1415 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
1416 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
1417 }
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1418
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
1419 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
1420 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
1421 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
1422 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
1423
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1424 Matrix get_limits (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1425 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1426 Matrix m (1, 4);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1427
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1428 m(0) = min_val ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1429 m(1) = max_val ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1430 m(2) = min_pos ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1431 m(3) = max_neg ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1432
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1433 return m;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1434 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
1435
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1436 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
1437 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1438 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1439 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1440 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1441
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1442 base_property * clone (void) const
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 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
1445
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1446 p->type_constraints = type_constraints;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1447 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
1448 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
1449 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
1450 p->maxval = maxval;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1451
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1452 return p;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1453 }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1454
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1455 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1456 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
1457 {
23583
b7747a2c88b2 maint: Deprecate is_sparse_type and replace with issparse.
Rik <rik@octave.org>
parents: 23582
diff changeset
1458 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
1459
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1460 if (! validate (tmp))
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
1461 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
1462 get_name ().c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1463
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1464 // 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
1465 if (! is_equal (tmp))
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1466 {
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1467 data = tmp;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1468
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1469 get_data_limits ();
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1470
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1471 return true;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1472 }
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1473
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1474 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1475 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1476
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1477 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1478 OCTINTERP_API bool validate (const octave_value& v);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1479
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1480 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
1481
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
1482 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
1483
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1484 protected:
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1485 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
1486 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
1487 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
1488 double xminp;
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
1489 double xmaxp;
15069
7a3957ca99c3 Handle complex arguments in imagesc (bug #36866)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14861
diff changeset
1490 std::set<std::string> type_constraints;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1491 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
1492 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
1493 std::pair<double, bool> minval, maxval;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1494 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1495
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1496 class row_vector_property : public array_property
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1497 {
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1498 public:
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1499 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
1500 const octave_value& m)
7527
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1501 : array_property (nm, h, m)
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1502 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1503 add_constraint (dim_vector (-1, 1));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
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));
7527
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1506 }
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1507
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1508 row_vector_property (const row_vector_property& p)
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1509 : array_property (p)
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1510 {
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1511 add_constraint (dim_vector (-1, 1));
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1512 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
1513 add_constraint (dim_vector (0, 0));
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1514 }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1515
7527
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1516 void add_constraint (const std::string& type)
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1517 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1518 array_property::add_constraint (type);
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1519 }
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1520
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1521 void add_constraint (const dim_vector& dims)
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1522 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1523 array_property::add_constraint (dims);
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1524 }
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1525
23124
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1526 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
1527 {
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1528 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
1529 }
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1530
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1531 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
1532 {
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1533 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
1534 }
9e54152e382b Add new types of constraints for graphics properties (bug #50041).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23116
diff changeset
1535
7527
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1536 void add_constraint (octave_idx_type len)
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1537 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1538 size_constraints.remove (dim_vector (1, -1));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1539 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
1540 size_constraints.remove (dim_vector (0, 0));
7527
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1541
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1542 add_constraint (dim_vector (1, len));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1543 add_constraint (dim_vector (len, 1));
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1544 }
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1545
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1546 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
1547 {
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1548 set (val);
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1549 return *this;
d219e712c20e make row_vector_property work?
John W. Eaton <jwe@octave.org>
parents: 7526
diff changeset
1550 }
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1551
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1552 base_property * clone (void) const
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 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
1555
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1556 p->type_constraints = type_constraints;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1557 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
1558 p->finite_constraint = finite_constraint;
ca03c9f3fa4b Copy all constraints for row vector properties.
Markus Mützel <markus.muetzel@gmx.de>
parents: 24252
diff changeset
1559 p->minval = minval;
ca03c9f3fa4b Copy all constraints for row vector properties.
Markus Mützel <markus.muetzel@gmx.de>
parents: 24252
diff changeset
1560 p->maxval = maxval;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1561
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1562 return p;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1563 }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1564
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1565 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1566 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
1567 {
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1568 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
1569
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1570 dim_vector dv = data.dims ();
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1571
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1572 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
1573 {
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1574 int tmp = dv(0);
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1575 dv(0) = dv(1);
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1576 dv(1) = tmp;
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1577
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1578 data = data.reshape (dv);
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1579 }
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1580
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1581 return retval;
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1582 }
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1583
7523
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1584 private:
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1585 OCTINTERP_API bool validate (const octave_value& v);
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1586 };
f2000f1971ab new row_vector_property class
John W. Eaton <jwe@octave.org>
parents: 7471
diff changeset
1587
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1588 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1589
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1590 class bool_property : public radio_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1591 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1592 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1593 bool_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1594 bool val)
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1595 : 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
1596 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1597
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1598 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
1599 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
1600 : 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
1601 "{on}|off" : "on|{off}"), val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1602 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1603
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1604 bool_property (const bool_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1605 : radio_property (p) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1606
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1607 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
1608
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1609 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
1610 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1611 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1612 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1613 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1614
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1615 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
1616
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1617 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1618 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
1619 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1620 if (val.is_bool_scalar ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1621 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
1622 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1623 return radio_property::do_set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1624 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1625 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1626
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1627 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1628
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1629 class handle_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1630 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1631 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1632 handle_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1633 const graphics_handle& val = graphics_handle ())
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1634 : base_property (nm, h),
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1635 current_val (val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1636
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1637 handle_property (const handle_property& p)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1638 : base_property (p), current_val (p.current_val) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1639
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1640 octave_value get (void) const { return current_val.as_octave_value (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1641
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1642 graphics_handle handle_value (void) const { return current_val; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1643
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1644 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
1645 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1646 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1647 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1648 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1649
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1650 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
1651 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1652 set (octave_value (h.value ()));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1653 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1654 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1655
23116
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1656 void invalidate (void)
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
1657 { 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
1658
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1659 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
1660
22831
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
1661 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
1662 { 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
1663
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1664 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1665 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
1666 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
1667
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1668 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1669 graphics_handle current_val;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1670 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1671
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1672 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1673
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1674 class any_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1675 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1676 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1677 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
1678 const octave_value& m = Matrix ())
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1679 : base_property (nm, h), data (m) { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1680
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1681 any_property (const any_property& p)
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1682 : base_property (p), data (p.data) { }
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1683
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1684 octave_value get (void) const { return data; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1685
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1686 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
1687 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1688 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1689 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1690 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1691
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1692 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
1693
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1694 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1695 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
1696 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1697 data = v;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1698 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1699 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1700
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1701 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1702 octave_value data;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1703 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1704
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1705 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1706
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1707 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
1708 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1709 public:
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1710 children_property (void)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1711 : 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
1712 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1713 do_init_children (Matrix ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1714 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1715
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1716 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
1717 const Matrix& val)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1718 : 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
1719 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1720 do_init_children (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1721 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1722
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1723 children_property (const children_property& p)
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1724 : base_property (p), children_list ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1725 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1726 do_init_children (p.children_list);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1727 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1728
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1729 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
1730 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1731 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1732 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1733 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1734
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1735 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
1736
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1737 bool remove_child (double val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1738 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1739 return do_remove_child (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1740 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1741
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1742 void adopt (double val)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1743 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1744 do_adopt_child (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1745 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1746
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1747 Matrix get_children (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1748 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1749 return do_get_children (false);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1750 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1751
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1752 Matrix get_hidden (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1753 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1754 return do_get_children (true);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1755 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1756
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1757 Matrix get_all (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1758 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1759 return do_get_all_children ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1760 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1761
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1762 octave_value get (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1763 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1764 return octave_value (get_children ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1765 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1766
26930
ead8f91c5556 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26918
diff changeset
1767 void delete_children (bool clear = false, bool from_root = false)
26982
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
1768 {
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
1769 do_delete_children (clear, from_root);
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
1770 }
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
1771
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1772 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
1773 {
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
1774 for (auto& hchild : children_list)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1775 {
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
1776 if (hchild == old_gh)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1777 {
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
1778 hchild = new_gh.value ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1779 return;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1780 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1781 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1782
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1783 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
1784 }
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
1785
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1786 private:
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1787 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
1788 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
1789 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
1790
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1791 protected:
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1792 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
1793 {
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1794 Matrix new_kids;
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1795
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1796 try
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1797 {
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1798 new_kids = val.matrix_value ();
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1799 }
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22326
diff changeset
1800 catch (octave::execution_exception& e)
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1801 {
20756
200ae1d650b7 propagate octave_execution_exception objects through try/catch blocks
John W. Eaton <jwe@octave.org>
parents: 20738
diff changeset
1802 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
1803 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1804
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1805 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
1806
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1807 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
1808
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1809 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
1810 bool add_hidden = true;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1811
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1812 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
1813
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1814 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
1815 {
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1816 Matrix t1 = visible_kids.sort ();
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1817 Matrix t2 = new_kids_column.sort ();
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1818 Matrix t3 = get_hidden ().sort ();
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1819
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1820 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
1821 is_ok = false;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1822
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1823 if (t1 == t3)
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1824 add_hidden = false;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1825 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1826 else
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1827 is_ok = false;
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1828
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1829 if (! is_ok)
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
1830 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
1831
26383
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
1832 Matrix tmp = new_kids_column;
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
1833
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
1834 if (add_hidden)
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
1835 tmp.stack (get_hidden ());
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
1836
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
1837 children_list.clear ();
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
1838
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
1839 // Don't use do_init_children here, as that reverses the
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
1840 // order of the list, and we don't want to do that if setting
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
1841 // the child list directly.
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
1842 for (octave_idx_type i = 0; i < tmp.numel (); i++)
5455de7c8566 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
1843 children_list.push_back (tmp.xelem (i));
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1844
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1845 return is_ok;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1846 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1847
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1848 private:
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1849 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
1850 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1851 children_list.clear ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1852 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
1853 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
1854 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1855
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1856 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
1857 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1858 children_list.clear ();
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
1859 children_list = val;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1860 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1861
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1862 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
1863
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1864 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
1865 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1866 Matrix retval (children_list.size (), 1);
21568
3d60ed163b70 maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents: 21562
diff changeset
1867 octave_idx_type i = 0;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1868
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
1869 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
1870 retval(i++) = hchild;
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
1871
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1872 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1873 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1874
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1875 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
1876 {
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
1877 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
1878 {
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
1879 if (*it == child)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1880 {
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
1881 children_list.erase (it);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1882 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1883 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1884 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1885 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1886 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1887
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
1888 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
1889 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1890 children_list.push_front (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1891 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
1892
26982
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
1893 void do_delete_children (bool clear, bool from_root);
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1894 };
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1895
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1896 // ---------------------------------------------------------------------
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
1897
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1898 class callback_property : public base_property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1899 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1900 public:
7364
0e07f78369d1 [project @ 2008-01-12 08:38:17 by jwe]
jwe
parents: 7363
diff changeset
1901 callback_property (const std::string& nm, const graphics_handle& h,
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1902 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
1903 : base_property (nm, h), callback (m) { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1904
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1905 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
1906 : base_property (p), callback (p.callback) { }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
1907
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1908 octave_value get (void) const { return callback; }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1909
7367
600808df131c [project @ 2008-01-14 08:58:02 by jwe]
jwe
parents: 7366
diff changeset
1910 OCTINTERP_API void execute (const octave_value& data = octave_value ()) const;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1911
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10505
diff changeset
1912 bool is_defined (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1913 {
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
1914 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
1915 }
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10505
diff changeset
1916
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1917 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
1918 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1919 set (val);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1920 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1921 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1922
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1923 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
1924
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1925 protected:
8063
41bc700ff642 Trigger actions/listeners only for actual property change
Michael Goffioul
parents: 8061
diff changeset
1926 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
1927 {
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1928 if (! validate (v))
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23795
diff changeset
1929 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
1930 get_name ().c_str ());
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1931
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1932 callback = v;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
1933 return true;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1934 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1935 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
1936
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1937 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1938 OCTINTERP_API bool validate (const octave_value& v) const;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1939
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1940 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1941 octave_value callback;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1942 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1943
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1944 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1945
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1946 class property
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1947 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1948 public:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1949 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
1950 { }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1951
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1952 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
1953 { if (persist) rep->count++; }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1954
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
1955 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
1956 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1957 rep->count++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1958 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1959
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1960 ~property (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1961 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1962 if (--rep->count == 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1963 delete rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1964 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1965
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1966 bool ok (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1967 { return rep->ok (); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1968
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1969 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
1970 { return rep->get_name (); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1971
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1972 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
1973 { rep->set_name (name); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1974
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1975 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
1976 { return rep->get_parent (); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1977
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1978 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
1979 { rep->set_parent (h); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1980
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1981 bool is_hidden (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1982 { return rep->is_hidden (); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1983
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1984 void set_hidden (bool flag)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1985 { rep->set_hidden (flag); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1986
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1987 bool is_radio (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1988 { return rep->is_radio (); }
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
1989
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1990 int get_id (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1991 { return rep->get_id (); }
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1992
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1993 void set_id (int d)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1994 { rep->set_id (d); }
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
1995
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1996 octave_value get (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1997 { return rep->get (); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
1998
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
1999 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
2000 bool do_notify_toolkit = true)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2001 { return rep->set (val, do_run, do_notify_toolkit); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2002
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2003 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
2004 { return rep->values_as_string (); }
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2005
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2006 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
2007 { return rep->values_as_cell (); }
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2008
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2009 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
2010 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2011 *rep = val;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2012 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2013 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2014
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2015 property& operator = (const property& p)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2016 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2017 if (rep && --rep->count == 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2018 delete rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2019
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2020 rep = p.rep;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2021 rep->count++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2022
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2023 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2024 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2025
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
2026 void add_listener (const octave_value& v, listener_mode mode = GCB_POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2027 { rep->add_listener (v, mode); }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2028
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2029 void delete_listener (const octave_value& v = octave_value (),
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
2030 listener_mode mode = GCB_POSTSET)
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2031 { 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
2032
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
2033 void run_listeners (listener_mode mode = GCB_POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2034 { rep->run_listeners (mode); }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2035
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2036 OCTINTERP_API static
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2037 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
2038 const caseless_str& type,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2039 const octave_value_list& args);
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2040
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2041 property clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2042 { return property (rep->clone ()); }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2043
20946
6eff66fb8a02 style fixes for comments
John W. Eaton <jwe@octave.org>
parents: 20893
diff changeset
2044 #if 0
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2045 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
2046 { return *(dynamic_cast<string_property *> (rep)); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2047
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2048 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
2049 { return *(dynamic_cast<radio_property *> (rep)); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2050
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2051 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
2052 { return *(dynamic_cast<color_property *> (rep)); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2053
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2054 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
2055 { return *(dynamic_cast<double_property *> (rep)); }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2056
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2057 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
2058 { return *(dynamic_cast<bool_property *> (rep)); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2059
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2060 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
2061 { return *(dynamic_cast<handle_property *> (rep)); }
20946
6eff66fb8a02 style fixes for comments
John W. Eaton <jwe@octave.org>
parents: 20893
diff changeset
2062 #endif
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2063
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2064 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2065 base_property *rep;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2066 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2067
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2068 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2069
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
2070 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
2071
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
2072 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
2073 {
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
2074 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
2075 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
2076 {
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2077 const_iterator 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 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
2080 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
2081 return it;
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
2082
19086
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2083 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
2084 }
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2085
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2086 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
2087 {
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2088 iterator 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 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
2091 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
2092 return it;
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
2093
19086
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2094 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
2095 }
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
2096
19086
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2097 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
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 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
2100
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2101 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
2102
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2103 if (it != (*this).end ())
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
2104 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
2105
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2106 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
2107 }
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2108
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
2109 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
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 iterator it = find (pname);
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
2112
19086
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2113 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
2114 {
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2115 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
2116 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
2117 }
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
2118
19086
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2119 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
2120 }
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2121
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2122 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
2123 {
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2124 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
2125 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
2126 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
2127 }
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
2128
19086
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2129 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
2130 {
21880
a6952c880cec maint: Use 'auto' in graphics.cc, graphics.in.h files.
Rik <rik@octave.org>
parents: 21824
diff changeset
2131 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
2132 }
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2133
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2134 };
dc88c5784f74 Respect the order in which default graphics properties are set (bug #38449)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19047
diff changeset
2135
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2136 class property_list
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2137 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2138 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
2139 typedef pval_vector pval_map_type;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2140 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
2141
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2142 typedef pval_map_type::iterator pval_map_iterator;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2143 typedef pval_map_type::const_iterator pval_map_const_iterator;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2144
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2145 typedef plist_map_type::iterator plist_map_iterator;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2146 typedef plist_map_type::const_iterator plist_map_const_iterator;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2147
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2148 property_list (const plist_map_type& m = plist_map_type ())
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2149 : plist_map (m) { }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2150
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
2151 ~property_list (void) = default;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2152
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2153 void set (const caseless_str& name, const octave_value& val);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2154
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2155 octave_value lookup (const caseless_str& name) const;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2156
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2157 plist_map_iterator begin (void) { return plist_map.begin (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2158 plist_map_const_iterator begin (void) const { return plist_map.begin (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2159
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2160 plist_map_iterator end (void) { return plist_map.end (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2161 plist_map_const_iterator end (void) const { return plist_map.end (); }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2162
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2163 plist_map_iterator find (const std::string& go_name)
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2164 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2165 return plist_map.find (go_name);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2166 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2167
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2168 plist_map_const_iterator find (const std::string& go_name) const
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2169 {
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2170 return plist_map.find (go_name);
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2171 }
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2172
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
2173 octave_scalar_map as_struct (const std::string& prefix_arg) const;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2174
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2175 private:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2176 plist_map_type plist_map;
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2177 };
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2178
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2179 // ---------------------------------------------------------------------
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2180
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2181 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
2182 class graphics_object;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2183
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
2184 class OCTINTERP_API base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2185 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2186 public:
7176
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
2187 base_properties (const std::string& ty = "unknown",
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2188 const graphics_handle& mh = graphics_handle (),
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2189 const graphics_handle& p = graphics_handle ());
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2190
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
2191 virtual ~base_properties (void) = default;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2192
17625
bd1dd30ed202 graphics.in.h: Correct bad spelling of "unknown" in graphics_object_name().
Rik <rik@octave.org>
parents: 17544
diff changeset
2193 virtual std::string graphics_object_name (void) const { return "unknown"; }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2194
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2195 void mark_modified (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2196
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2197 void override_defaults (base_graphics_object& obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2198
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2199 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
2200 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2201 panic_impossible ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2202 }
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2203
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2204 // Look through DEFAULTS for properties with given CLASS_NAME, and
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2205 // apply them to the current object with set (virtual method).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2206
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2207 void set_from_list (base_graphics_object& obj, property_list& defaults);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2208
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2209 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
2210 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2211 p.set_name (name);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2212 p.set_parent (__myhandle__);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2213 all_props[name] = p;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2214 }
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2215
9972
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2216 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
2217
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2218 virtual octave_value get (const caseless_str& pname) const;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2219
9616
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2220 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
2221 {
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2222 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
2223 }
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 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
2226 {
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2227 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
2228 }
2093499ec9f4 avoid crash if default font can't be found
John W. Eaton <jwe@octave.org>
parents: 9585
diff changeset
2229
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
2230 virtual octave_value get (bool all = false) const;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2231
9185
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2232 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
2233
9585
06b8b51dca48 also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents: 9582
diff changeset
2234 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
2235 {
06b8b51dca48 also handle user-defined graphics properties in new property name validation scheme
John W. Eaton <jwe@octave.org>
parents: 9582
diff changeset
2236 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
2237 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
2238 }
7864
56f781f38f0b Add dynamic property creation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7862
diff changeset
2239
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2240 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
2241
26930
ead8f91c5556 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26918
diff changeset
2242 virtual void remove_child (const graphics_handle& h, bool = false)
26982
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2243 {
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2244 if (children.remove_child (h.value ()))
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2245 {
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2246 children.run_listeners ();
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2247 mark_modified ();
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2248 }
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2249 }
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2250
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2251 virtual void adopt (const graphics_handle& h)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2252 {
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2253 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
2254 children.run_listeners ();
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
2255 mark_modified ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2256 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2257
27734
a9780be9ecbc move graphics_toolkit class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27730
diff changeset
2258 virtual octave::graphics_toolkit get_toolkit (void) const;
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2259
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2260 virtual Matrix
20946
6eff66fb8a02 style fixes for comments
John W. Eaton <jwe@octave.org>
parents: 20893
diff changeset
2261 get_boundingbox (bool /* finternal */ = false,
6eff66fb8a02 style fixes for comments
John W. Eaton <jwe@octave.org>
parents: 20893
diff changeset
2262 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
2263 { return Matrix (1, 4, 0.0); }
7447
25018e35b4cb [project @ 2008-02-05 22:38:57 by jwe]
jwe
parents: 7446
diff changeset
2264
7828
4739b6a1925c Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7827
diff changeset
2265 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
2266
12389
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
2267 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
2268
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2269 virtual void add_listener (const caseless_str&, const octave_value&,
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
2270 listener_mode = GCB_POSTSET);
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2271
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2272 virtual void delete_listener (const caseless_str&, const octave_value&,
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
2273 listener_mode = GCB_POSTSET);
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2274
27698
f65b1666e650 don't notify toolkit when setting beingdeleted property (bug #56952)
John W. Eaton <jwe@octave.org>
parents: 27682
diff changeset
2275 void set_beingdeleted (const octave_value& val)
f65b1666e650 don't notify toolkit when setting beingdeleted property (bug #56952)
John W. Eaton <jwe@octave.org>
parents: 27682
diff changeset
2276 {
f65b1666e650 don't notify toolkit when setting beingdeleted property (bug #56952)
John W. Eaton <jwe@octave.org>
parents: 27682
diff changeset
2277 beingdeleted.set (val, true, false);
f65b1666e650 don't notify toolkit when setting beingdeleted property (bug #56952)
John W. Eaton <jwe@octave.org>
parents: 27682
diff changeset
2278 }
f65b1666e650 don't notify toolkit when setting beingdeleted property (bug #56952)
John W. Eaton <jwe@octave.org>
parents: 27682
diff changeset
2279
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2280 void set_tag (const octave_value& val) { tag = val; }
7176
6525eb2fba0f [project @ 2007-11-14 20:42:06 by jwe]
jwe
parents: 7168
diff changeset
2281
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2282 void set_parent (const octave_value& val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
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 Matrix get_children (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2285 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2286 return children.get_children ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2287 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2288
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2289 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
2290 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2291 return children.get_all ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2292 }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2293
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2294 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
2295 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2296 return children.get_hidden ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2297 }
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2298
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
2299 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
2300 bool traverse,
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
2301 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
2302
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2303 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
2304
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2305 void set___modified__ (const octave_value& val) { __modified__ = val; }
7366
2a2115742cb5 [project @ 2008-01-13 06:46:39 by jwe]
jwe
parents: 7365
diff changeset
2306
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2307 void reparent (const graphics_handle& new_parent) { parent = new_parent; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2308
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2309 // Update data limits for AXIS_TYPE (xdata, ydata, etc.) in the parent
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2310 // axes object.
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2311
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2312 virtual void update_axis_limits (const std::string& axis_type) const;
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2313
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2314 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
2315 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
2316
20077
69f92e0affd2 Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20051
diff changeset
2317 virtual void update_uicontextmenu (void) const;
69f92e0affd2 Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20051
diff changeset
2318
26930
ead8f91c5556 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26918
diff changeset
2319 virtual void delete_children (bool clear = false, bool from_root = false)
26982
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2320 {
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2321 children.delete_children (clear, from_root);
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2322 }
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2323
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2324 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
2325 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2326 children.renumber (old_gh, new_gh);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2327 }
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2328
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2329 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
2330 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2331 parent = new_gh;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2332 }
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
2333
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2334 static property_list::pval_map_type factory_defaults (void);
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2335
26122
4d1c6c60f6b3 Clean up implementation of uitable in 36e0e5b428e7.
Rik <rik@octave.org>
parents: 26112
diff changeset
2336 // FIXME: These functions should be generated automatically by the
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2337 // genprops.awk script.
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2338 //
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2339 // 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
2340
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2341 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
2342 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
2343 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
2344 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
2345 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
2346
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2347 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
2348 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
2349 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
2350 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
2351 virtual bool is_zliminclude (void) const { return false; }
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
2352
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
2353 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
2354
9972
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2355 std::set<std::string> dynamic_property_names (void) const;
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2356
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2357 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
2358
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2359 protected:
9972
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2360 std::set<std::string> dynamic_properties;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2361
9972
d32a6cc0193b unshare dynamic properties
John W. Eaton <jwe@octave.org>
parents: 9815
diff changeset
2362 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
2363
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2364 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
2365
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2366 octave_value get_dynamic (bool all = false) const;
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2367
9185
1e5c11890f85 check for invalid property names when setting defaults
John W. Eaton <jwe@octave.org>
parents: 9004
diff changeset
2368 property get_property_dynamic (const caseless_str& pname);
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2369
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2370 BEGIN_BASE_PROPERTIES
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2371 // properties common to all objects
27698
f65b1666e650 don't notify toolkit when setting beingdeleted property (bug #56952)
John W. Eaton <jwe@octave.org>
parents: 27682
diff changeset
2372 bool_property beingdeleted s , "off"
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2373 radio_property busyaction , "{queue}|cancel"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2374 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
2375 children_property children gf , Matrix ()
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2376 bool_property clipping , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2377 callback_property createfcn , Matrix ()
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2378 callback_property deletefcn , Matrix ()
24395
41cf6ee90cb6 Better handling of "handlevisibility" property (bug #52621).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24277
diff changeset
2379 radio_property handlevisibility u , "{on}|callback|off"
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2380 bool_property hittest , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2381 bool_property interruptible , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2382 handle_property parent fs , p
24523
501986e12b8b Implement "pickableparts" property (bug #52795).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24501
diff changeset
2383 radio_property pickableparts , "{visible}|all|none"
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2384 bool_property selected , "off"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2385 bool_property selectionhighlight , "on"
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2386 string_property tag s , ""
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2387 string_property type frs , ty
20077
69f92e0affd2 Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20051
diff changeset
2388 handle_property uicontextmenu u , graphics_handle ()
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2389 any_property userdata , Matrix ()
26045
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
2390 bool_property visible u , "on"
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
2391
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
2392 // Octave-specific properties
27682
e18237114cf8 Hide __appdata__ internal property (bug #57211).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27446
diff changeset
2393 any_property __appdata__ h , Matrix ()
22665
4ea5b0c3b10f Make base graphics property __modified__ hidden (bug #49205).
Rik <rik@octave.org>
parents: 22631
diff changeset
2394 bool_property __modified__ hs , "on"
8061
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2395 graphics_handle __myhandle__ fhrs , mh
f819e8992367 Auto-generate base_properties
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2396 END_PROPERTIES
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2397
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
2398 virtual void update_handlevisibility (void);
24395
41cf6ee90cb6 Better handling of "handlevisibility" property (bug #52621).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24277
diff changeset
2399
26045
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
2400 virtual void update_visible (void) { };
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
2401
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2402 protected:
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2403 struct cmp_caseless_str
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2404 {
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
2405 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
2406 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2407 std::string a1 = a;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2408 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
2409 std::string b1 = b;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2410 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
2411
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2412 return a1 < b1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2413 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2414 };
8052
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2415
961d4c52ffae Convert stem and stem3 to use stem series objects
David Bateman <dbateman@free.fr>
parents: 8023
diff changeset
2416 std::map<caseless_str, property, cmp_caseless_str> all_props;
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2417
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2418 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2419 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
2420 { insert_property (name, property (&p, true)); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2421
22910
23847979b91e maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
2422 virtual void init (void)
23847979b91e maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
2423 {
22831
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
2424 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
2425 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2426 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2427
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
2428 class OCTINTERP_API base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2429 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2430 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2431 friend class graphics_object;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2432
24252
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
2433 base_graphics_object (void) : toolkit_flag (false) { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2434
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
2435 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
2436
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
2437 base_graphics_object (const base_graphics_object&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
2438
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
2439 base_graphics_object& operator = (const base_graphics_object&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
2440
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
2441 virtual ~base_graphics_object (void) = default;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2442
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2443 virtual void mark_modified (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2444 {
20976
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2445 if (! valid_object ())
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2446 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
2447
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2448 get_properties ().mark_modified ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2449 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2450
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2451 virtual void override_defaults (base_graphics_object& obj)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2452 {
20976
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2453 if (! valid_object ())
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2454 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
2455 get_properties ().override_defaults (obj);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2456 }
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
2457
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23401
diff changeset
2458 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
2459 const std::string go_name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2460
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2461 virtual void set_from_list (property_list& plist)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2462 {
20976
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2463 if (! valid_object ())
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2464 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
2465
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2466 get_properties ().set_from_list (*this, plist);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2467 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2468
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2469 virtual void set (const caseless_str& pname, const octave_value& pval)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2470 {
20976
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2471 if (! valid_object ())
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2472 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
2473
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2474 get_properties ().set (pname, pval);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2475 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2476
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2477 virtual void set_defaults (const std::string&)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2478 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2479 error ("base_graphics_object::set_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2480 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2481
26918
0a13d8d19790 avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents: 26879
diff changeset
2482 // The following version of the get method is not declared virtual
0a13d8d19790 avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents: 26879
diff changeset
2483 // because no derived class overrides it.
0a13d8d19790 avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents: 26879
diff changeset
2484
0a13d8d19790 avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents: 26879
diff changeset
2485 octave_value get (bool all = false) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2486 {
20976
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2487 if (! valid_object ())
20956
850e3d2533d4 maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents: 20955
diff changeset
2488 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
2489
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2490 return get_properties ().get (all);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2491 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2492
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2493 virtual octave_value get (const caseless_str& pname) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2494 {
20976
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2495 if (! valid_object ())
20956
850e3d2533d4 maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents: 20955
diff changeset
2496 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
2497
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2498 return get_properties ().get (pname);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2499 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2500
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2501 virtual octave_value get_default (const caseless_str&) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2502
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2503 virtual octave_value get_factory_default (const caseless_str&) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2504
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2505 virtual octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2506 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2507 error ("base_graphics_object::get_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2508 }
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
2509
19666
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
2510 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
2511 {
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
2512 if (! valid_object ())
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
2513 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
2514
19666
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
2515 return property_list ();
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
2516 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2517
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2518 virtual octave_value get_factory_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2519 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2520 error ("base_graphics_object::get_factory_defaults: invalid graphics object");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2521 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2522
18963
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2523 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
2524 {
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2525 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
2526 }
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2527
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
2528 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
2529 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2530 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
2531 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2532
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2533 virtual std::string values_as_string (void);
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2534
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
2535 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
2536
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
2537 virtual octave_scalar_map values_as_struct (void);
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2538
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2539 virtual graphics_handle get_parent (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2540 {
20976
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2541 if (! valid_object ())
20956
850e3d2533d4 maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents: 20955
diff changeset
2542 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
2543
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2544 return get_properties ().get_parent ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2545 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2546
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2547 graphics_handle get_handle (void) const
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2548 {
20976
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2549 if (! valid_object ())
20956
850e3d2533d4 maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents: 20955
diff changeset
2550 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
2551
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2552 return get_properties ().get___myhandle__ ();
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2553 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2554
26930
ead8f91c5556 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26918
diff changeset
2555 virtual void remove_child (const graphics_handle& h, bool from_root = false)
26982
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2556 {
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2557 if (! valid_object ())
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2558 error ("base_graphics_object::remove_child: invalid graphics object");
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2559
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2560 get_properties ().remove_child (h, from_root);
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2561 }
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2562
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2563 virtual void adopt (const graphics_handle& h)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2564 {
20976
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2565 if (! valid_object ())
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2566 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
2567
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2568 get_properties ().adopt (h);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2569 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2570
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2571 virtual void reparent (const graphics_handle& np)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2572 {
20976
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2573 if (! valid_object ())
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2574 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
2575
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2576 get_properties ().reparent (np);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2577 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2578
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2579 virtual void defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2580 {
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
2581 if (! valid_object ())
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2582 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
2583
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20956
diff changeset
2584 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
2585 err_not_implemented (msg.c_str ());
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2586 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2587
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2588 virtual base_properties& get_properties (void)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2589 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2590 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
2591 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
2592 return properties;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2593 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2594
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2595 virtual const base_properties& get_properties (void) const
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2596 {
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2597 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
2598 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
2599 return properties;
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2600 }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2601
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2602 virtual void update_axis_limits (const std::string& axis_type);
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2603
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2604 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
2605 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
2606
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2607 virtual bool valid_object (void) const { return false; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2608
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2609 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
2610
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2611 virtual std::string type (void) const
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2612 {
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2613 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
2614 : "unknown");
7386
22815fa9c368 [project @ 2008-01-15 21:28:43 by jwe]
jwe
parents: 7384
diff changeset
2615 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2616
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2617 bool isa (const std::string& go_name) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2618 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2619 return type () == go_name;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2620 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2621
27734
a9780be9ecbc move graphics_toolkit class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27730
diff changeset
2622 virtual octave::graphics_toolkit get_toolkit (void) const
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2623 {
20976
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2624 if (! valid_object ())
20956
850e3d2533d4 maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents: 20955
diff changeset
2625 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
2626
0fd972b06a6f maint: graphics.in.h: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2627 return get_properties ().get_toolkit ();
7419
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2628 }
f62fb98f1da2 [project @ 2008-01-25 08:24:48 by jwe]
jwe
parents: 7408
diff changeset
2629
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2630 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
2631 const octave_value& v,
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
2632 listener_mode mode = GCB_POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2633 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2634 if (valid_object ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2635 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
2636 }
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2637
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2638 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
2639 const octave_value& v,
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
2640 listener_mode mode = GCB_POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2641 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2642 if (valid_object ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2643 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
2644 }
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2645
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2646 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
2647
18963
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2648 virtual void reset_default_properties (void);
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2649
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2650 protected:
13281
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 initialize (const graphics_object& go)
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 toolkit_flag = get_toolkit ().initialize (go);
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 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
2658 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2659 if (toolkit_flag)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2660 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2661 get_toolkit ().finalize (go);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2662 toolkit_flag = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2663 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2664 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2665
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2666 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
2667 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2668 if (toolkit_flag)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2669 get_toolkit ().update (go, id);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2670 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2671
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2672 protected:
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
2673
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2674 // 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
2675 // 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
2676 bool toolkit_flag;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2677 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2678
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
2679 class OCTINTERP_API graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2680 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2681 public:
24252
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
2682
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2683 graphics_object (void) : rep (new base_graphics_object ()) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2684
24252
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
2685 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
2686
24991
831389905438 omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents: 24795
diff changeset
2687 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
2688
831389905438 omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents: 24795
diff changeset
2689 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
2690
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
2691 ~graphics_object (void) = default;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2692
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2693 void mark_modified (void) { rep->mark_modified (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2694
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2695 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2696 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2697 rep->override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2698 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2699
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
2700 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
2701 {
10600b2dd3c1 make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents: 20045
diff changeset
2702 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
2703 }
10600b2dd3c1 make units other than data work for axes labels and title (bug #35857)
John W. Eaton <jwe@octave.org>
parents: 20045
diff changeset
2704
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23401
diff changeset
2705 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
2706 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
2707 {
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
2708 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
2709 }
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
2710
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2711 void set_from_list (property_list& plist) { rep->set_from_list (plist); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2712
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2713 void set (const caseless_str& name, const octave_value& val)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2714 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2715 rep->set (name, val);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2716 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2717
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2718 void set (const octave_value_list& args);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2719
10056
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
2720 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
2721 octave_idx_type row);
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
2722
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
2723 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
2724
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
2725 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
2726 const octave_value& val);
33ba83a06a42 Fix set function to allow cell and struct arguments.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 9972
diff changeset
2727
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2728 void set_defaults (const std::string& mode) { rep->set_defaults (mode); }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2729
7379
a78c7bccda91 [project @ 2008-01-15 18:42:29 by jwe]
jwe
parents: 7377
diff changeset
2730 octave_value get (bool all = false) const { return rep->get (all); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2731
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2732 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2733 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2734 return name.compare ("default")
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2735 ? get_defaults ()
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2736 : (name.compare ("factory")
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2737 ? get_factory_defaults () : rep->get (name));
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2738 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2739
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
2740 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
2741 {
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
2742 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
2743 }
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
2744
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
2745 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
2746 {
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
2747 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
2748 }
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
2749
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2750 octave_value get_default (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2751 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2752 return rep->get_default (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2753 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2754
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2755 octave_value get_factory_default (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2756 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2757 return rep->get_factory_default (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2758 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2759
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2760 octave_value get_defaults (void) const { return rep->get_defaults (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2761
19666
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
2762 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
2763 {
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
2764 return rep->get_defaults_list ();
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
2765 }
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
2766
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2767 octave_value get_factory_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2768 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2769 return rep->get_factory_defaults ();
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2770 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2771
18963
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2772 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
2773 {
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2774 return rep->get_factory_defaults_list ();
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2775 }
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
2776
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
2777 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
2778 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2779 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
2780 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
2781
10717
9d4a198614ab Add functionality set(handle)
David Bateman <dbateman@free.fr>
parents: 10596
diff changeset
2782 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
2783
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
2784 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
2785 {
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
2786 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
2787 }
ca84d3c9dc24 set: allow retrieving allowed values for individual properties
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17822
diff changeset
2788
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
2789 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
2790
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2791 graphics_handle get_parent (void) const { return rep->get_parent (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2792
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
2793 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
2794
11250
830b940e7ff4 Turn xget_ancestor into regular API
Michael Goffioul <michael.goffioul@gmail.com>
parents: 11247
diff changeset
2795 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
2796
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2797 void remove_child (const graphics_handle& h) { rep->remove_child (h); }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2798
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2799 void adopt (const graphics_handle& h) { rep->adopt (h); }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2800
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2801 void reparent (const graphics_handle& h) { rep->reparent (h); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2802
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2803 void defaults (void) const { rep->defaults (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2804
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2805 bool isa (const std::string& go_name) const { return rep->isa (go_name); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2806
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2807 base_properties& get_properties (void) { return rep->get_properties (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2808
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2809 const base_properties& get_properties (void) const
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2810 {
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2811 return rep->get_properties ();
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2812 }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2813
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2814 void update_axis_limits (const std::string& axis_type)
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2815 {
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2816 rep->update_axis_limits (axis_type);
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2817 }
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
2818
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2819 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
2820 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
2821 {
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2822 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
2823 }
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
2824
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2825 bool valid_object (void) const { return rep->valid_object (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2826
8208
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
2827 std::string type (void) const { return rep->type (); }
f6ca8ff51818 [mq]: graphics-backend
John W. Eaton <jwe@octave.org>
parents: 8102
diff changeset
2828
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2829 operator bool (void) const { return rep->valid_object (); }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2830
26122
4d1c6c60f6b3 Clean up implementation of uitable in 36e0e5b428e7.
Rik <rik@octave.org>
parents: 26112
diff changeset
2831 // FIXME: These functions should be generated automatically by the
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2832 // genprops.awk script.
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2833 //
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
2834 // 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
2835
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2836 octave_value get_alim (void) const
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2837 { return get_properties ().get_alim (); }
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 octave_value get_clim (void) const
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2840 { return get_properties ().get_clim (); }
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2841
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2842 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
2843 { 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
2844
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2845 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
2846 { return get_properties ().get_ylim (); }
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 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
2849 { return get_properties ().get_zlim (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2850
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2851 bool is_aliminclude (void) const
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2852 { return get_properties ().is_aliminclude (); }
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2853
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2854 bool is_climinclude (void) const
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2855 { 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
2856
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2857 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
2858 { return get_properties ().is_xliminclude (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2859
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2860 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
2861 { return get_properties ().is_yliminclude (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2862
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
2863 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
2864 { return get_properties ().is_zliminclude (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2865
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
2866 bool is_handle_visible (void) const
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
2867 { return get_properties ().is_handle_visible (); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
2868
27734
a9780be9ecbc move graphics_toolkit class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27730
diff changeset
2869 octave::graphics_toolkit get_toolkit (void) const { return rep->get_toolkit (); }
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
2870
7849
3249f64f69b2 Initial low-level support for property listeners.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7848
diff changeset
2871 void add_property_listener (const std::string& nm, const octave_value& v,
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
2872 listener_mode mode = GCB_POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2873 { 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
2874
8299
be9b14945774 Add code to remove listeners from properties and use it with newplot
David Bateman <dbateman@free.fr>
parents: 8291
diff changeset
2875 void delete_property_listener (const std::string& nm, const octave_value& v,
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
2876 listener_mode mode = GCB_POSTSET)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2877 { 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
2878
25431
6782d1f0fe54 Delete listeners before invalidating graphics object.
Markus Mützel <markus.muetzel@gmx.de>
parents: 25429
diff changeset
2879 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
2880
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2881 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
2882
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2883 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
2884
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
2885 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
2886
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2887 void reset_default_properties (void)
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2888 { rep->reset_default_properties (); }
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
2889
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
2890 private:
24252
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
2891
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
2892 std::shared_ptr<base_graphics_object> rep;
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
2893 };
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
2894
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
2895 // ---------------------------------------------------------------------
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
2896
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
2897 class OCTINTERP_API root_figure : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2898 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2899 public:
23763
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
2900
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
2901 // 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
2902 // the root_figure object.
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
2903
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
2904 friend class gh_manager;
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
2905
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
2906 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2907 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2908 public:
26930
ead8f91c5556 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26918
diff changeset
2909 void remove_child (const graphics_handle& h, bool from_root = false);
26982
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
2910
14357
e7c74f56cd03 fltk toolkit requires figure units to be "pixels". Bug # 35430.
Ben Abbott <bpabbott@mac.com>
parents: 14324
diff changeset
2911 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
2912 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
2913
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2914 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2915 // properties declarations.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2916
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
2917 // 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
2918 // monitorpositions, pointerlocation, pointerwindow.
18764
89448a7523b2 Add some more callbacks for root properties (bug #42347).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18737
diff changeset
2919 // 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
2920 // them will have no effect.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2921
20459
564e59f75ef8 Remove obsolete properties from root figure object.
Rik <rik@octave.org>
parents: 20428
diff changeset
2922 // 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
2923 // 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
2924 // 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
2925
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
2926 // Programming note: Keep property list sorted if new ones are added.
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
2927
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
2928 BEGIN_PROPERTIES (root_figure, root)
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
2929 handle_property callbackobject Sr , graphics_handle ()
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
2930 array_property commandwindowsize r , Matrix (1, 2, 0)
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
2931 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
2932 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
2933 array_property monitorpositions r , default_screensize ()
10949
848f3a13b7cf Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents: 10948
diff changeset
2934 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
2935 double_property pointerwindow r , 0.0
8560
5cc594679cdc get display characteristics from system
John W. Eaton <jwe@octave.org>
parents: 8465
diff changeset
2936 double_property screendepth r , default_screendepth ()
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
2937 double_property screenpixelsperinch r , default_screenpixelsperinch ()
10949
848f3a13b7cf Backed out changeset 6b50fd2d4ca6
David Bateman <dbateman@free.fr>
parents: 10948
diff changeset
2938 array_property screensize r , default_screensize ()
9778
2364eebcd644 new root figure properties
John W. Eaton <jwe@octave.org>
parents: 9777
diff changeset
2939 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
2940 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
2941 // 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
2942 //radio_property beingdeleted h , "{off}|on"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2943 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2944 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2945
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2946 private:
23763
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
2947
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2948 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2949
23763
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
2950 protected:
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 (void)
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
2953 : 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
2954 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
2955 { }
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
2956
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2957 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2958
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
2959 ~root_figure (void) = default;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2960
23763
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
2961 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
2962
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
2963 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
2964
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2965 void mark_modified (void) { }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2966
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2967 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2968 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2969 // Now override with our defaults. If the default_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2970 // list includes the properties for all defaults (line,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2971 // surface, etc.) then we don't have to know the type of OBJ
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2972 // here, we just call its set function and let it decide which
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2973 // properties from the list to use.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2974 obj.set_from_list (default_properties);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2975 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2976
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2977 void set (const caseless_str& name, const octave_value& value)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2978 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2979 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2980 // strip "default", pass rest to function that will
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2981 // parse the remainder and add the element to the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2982 // default_properties map.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2983 default_properties.set (name.substr (7), value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2984 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2985 xproperties.set (name, value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2986 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2987
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
2988 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2989 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2990 octave_value retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2991
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2992 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2993 return get_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2994 else if (name.compare ("factory", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2995 return get_factory_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2996 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2997 retval = xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2998
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
2999 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3000 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3001
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3002 octave_value get_default (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3003 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3004 octave_value retval = default_properties.lookup (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3005
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3006 if (retval.is_undefined ())
7847
40b16e04172a Make backend switching work.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7846
diff changeset
3007 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3008 // no default property found, use factory default
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3009 retval = factory_properties.lookup (name);
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
3010
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
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 default property '%s'", name.c_str ());
7847
40b16e04172a Make backend switching work.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7846
diff changeset
3013 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3014
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3015 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3016 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3017
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3018 octave_value get_factory_default (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3019 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3020 octave_value retval = factory_properties.lookup (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3021
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3022 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
3023 error ("get: invalid factory default property '%s'", name.c_str ());
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3024
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3025 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3026 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3027
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3028 octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3029 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3030 return default_properties.as_struct ("default");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3031 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3032
19666
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
3033 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
3034 {
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
3035 return default_properties;
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
3036 }
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
3037
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3038 octave_value get_factory_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3039 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3040 return factory_properties.as_struct ("factory");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3041 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3042
18963
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
3043 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
3044 {
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
3045 return factory_properties;
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
3046 }
a30e1d20fd3c Freset: properly reset graphics objects (bug #35511)
pantxo <pantxo.diribarne@gmail.com>
parents: 18961
diff changeset
3047
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3048 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3049
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3050 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3051
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3052 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3053
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3054 void reset_default_properties (void);
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
3055
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
3056 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
3057 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3058 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
3059 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
3060 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
3061 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
3062 }
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3063
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3064 private:
23763
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
3065
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3066 property_list default_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3067
23763
54aa9a3250b4 make root_figure::factory_properties local instead of global
John W. Eaton <jwe@octave.org>
parents: 23639
diff changeset
3068 property_list factory_properties;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3069
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3070 static property_list::plist_map_type init_factory_properties (void);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3071 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3072
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3073 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3074
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
3075 class OCTINTERP_API figure : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3076 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3077 public:
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3078 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3079 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3080 public:
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
3081 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
3082 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3083 integerhandle = val;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3084 }
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
3085
26930
ead8f91c5556 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26918
diff changeset
3086 void remove_child (const graphics_handle& h, bool from_root = false);
26982
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
3087
7366
2a2115742cb5 [project @ 2008-01-13 06:46:39 by jwe]
jwe
parents: 7365
diff changeset
3088 void set_visible (const octave_value& val);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3089
27734
a9780be9ecbc move graphics_toolkit class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27730
diff changeset
3090 octave::graphics_toolkit get_toolkit (void) const;
a9780be9ecbc move graphics_toolkit class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27730
diff changeset
3091
a9780be9ecbc move graphics_toolkit class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27730
diff changeset
3092 void set_toolkit (const octave::graphics_toolkit& b);
7439
1867156fc552 [project @ 2008-02-02 07:56:53 by jwe]
jwe
parents: 7435
diff changeset
3093
23774
41795b504a8b don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents: 23763
diff changeset
3094 void set___graphics_toolkit__ (const octave_value& val);
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3095
19044
4c59f69fa52c figure: define adopted axes "currentaxes" if none is defined (bug #41573)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19021
diff changeset
3096 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
3097
13713
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3098 void set_position (const octave_value& val,
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3099 bool do_notify_toolkit = true);
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3100
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3101 void set_outerposition (const octave_value& val,
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3102 bool do_notify_toolkit = true);
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3103
26469
bf835b1d04b1 Don't use C++ callbacks to notify position changes from Qt figures (bug #48519)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26383
diff changeset
3104 Matrix bbox2position (const Matrix& bbox) const;
bf835b1d04b1 Don't use C++ callbacks to notify position changes from Qt figures (bug #48519)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26383
diff changeset
3105
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3106 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
3107 const Matrix& parent_pix_size = Matrix ()) const;
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3108
13713
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3109 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
3110 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
3111
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3112 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
3113
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3114 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
3115
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
3116 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
3117
9d3a7ad94ee6 Respect the units and paperunits figure properties and the units and fontunits axes properties
David Bateman <dbateman@free.fr>
parents: 10990
diff changeset
3118 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
3119
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
3120 std::string get_title (void) const;
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 8058
diff changeset
3121
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3122 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3123 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3124 // Programming note: Keep property list sorted if new ones are added.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3125
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
3126 BEGIN_PROPERTIES (figure)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3127 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
3128 callback_property buttondownfcn , Matrix ()
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3129 callback_property closerequestfcn , "closereq"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3130 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
3131 array_property colormap , viridis_colormap ()
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3132 handle_property currentaxes S , graphics_handle ()
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3133 string_property currentcharacter r , ""
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3134 handle_property currentobject r , graphics_handle ()
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10505
diff changeset
3135 array_property currentpoint r , Matrix (2, 1, 0)
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3136 bool_property dockcontrols , "off"
11247
29b1f7d68665 make filename property of figure objects writable
John W. Eaton <jwe@octave.org>
parents: 11175
diff changeset
3137 string_property filename , ""
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3138 bool_property graphicssmoothing , "on"
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13810
diff changeset
3139 bool_property integerhandle S , "on"
21323
030d4d6c2b58 Implement figure property "InvertHardCopy" for printing (bug #47230).
Rik <rik@octave.org>
parents: 21289
diff changeset
3140 bool_property inverthardcopy , "on"
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3141 callback_property keypressfcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3142 callback_property keyreleasefcn , Matrix ()
21948
241d39c66e8f Update graphics properties for figure object.
Rik <rik@octave.org>
parents: 21905
diff changeset
3143 radio_property menubar , "{figure}|none"
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3144 string_property name , ""
25273
ac6ba9f2fa41 Add new Figure graphic property "Number" (bug #53343).
Rik <rik@octave.org>
parents: 25173
diff changeset
3145 array_property number rG , Matrix ()
21948
241d39c66e8f Update graphics properties for figure object.
Rik <rik@octave.org>
parents: 21905
diff changeset
3146 radio_property nextplot , "{add}|new|replace|replacechildren"
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3147 bool_property numbertitle , "on"
13713
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3148 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
3149 radio_property paperorientation U , "{portrait}|landscape"
18773
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3150 array_property paperposition m , default_figure_paperposition ()
21948
241d39c66e8f Update graphics properties for figure object.
Rik <rik@octave.org>
parents: 21905
diff changeset
3151 // FIXME: Matlab default is "auto", but this messes up hgsave BIST test.
27432
1e79d913baaa Change default figure property "paperpositionmode" to "auto" (bug #56916).
Rik <rik@octave.org>
parents: 27335
diff changeset
3152 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
3153 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
3154 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
3155 radio_property paperunits Su , "{inches}|centimeters|normalized|points"
27099
2cd31365c84a Implement "pointer" and related figure properties for Qt toolkit (bug #56347)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26985
diff changeset
3156 radio_property pointer , "crosshair|{arrow}|ibeam|watch|topl|topr|botl|botr|left|top|right|bottom|circle|cross|fleur|custom|hand"
2cd31365c84a Implement "pointer" and related figure properties for Qt toolkit (bug #56347)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26985
diff changeset
3157 array_property pointershapecdata , Matrix (16, 16, 1)
2cd31365c84a Implement "pointer" and related figure properties for Qt toolkit (bug #56347)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26985
diff changeset
3158 array_property pointershapehotspot , Matrix (1, 2, 1)
13713
d99aa455296e Add outerposition property to figure objects.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
3159 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
3160 radio_property renderer m , "{opengl}|painters"
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3161 radio_property renderermode , "{auto}|manual"
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3162 bool_property resize , "on"
26129
3c61c8137664 Add sizechangedfcn property to uipanel objects.
Rik <rik@octave.org>
parents: 26125
diff changeset
3163 // FIXME: "resizefcn" is no longer recommended by Matlab,
3c61c8137664 Add sizechangedfcn property to uipanel objects.
Rik <rik@octave.org>
parents: 26125
diff changeset
3164 // and has been replaced with "sizechangedfcn"
21948
241d39c66e8f Update graphics properties for figure object.
Rik <rik@octave.org>
parents: 21905
diff changeset
3165 // Eventually this will need to be hidden, and then removed.
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3166 callback_property resizefcn , Matrix ()
21948
241d39c66e8f Update graphics properties for figure object.
Rik <rik@octave.org>
parents: 21905
diff changeset
3167 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
3168 callback_property sizechangedfcn , Matrix ()
21948
241d39c66e8f Update graphics properties for figure object.
Rik <rik@octave.org>
parents: 21905
diff changeset
3169 radio_property toolbar , "{auto}|figure|none"
241d39c66e8f Update graphics properties for figure object.
Rik <rik@octave.org>
parents: 21905
diff changeset
3170 radio_property units Su , "{pixels}|normalized|inches|centimeters|points|characters"
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3171 callback_property windowbuttondownfcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3172 callback_property windowbuttonmotionfcn , Matrix ()
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3173 callback_property windowbuttonupfcn , Matrix ()
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3174 callback_property windowkeypressfcn , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3175 callback_property windowkeyreleasefcn , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3176 callback_property windowscrollwheelfcn , Matrix ()
7405
b0734cf13ad4 [project @ 2008-01-19 07:33:00 by jwe]
jwe
parents: 7404
diff changeset
3177 radio_property windowstyle , "{normal}|modal|docked"
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
3178
24687
8b935067a257 Allow printing without updating qt visible or invisible figures (bug #52940).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24637
diff changeset
3179 // Overridden base property
24637
3d78a7eb5aa4 Make "PickableParts" property for figures the fixed value of "visible".
Rik <rik@octave.org>
parents: 24635
diff changeset
3180 // 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
3181 // 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
3182 radio_property pickableparts h , "{visible}"
3d78a7eb5aa4 Make "PickableParts" property for figures the fixed value of "visible".
Rik <rik@octave.org>
parents: 24635
diff changeset
3183
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3184 // Octave-specific properties
21684
1449e3b98941 store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents: 21659
diff changeset
3185 mutable string_property __gl_extensions__ hr , ""
1449e3b98941 store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents: 21659
diff changeset
3186 mutable string_property __gl_renderer__ hr , ""
1449e3b98941 store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents: 21659
diff changeset
3187 mutable string_property __gl_vendor__ hr , ""
1449e3b98941 store OpenGL version info in figure properties
John W. Eaton <jwe@octave.org>
parents: 21659
diff changeset
3188 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
3189 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
3190 string_property __graphics_toolkit__ hs , default_graphics_toolkit ()
13699
dd9b32af0a01 Implement guidata/guihandles.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13324
diff changeset
3191 any_property __guidata__ h , Matrix ()
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3192 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
3193 bool_property __printing__ h , "off"
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3194 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
3195 any_property __plot_stream__ h , Matrix ()
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3196 any_property __rotate_mode__ h , Matrix ()
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3197 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
3198 double_property __device_pixel_ratio__ hU , 1.0
21948
241d39c66e8f Update graphics properties for figure object.
Rik <rik@octave.org>
parents: 21905
diff changeset
3199
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3200 END_PROPERTIES
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3201
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3202 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3203 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3204 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3205 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
3206 colormap.add_constraint (dim_vector (-1, 3));
25991
57952dd2da42 Allow figure "colormap" property to be assigned '[]' (bug #54926).
Rik <rik@octave.org>
parents: 25982
diff changeset
3207 colormap.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
3208 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
3209 outerposition.add_constraint (FINITE);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3210 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
3211 paperposition.add_constraint (FINITE);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3212 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
3213 papersize.add_constraint (FINITE);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3214 pointershapecdata.add_constraint (dim_vector (16, 16));
27099
2cd31365c84a Implement "pointer" and related figure properties for Qt toolkit (bug #56347)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26985
diff changeset
3215 pointershapecdata.add_constraint (dim_vector (32, 32));
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3216 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
3217 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
3218 position.add_constraint (FINITE);
27709
0a84a7d0998d don't declare figure::properties::toolkit as mutable
John W. Eaton <jwe@octave.org>
parents: 27698
diff changeset
3219
0a84a7d0998d don't declare figure::properties::toolkit as mutable
John W. Eaton <jwe@octave.org>
parents: 27698
diff changeset
3220 init_toolkit ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3221 }
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents: 7406
diff changeset
3222
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
3223 private:
18773
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3224 Matrix get_auto_paperposition (void);
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3225
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3226 void update_paperpositionmode (void)
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3227 {
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3228 if (paperpositionmode.is ("auto"))
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3229 paperposition.set (get_auto_paperposition ());
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3230 }
70ea5a2856fe Handle figure paperpositionmode "auto" (bug #37554)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18766
diff changeset
3231
24395
41cf6ee90cb6 Better handling of "handlevisibility" property (bug #52621).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24277
diff changeset
3232 void update_handlevisibility (void);
41cf6ee90cb6 Better handling of "handlevisibility" property (bug #52621).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24277
diff changeset
3233
27709
0a84a7d0998d don't declare figure::properties::toolkit as mutable
John W. Eaton <jwe@octave.org>
parents: 27698
diff changeset
3234 void init_toolkit (void);
0a84a7d0998d don't declare figure::properties::toolkit as mutable
John W. Eaton <jwe@octave.org>
parents: 27698
diff changeset
3235
27734
a9780be9ecbc move graphics_toolkit class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27730
diff changeset
3236 octave::graphics_toolkit toolkit;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3237 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3238
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3239 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3240 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3241
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3242 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3243 figure (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3244 : 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
3245 { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3246
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
3247 ~figure (void) = default;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3248
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3249 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3250 {
26878
3c7c5b7c3044 doc: Refer to "root object" rather than "root figure object".
Rik <rik@octave.org>
parents: 26520
diff changeset
3251 // Allow parent (root object) to override first (properties knows how
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3252 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3253 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3254
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3255 // Now override with our defaults. If the default_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3256 // list includes the properties for all defaults (line,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3257 // surface, etc.) then we don't have to know the type of OBJ
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3258 // here, we just call its set function and let it decide which
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3259 // properties from the list to use.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3260 obj.set_from_list (default_properties);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3261 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3262
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3263 void set (const caseless_str& name, const octave_value& value)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3264 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3265 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3266 // strip "default", pass rest to function that will
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3267 // parse the remainder and add the element to the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3268 // default_properties map.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3269 default_properties.set (name.substr (7), value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3270 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3271 xproperties.set (name, value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3272 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3273
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3274 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3275 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3276 octave_value retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3277
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3278 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3279 retval = get_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3280 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3281 retval = xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3282
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3283 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3284 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3285
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3286 octave_value get_default (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3287
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3288 octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3289 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3290 return default_properties.as_struct ("default");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3291 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3292
19666
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
3293 property_list get_defaults_list (void) const
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
3294 {
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
3295 return default_properties;
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
3296 }
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
3297
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3298 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3299
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3300 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
3301
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3302 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3303
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3304 void reset_default_properties (void);
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
3305
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
3306 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
3307 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
3308 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
3309 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
3310 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
3311 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
3312 }
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
3313
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3314 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3315 property_list default_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3316 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3317
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3318 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3319
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3320 class OCTINTERP_API graphics_xform
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3321 {
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3322 public:
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3323 graphics_xform (void)
12174
db1f49eaba6b whitespace fixes
John W. Eaton <jwe@octave.org>
parents: 12164
diff changeset
3324 : xform (xform_eye ()), xform_inv (xform_eye ()),
12164
18e9a8da7d18 eliminate some -Weffc++ warnings
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 12126
diff changeset
3325 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
3326 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3327 zlim(1) = 1.0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3328 }
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3329
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3330 graphics_xform (const Matrix& xm, const Matrix& xim,
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3331 const scaler& x, const scaler& y, const scaler& z,
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3332 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
3333 : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { }
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3334
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3335 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
3336 : 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
3337 sy (g.sy), sz (g.sz), zlim (g.zlim) { }
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3338
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
3339 ~graphics_xform (void) = default;
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3340
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3341 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
3342 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3343 xform = g.xform;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3344 xform_inv = g.xform_inv;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3345 sx = g.sx;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3346 sy = g.sy;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3347 sz = g.sz;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3348 zlim = g.zlim;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3349
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3350 return *this;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3351 }
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3352
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3353 static ColumnVector xform_vector (double x, double y, double z);
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3354
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3355 static Matrix xform_eye (void);
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3356
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3357 ColumnVector transform (double x, double y, double z,
10553
f88e3d5d88e2 avoid GCC warnings
John W. Eaton <jwe@octave.org>
parents: 10517
diff changeset
3358 bool use_scale = true) const;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3359
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3360 ColumnVector untransform (double x, double y, double z,
10553
f88e3d5d88e2 avoid GCC warnings
John W. Eaton <jwe@octave.org>
parents: 10517
diff changeset
3361 bool use_scale = true) const;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
3362
10553
f88e3d5d88e2 avoid GCC warnings
John W. Eaton <jwe@octave.org>
parents: 10517
diff changeset
3363 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
3364 { return untransform (x, y, (zlim(0)+zlim(1))/2, use_scale); }
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3365
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3366 Matrix xscale (const Matrix& m) const { return sx.scale (m); }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3367 Matrix yscale (const Matrix& m) const { return sy.scale (m); }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3368 Matrix zscale (const Matrix& m) const { return sz.scale (m); }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3369
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3370 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
3371 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3372 bool has_z = (m.columns () > 2);
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 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
3375 && (! has_z || sz.is_linear ()))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3376 return m;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3377
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3378 Matrix retval (m.dims ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3379
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3380 int r = m.rows ();
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 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
3383 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3384 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
3385 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
3386 if (has_z)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3387 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
3388 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3389
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3390 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3391 }
7832
e06fdf7ea647 Fix default value of patch::facelighting. Add scaler/graphics_xform utilities
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7830
diff changeset
3392
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3393 private:
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3394 Matrix xform;
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3395 Matrix xform_inv;
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3396 scaler sx, sy, sz;
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
3397 Matrix zlim;
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3398 };
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3399
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3400 enum
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3401 {
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3402 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
3403 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
3404 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
3405 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
3406 };
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3407
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
3408 class OCTINTERP_API axes : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3409 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3410 public:
7445
af92b34f3a3a [project @ 2008-02-04 07:53:07 by jwe]
jwe
parents: 7441
diff changeset
3411 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3412 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3413 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3414 void set_defaults (base_graphics_object& obj, const std::string& mode);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3415
26930
ead8f91c5556 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26918
diff changeset
3416 void remove_child (const graphics_handle& h, bool from_root = false);
26982
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
3417
25423
13b1b9a0d9c5 Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
3418 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
3419
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3420 const scaler& get_x_scaler (void) const { return sx; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3421 const scaler& get_y_scaler (void) const { return sy; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3422 const scaler& get_z_scaler (void) const { return sz; }
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3423
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
3424 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
3425 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
3426 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
3427 bool only_text_height=false) const;
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3428
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
3429 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
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 void update_boundingbox (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3432 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3433 if (units_is ("normalized"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3434 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3435 sync_positions ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3436 base_properties::update_boundingbox ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3437 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3438 }
7828
4739b6a1925c Implement resize handler mechanism (call resizefcn on figure resize and notify children).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7827
diff changeset
3439
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3440 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
3441 void update_axes_layout (void);
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3442 void update_aspectratios (void);
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3443 void update_transform (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3444 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3445 update_aspectratios ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3446 update_camera ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3447 update_axes_layout ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3448 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3449
17098
786bcce466e9 Initialize the tightinset during initialization of axes.
Ben Abbott <bpabbott@mac.com>
parents: 17011
diff changeset
3450 void sync_positions (void);
786bcce466e9 Initialize the tightinset during initialization of axes.
Ben Abbott <bpabbott@mac.com>
parents: 17011
diff changeset
3451
12389
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3452 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
3453 void update_xlabel_position (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3454 void update_ylabel_position (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3455 void update_zlabel_position (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3456 void update_title_position (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
3457
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3458 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
3459 { return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); }
7435
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3460
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3461 Matrix get_transform_matrix (void) const { return x_render; }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3462 Matrix get_inverse_transform_matrix (void) const { return x_render_inv; }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3463 Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3464 Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3465 Matrix get_transform_zlim (void) const { return x_zlim; }
464a55f1a5c2 [project @ 2008-02-01 06:47:48 by jwe]
jwe
parents: 7427
diff changeset
3466
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3467 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
3468 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
3469 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
3470 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
3471 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
3472 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
3473 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
3474 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
3475 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
3476 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
3477 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
3478 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
3479 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
3480 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
3481 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
3482 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
3483 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
3484 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
3485 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
3486 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
3487 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
3488 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
3489 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
3490 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
3491 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
3492 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
3493 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
3494 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
3495 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
3496 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
3497 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
3498 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
3499 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
3500 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
3501 { 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
3502 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
3503 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
3504 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
3505 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
3506 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
3507
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
3508 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
3509 { 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
3510
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7836
diff changeset
3511 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
3512 { 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
3513
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19659
diff changeset
3514 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
3515 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
3516 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
3517 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
3518 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
3519 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
3520
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19659
diff changeset
3521 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
3522 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
3523 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
3524
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19659
diff changeset
3525 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
3526 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
3527
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19659
diff changeset
3528 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
3529 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
3530
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19659
diff changeset
3531 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
3532 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
3533
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
3534 void unzoom (void);
24395
41cf6ee90cb6 Better handling of "handlevisibility" property (bug #52621).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24277
diff changeset
3535 void update_handlevisibility (void);
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19659
diff changeset
3536 void push_zoom_stack (void);
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19659
diff changeset
3537 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
3538
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
3539 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
3540
25884
4e108574385c Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents: 25867
diff changeset
3541 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
3542
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
3543 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
3544
25423
13b1b9a0d9c5 Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
3545 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
3546 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
3547 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
3548
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3549 private:
23401
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3550
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3551 scaler sx = scaler ();
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3552 scaler sy = scaler ();
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3553 scaler sz = scaler ();
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3554
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3555 Matrix x_render = Matrix ();
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3556 Matrix x_render_inv = Matrix ();
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3557 Matrix x_gl_mat1 = Matrix ();
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3558 Matrix x_gl_mat2 = Matrix ();
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3559 Matrix x_zlim = Matrix ();
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3560
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3561 std::list<octave_value> zoom_stack = std::list<octave_value> ();
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3562
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3563 // Axes layout data
23401
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3564 int xstate = 0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3565 int ystate = 0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3566 int zstate = 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 xPlane = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3569 double yPlane = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3570 double zPlane = 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 xPlaneN = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3573 double yPlaneN = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3574 double zPlaneN = 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 xpTick = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3577 double ypTick = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3578 double zpTick = 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 xpTickN = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3581 double ypTickN = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3582 double zpTickN = 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 fx = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3585 double fy = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3586 double fz = 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 double xticklen = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3589 double yticklen = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3590 double zticklen = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3591
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3592 double xtickoffset = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3593 double ytickoffset = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3594 double ztickoffset = 0.0;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3595
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3596 bool x2Dtop = false;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3597 bool y2Dright = false;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3598 bool layer2Dtop = false;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3599 bool is2D = false;
23859
7148b237f94f Fix regression introduced by cset 06805aabbdd1 (bug #50750).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23803
diff changeset
3600 bool has3Dkids = false;
23401
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3601 bool xySym = false;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3602 bool xyzSym = false;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3603 bool zSign = false;
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23396
diff changeset
3604 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
3605
25423
13b1b9a0d9c5 Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
3606 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
3607
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
3608 // 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
3609 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
3610
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3611 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
3612 const octave_value& v);
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3613
26930
ead8f91c5556 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26918
diff changeset
3614 void delete_text_child (handle_property& h, bool from_root = false);
26982
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
3615
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3616 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3617 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3618 // 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
3619
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
3620 BEGIN_PROPERTIES (axes)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3621 radio_property activepositionproperty , "{outerposition}|position"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3622 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
3623 radio_property alimmode , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3624 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
3625 bool_property box u , "off"
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3626 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
3627 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
3628 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
3629 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
3630 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
3631 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
3632 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
3633 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
3634 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
3635 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
3636 radio_property climmode al , "{auto}|manual"
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3637 radio_property clippingstyle , "{3dbox}|rectangle"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3638 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
3639 array_property colormap sg , Matrix ()
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3640 array_property colororder , default_colororder ()
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3641 double_property colororderindex , 1.0
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3642 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
3643 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
3644 radio_property dataaspectratiomode u , "{auto}|manual"
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3645 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
3646 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
3647 double_property fontsize u , 10
26858
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26715
diff changeset
3648 bool_property fontsmoothing u , "on"
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3649 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
3650 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
3651 double_property gridalpha m , 0.15
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3652 radio_property gridalphamode , "{auto}|manual"
26682
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
3653 color_property gridcolor m , color_property (color_values (0.15, 0.15, 0.15), radio_values ("none"))
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3654 radio_property gridcolormode , "{auto}|manual"
22056
05ad23810150 Use default gridlinestyle of '-' for Matlab compatibility.
Rik <rik@octave.org>
parents: 22022
diff changeset
3655 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
3656 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
3657 radio_property layer u , "{bottom}|top"
17382
50b2863d10a6 Create Matlab compatible linestyleorder char matrices (bug #34906)
Rik <rik@octave.org>
parents: 17104
diff changeset
3658 // FIXME: should be kind of string array.
50b2863d10a6 Create Matlab compatible linestyleorder char matrices (bug #34906)
Rik <rik@octave.org>
parents: 17104
diff changeset
3659 any_property linestyleorder S , "-"
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3660 double_property linestyleorderindex , 1.0
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3661 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
3662 double_property minorgridalpha m , 0.25
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3663 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
3664 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
3665 radio_property minorgridcolormode , "{auto}|manual"
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3666 radio_property minorgridlinestyle , "{:}|-|--|-.|none"
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3667 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
3668 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
3669 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
3670 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
3671 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
3672 radio_property projection , "{orthographic}|perspective"
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3673 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
3674 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
3675 radio_property tickdirmode u , "{auto}|manual"
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3676 // FIXME: Added recently to Matlab, should replace interpreter property.
26055
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26045
diff changeset
3677 radio_property ticklabelinterpreter u , "{tex}|latex|none"
14391
c9ec21bef97a Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
3678 array_property ticklength u , default_axes_ticklength ()
7403
135c13496faf [project @ 2008-01-19 06:06:46 by jwe]
jwe
parents: 7395
diff changeset
3679 array_property tightinset r , Matrix (1, 4, 0.0)
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
3680 handle_property title SOf , 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
3681 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
3682 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
3683 // 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
3684 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
3685 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
3686 radio_property xaxislocation u , "{bottom}|top|origin"
26682
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
3687 color_property xcolor mu , color_property (color_values (0.15, 0.15, 0.15), radio_values ("none"))
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3688 radio_property xcolormode , "{auto}|manual"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3689 radio_property xdir u , "{normal}|reverse"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3690 bool_property xgrid , "off"
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
3691 handle_property xlabel SOf , make_graphics_handle ("text", __myhandle__, false, false, false)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3692 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
3693 radio_property xlimmode al , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3694 bool_property xminorgrid , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3695 bool_property xminortick , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3696 radio_property xscale alu , "{linear}|log"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3697 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
3698 // 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
3699 any_property xticklabel S , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3700 radio_property xticklabelmode u , "{auto}|manual"
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3701 double_property xticklabelrotation , 0.0
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3702 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
3703 radio_property yaxislocation u , "{left}|right|origin"
26682
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
3704 color_property ycolor mu , color_property (color_values (0.15, 0.15, 0.15), radio_values ("none"))
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3705 radio_property ycolormode , "{auto}|manual"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3706 radio_property ydir u , "{normal}|reverse"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3707 bool_property ygrid , "off"
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
3708 handle_property ylabel SOf , make_graphics_handle ("text", __myhandle__, false, false, false)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3709 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
3710 radio_property ylimmode al , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3711 bool_property yminorgrid , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3712 bool_property yminortick , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3713 radio_property yscale alu , "{linear}|log"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3714 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
3715 any_property yticklabel S , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3716 radio_property yticklabelmode u , "{auto}|manual"
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3717 double_property yticklabelrotation , 0.0
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3718 radio_property ytickmode u , "{auto}|manual"
26682
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
3719 color_property zcolor mu , color_property (color_values (0.15, 0.15, 0.15), radio_values ("none"))
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3720 radio_property zcolormode , "{auto}|manual"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3721 radio_property zdir u , "{normal}|reverse"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3722 bool_property zgrid , "off"
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
3723 handle_property zlabel SOf , make_graphics_handle ("text", __myhandle__, false, false, false)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3724 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
3725 radio_property zlimmode al , "{auto}|manual"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3726 bool_property zminorgrid , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3727 bool_property zminortick , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3728 radio_property zscale alu , "{linear}|log"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3729 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
3730 any_property zticklabel S , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3731 radio_property zticklabelmode u , "{auto}|manual"
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3732 double_property zticklabelrotation , 0.0
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3733 radio_property ztickmode u , "{auto}|manual"
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
3734
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3735 // 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
3736 array_property __colormap__ hu , Matrix ()
20258
530803d4f65f Update root, figure, and axes graphics object properties.
Rik <rik@octave.org>
parents: 20232
diff changeset
3737 double_property mousewheelzoom , 0.5
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
3738
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3739 // 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
3740 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
3741 // hidden properties for inset
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
3742 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
3743 // hidden properties for minor ticks
22623
76f1164d2135 Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents: 22622
diff changeset
3744 row_vector_property xminortickvalues h , Matrix ()
76f1164d2135 Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents: 22622
diff changeset
3745 row_vector_property yminortickvalues h , Matrix ()
76f1164d2135 Rename [xyz]mtick properties to [xyz]minortickvalues (bug #49205).
Rik <rik@octave.org>
parents: 22622
diff changeset
3746 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
3747 // 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
3748 double_property __fontsize_points__ hgr , 0
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
3749 END_PROPERTIES
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
3750
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
3751 protected:
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
3752 void init (void);
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3753
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3754 private:
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3755
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3756 std::string
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3757 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
3758 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3759 std::string retval = scale;
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 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
3762 retval = "neglog";
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3763
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3764 return retval;
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
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3767 void update_xscale (void)
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3768 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3769 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
3770 }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3771
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3772 void update_yscale (void)
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3773 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3774 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
3775 }
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3776
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3777 void update_zscale (void)
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3778 {
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
3779 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
3780 }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3781
23001
14f1738a56ae Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22619
diff changeset
3782 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
3783 void update_xcolor (void)
14f1738a56ae Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22619
diff changeset
3784 { update_label_color (xlabel, xcolor); }
14f1738a56ae Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22619
diff changeset
3785
14f1738a56ae Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22619
diff changeset
3786 void update_ycolor (void)
14f1738a56ae Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22619
diff changeset
3787 { update_label_color (ylabel, ycolor); }
14f1738a56ae Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22619
diff changeset
3788
14f1738a56ae Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22619
diff changeset
3789 void update_zcolor (void)
14f1738a56ae Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22619
diff changeset
3790 { update_label_color (zlabel, zcolor); }
14f1738a56ae Use C++ updaters for labels color (bug #49980).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22619
diff changeset
3791
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
3792 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
3793
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3794 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
3795 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
3796 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
3797 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
3798
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3799 void update_camerapositionmode (void)
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3800 {
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3801 if (camerapositionmode_is ("auto"))
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3802 update_cameraposition ();
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3803 }
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3804 void update_cameratargetmode (void)
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3805 {
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3806 if (cameratargetmode_is ("auto"))
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3807 update_cameratarget ();
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3808 }
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3809 void update_cameraupvectormode (void)
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3810 {
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3811 if (cameraupvectormode_is ("auto"))
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3812 update_cameraupvector ();
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3813 }
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3814 void update_cameraviewanglemode (void)
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3815 {
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3816 if (cameraviewanglemode_is ("auto"))
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3817 update_cameraviewangle ();
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3818 }
b188be2b962b Call update_transform on camera property change (bug #44503)
Colin Macdonald <cbm@m.fsf.org>
parents: 24120
diff changeset
3819
12441
b932ae4381da improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12440
diff changeset
3820 void update_dataaspectratio (void) { sync_positions (); }
b932ae4381da improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12440
diff changeset
3821 void update_dataaspectratiomode (void) { sync_positions (); }
b932ae4381da improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12440
diff changeset
3822 void update_plotboxaspectratio (void) { sync_positions (); }
b932ae4381da improvements in synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12440
diff changeset
3823 void update_plotboxaspectratiomode (void) { sync_positions (); }
7427
65f0a8ced9d2 [project @ 2008-01-28 22:42:18 by jwe]
jwe
parents: 7419
diff changeset
3824
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3825 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
3826 void update_box (void)
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3827 {
24191
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3828 if (xticklabelmode.is ("auto"))
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3829 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
3830 xaxislocation_is ("origin"),
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3831 yscale.is ("log") ? 2 :
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3832 (yaxislocation_is ("origin") ? 0 :
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3833 (yaxislocation_is ("left") ? -1 : 1)),
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3834 xlim);
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3835 if (yticklabelmode.is ("auto"))
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3836 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
3837 yaxislocation_is ("origin"),
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3838 xscale.is ("log") ? 2 :
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3839 (xaxislocation_is ("origin") ? 0 :
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3840 (xaxislocation_is ("bottom") ? -1 : 1)),
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3841 ylim);
23116
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3842 }
12503
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3843 void update_yaxislocation (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3844 {
19652
5b4fd7ebcfc6 Update "tightinset" when "x/yaxislocation" is changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19597
diff changeset
3845 sync_positions ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3846 update_axes_layout ();
24191
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3847 if (xticklabelmode.is ("auto"))
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3848 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
3849 xaxislocation_is ("origin"),
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3850 yscale.is ("log") ? 2 :
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3851 (yaxislocation_is ("origin") ? 0 :
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3852 (yaxislocation_is ("left") ? -1 : 1)),
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3853 xlim);
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3854 if (yticklabelmode.is ("auto"))
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3855 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
3856 yaxislocation_is ("origin"),
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3857 xscale.is ("log") ? 2 :
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3858 (xaxislocation_is ("origin") ? 0 :
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3859 (xaxislocation_is ("bottom") ? -1 : 1)),
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3860 ylim);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3861 update_ylabel_position ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3862 }
12503
2c66314447f1 update axis label position after axis location changes
Konstantinos Poulios <logari81@gmail.com>
parents: 12496
diff changeset
3863 void update_xaxislocation (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3864 {
19652
5b4fd7ebcfc6 Update "tightinset" when "x/yaxislocation" is changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19597
diff changeset
3865 sync_positions ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3866 update_axes_layout ();
24191
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3867 if (xticklabelmode.is ("auto"))
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3868 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
3869 xaxislocation_is ("origin"),
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3870 yscale.is ("log") ? 2 :
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3871 (yaxislocation_is ("origin") ? 0 :
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3872 (yaxislocation_is ("left") ? -1 : 1)),
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3873 xlim);
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3874 if (yticklabelmode.is ("auto"))
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3875 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
3876 yaxislocation_is ("origin"),
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3877 xscale.is ("log") ? 2 :
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3878 (xaxislocation_is ("origin") ? 0 :
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3879 (xaxislocation_is ("bottom") ? -1 : 1)),
fdd67d871a72 Keep manually set tick labels (bug #52284).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24127
diff changeset
3880 ylim);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3881 update_xlabel_position ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3882 }
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3883
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
3884 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
3885 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
3886 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
3887
14391
c9ec21bef97a Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
3888 void update_ticklength (void);
c9ec21bef97a Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
3889 void update_tickdir (void) { update_ticklength (); }
c9ec21bef97a Fix ticklength updating (bug # 35438).
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
3890 void update_tickdirmode (void) { update_ticklength (); }
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
3891
26055
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26045
diff changeset
3892 void update_ticklabelinterpreter (void)
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26045
diff changeset
3893 {
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26045
diff changeset
3894 update_xtick ();
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26045
diff changeset
3895 update_ytick ();
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26045
diff changeset
3896 update_ztick ();
8b9e6a39e0a2 Allow log axes to be exported correctly in tex formats (bug #50130).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26045
diff changeset
3897 }
26469
bf835b1d04b1 Don't use C++ callbacks to notify position changes from Qt figures (bug #48519)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26383
diff changeset
3898
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3899 void update_xtick (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 (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
3902 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
3903 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
3904 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
3905 xaxislocation_is ("origin"),
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3906 yscale.is ("log") ? 2 :
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3907 (yaxislocation_is ("origin") ? 0 :
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3908 (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
3909 xlim);
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_ytick (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 (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
3915 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
3916 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
3917 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
3918 yaxislocation_is ("origin"),
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3919 xscale.is ("log") ? 2 :
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3920 (xaxislocation_is ("origin") ? 0 :
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3921 (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
3922 ylim);
19659
a9516bc4c55c Update axes "tightinset" when "x/y/ztick" have changed
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19652
diff changeset
3923 sync_positions ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3924 }
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3925 void update_ztick (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3926 {
22710
0cbe4714ce1b Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22665
diff changeset
3927 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
3928 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
3929 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
3930 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
3931 sync_positions ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3932 }
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3933
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3934 void update_xtickmode (void)
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 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
3937 update_xtick ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3938 }
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3939 void update_ytickmode (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3940 {
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3941 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
3942 update_ytick ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3943 }
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3944 void update_ztickmode (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3945 {
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3946 if (ztickmode.is ("auto"))
22710
0cbe4714ce1b Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22665
diff changeset
3947 update_ztick ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3948 }
11394
ecd87194adb6 Update ticks after {xyz}tickmode is set to auto
Konstantinos Poulios <logari81@googlemail.com>
parents: 11385
diff changeset
3949
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3950 void update_xticklabelmode (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3951 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3952 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
3953 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
3954 xaxislocation_is ("origin"),
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3955 yscale.is ("log") ? 2 :
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3956 (yaxislocation_is ("origin") ? 0 :
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3957 (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
3958 xlim);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3959 }
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3960 void update_yticklabelmode (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3961 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3962 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
3963 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
3964 yaxislocation_is ("origin"),
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3965 xscale.is ("log") ? 2 :
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3966 (xaxislocation_is ("origin") ? 0 :
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
3967 (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
3968 ylim);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3969 }
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3970 void update_zticklabelmode (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3971 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
3972 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
3973 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
3974 }
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
3975
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
3976 void update_fontname (void)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
3977 {
22723
03cebe1fb0e3 Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22710
diff changeset
3978 update_font ("fontname");
19684
2b93834e5ede Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19678
diff changeset
3979 sync_positions ();
2b93834e5ede Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19678
diff changeset
3980 }
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
3981 void update_fontsize (void)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
3982 {
22723
03cebe1fb0e3 Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22710
diff changeset
3983 update_font ("fontsize");
19684
2b93834e5ede Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19678
diff changeset
3984 sync_positions ();
2b93834e5ede Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19678
diff changeset
3985 }
26858
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26715
diff changeset
3986 void update_fontsmoothing (void)
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26715
diff changeset
3987 {
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26715
diff changeset
3988 update_font ("fontsmoothing");
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26715
diff changeset
3989 }
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
3990 void update_fontangle (void)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
3991 {
22723
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 ("fontangle");
19684
2b93834e5ede Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19678
diff changeset
3993 sync_positions ();
2b93834e5ede Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19678
diff changeset
3994 }
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
3995 void update_fontweight (void)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
3996 {
22723
03cebe1fb0e3 Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22710
diff changeset
3997 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
3998 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
3999 }
03cebe1fb0e3 Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22710
diff changeset
4000
03cebe1fb0e3 Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22710
diff changeset
4001 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
4002 {
26371
87f11da73b19 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26194
diff changeset
4003 // update_font handles title and axis labels
22723
03cebe1fb0e3 Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22710
diff changeset
4004 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
4005 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
4006 }
03cebe1fb0e3 Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22710
diff changeset
4007
03cebe1fb0e3 Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22710
diff changeset
4008 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
4009 {
03cebe1fb0e3 Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22710
diff changeset
4010 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
4011 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
4012 }
03cebe1fb0e3 Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22710
diff changeset
4013
03cebe1fb0e3 Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22710
diff changeset
4014 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
4015 {
26371
87f11da73b19 graphics.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26194
diff changeset
4016 // update_font handles title and axis labels
22723
03cebe1fb0e3 Update labels and title font according to axes font properties (bug #49469)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22710
diff changeset
4017 update_font ("fontweight");
19684
2b93834e5ede Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19678
diff changeset
4018 sync_positions ();
2b93834e5ede Update tightinset when "font*" properties are changed (bug #39581)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19678
diff changeset
4019 }
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
4020
25966
d85049849e88 improve plot position updates (bug #48273)
John W. Eaton <jwe@octave.org>
parents: 25960
diff changeset
4021 void update_outerposition (void);
d85049849e88 improve plot position updates (bug #48273)
John W. Eaton <jwe@octave.org>
parents: 25960
diff changeset
4022 void update_position (void);
d85049849e88 improve plot position updates (bug #48273)
John W. Eaton <jwe@octave.org>
parents: 25960
diff changeset
4023 void update_looseinset (void);
12467
2f83974d5a6d implement looseinset property for axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12443
diff changeset
4024
7827
3584f37eac69 better tick and limit handling, still missing logscale support
Shai Ayal <shaiay@sourceforge.net>
parents: 7826
diff changeset
4025 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
4026 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
4027 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
4028 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
4029 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
4030 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
4031 const int other_axislocation,
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
4032 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
4033 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
4034 const string_vector& ticklabels,
63dc132a1000 Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents: 12327
diff changeset
4035 const Matrix& limits);
63dc132a1000 Move axes labels and title positioning to axes::properties
Konstantinos Poulios <logari81@gmail.com>
parents: 12327
diff changeset
4036
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4037 void fix_limits (array_property& lims)
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4038 {
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
4039 if (lims.get ().isempty ())
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4040 return;
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4041
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4042 Matrix l = lims.get ().matrix_value ();
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4043 if (l(0) > l(1))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4044 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4045 l(0) = 0;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4046 l(1) = 1;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4047 lims = l;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4048 }
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4049 else if (l(0) == l(1))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4050 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4051 l(0) -= 0.5;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4052 l(1) += 0.5;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4053 lims = l;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 10289
diff changeset
4054 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4055 }
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4056
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
4057 Matrix calc_tightbox (const Matrix& init_pos);
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
4058
23524
7c278572db66 Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 23457
diff changeset
4059 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
4060 {
7c278572db66 Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 23457
diff changeset
4061 set___colormap__ (val);
7c278572db66 Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 23457
diff changeset
4062 }
7c278572db66 Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 23457
diff changeset
4063
24501
2f10c3265607 Make sure axes "colormap" property listeners are executed (bug #52799).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24452
diff changeset
4064 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
4065 {
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
4066 colormap.run_listeners (GCB_POSTSET);
24501
2f10c3265607 Make sure axes "colormap" property listeners are executed (bug #52799).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24452
diff changeset
4067 }
2f10c3265607 Make sure axes "colormap" property listeners are executed (bug #52799).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24452
diff changeset
4068
23524
7c278572db66 Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 23457
diff changeset
4069 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
4070
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4071 public:
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
4072 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
4073 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
4074 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
4075
ec3d37eeafa2 Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23859
diff changeset
4076 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
4077 const bool logscale, char &update_type);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4078
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19659
diff changeset
4079 void update_xlim ()
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4080 {
24030
ec3d37eeafa2 Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23859
diff changeset
4081 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
4082
22710
0cbe4714ce1b Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22665
diff changeset
4083 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
4084 xtickmode.is ("auto"), xscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
4085 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
4086 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
4087 xaxislocation.is ("origin"),
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
4088 yscale.is ("log") ? 2 :
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
4089 (yaxislocation_is ("origin") ? 0 :
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
4090 (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
4091 xlim);
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4092
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4093 fix_limits (xlim);
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4094
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4095 update_xscale ();
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4096
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
4097 update_axes_layout ();
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4098 }
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4099
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19659
diff changeset
4100 void update_ylim (void)
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4101 {
24030
ec3d37eeafa2 Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23859
diff changeset
4102 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
4103
22710
0cbe4714ce1b Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22665
diff changeset
4104 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
4105 ytickmode.is ("auto"), yscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
4106 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
4107 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
4108 yaxislocation_is ("origin"),
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
4109 xscale.is ("log") ? 2 :
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
4110 (xaxislocation_is ("origin") ? 0 :
868daa374c49 Improve support of "(xy)axislocation" "origin" (bug #48562).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23084
diff changeset
4111 (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
4112 ylim);
7854
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4113
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4114 fix_limits (ylim);
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4115
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4116 update_yscale ();
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4117
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
4118 update_axes_layout ();
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4119 }
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4120
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4121 void update_zlim (void)
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4122 {
24030
ec3d37eeafa2 Auto-adjust limits that span 0 on logarithmic axes (bug #43606).
Markus Mützel <markus.muetzel@gmx.de>
parents: 23859
diff changeset
4123 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
4124
22710
0cbe4714ce1b Correct locations of minor grid lines for manual ticks (bug #45850).
Markus Mützel <markus.muetzel@gmx.de>
parents: 22665
diff changeset
4125 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
4126 ztickmode.is ("auto"), zscale.is ("log"));
9347
3da821b161e9 imported patch ticklabel
Michael Goffioul <michael.goffioul@gmail.com>
parents: 9188
diff changeset
4127 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
4128 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
4129
228858e69bd1 added {x,y,z}lim sanity check
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7850
diff changeset
4130 fix_limits (zlim);
7855
f317f14516cb Add zoom stack facility in axes object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7854
diff changeset
4131
14324
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4132 update_zscale ();
5a2b012b10c7 allow zooming for logscale plots
John W. Eaton <jwe@octave.org>
parents: 14314
diff changeset
4133
12327
2ad37783bf01 Move axes layout from opengl_renderer::draw_axes to axes::properties
Konstantinos Poulios <logari81@googlemail.com>
parents: 12324
diff changeset
4134 update_axes_layout ();
7446
4bfbec4b0e24 [project @ 2008-02-04 21:17:18 by jwe]
jwe
parents: 7445
diff changeset
4135 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4136
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4137 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
4138
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4139 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4140
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4141 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4142 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4143
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4144 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4145 axes (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4146 : base_graphics_object (), xproperties (mh, p), default_properties ()
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4147 {
19087
3e0720bd6bfc Fix setting axes default x/y/zlabel with string values (bug #34755)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19086
diff changeset
4148 xproperties.update_transform ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4149 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4150
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
4151 ~axes (void) = default;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4152
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4153 void override_defaults (base_graphics_object& obj)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4154 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4155 // Allow parent (figure) to override first (properties knows how
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4156 // to find the parent object).
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4157 xproperties.override_defaults (obj);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4158
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4159 // Now override with our defaults. If the default_properties
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4160 // list includes the properties for all defaults (line,
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4161 // surface, etc.) then we don't have to know the type of OBJ
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4162 // here, we just call its set function and let it decide which
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4163 // properties from the list to use.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4164 obj.set_from_list (default_properties);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4165 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4166
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
4167 void set (const caseless_str& name, const octave_value& value)
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4168 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4169 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4170 // strip "default", pass rest to function that will
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4171 // parse the remainder and add the element to the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4172 // default_properties map.
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4173 default_properties.set (name.substr (7), value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4174 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4175 xproperties.set (name, value);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4176 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4177
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4178 void set_defaults (const std::string& mode)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4179 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4180 xproperties.set_defaults (*this, mode);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4181 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4182
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
4183 octave_value get (const caseless_str& name) const
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4184 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4185 octave_value retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4186
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4187 // FIXME: finish this.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4188 if (name.compare ("default", 7))
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4189 retval = get_default (name.substr (7));
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4190 else
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4191 retval = xproperties.get (name);
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4192
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4193 return retval;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4194 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4195
7189
e8d953d03f6a [project @ 2007-11-26 20:42:09 by dbateman]
dbateman
parents: 7176
diff changeset
4196 octave_value get_default (const caseless_str& name) const;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4197
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4198 octave_value get_defaults (void) const
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4199 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4200 return default_properties.as_struct ("default");
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4201 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4202
19666
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
4203 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
4204 {
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
4205 return default_properties;
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
4206 }
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
4207
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4208 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4209
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4210 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4211
7214
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
4212 void update_axis_limits (const std::string& axis_type);
86d0b16f2bb2 [project @ 2007-11-29 03:40:04 by jwe]
jwe
parents: 7213
diff changeset
4213
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
4214 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
4215 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
4216
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4217 bool valid_object (void) const { return true; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4218
10722
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
4219 void reset_default_properties (void);
755fcb5baad3 Add the reset built function
David Bateman <dbateman@free.fr>
parents: 10717
diff changeset
4220
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
4221 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
4222 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4223 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
4224 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
4225 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
4226 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
4227 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4228
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4229 protected:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
4230 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
4231
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4232 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4233 property_list default_properties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4234 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4235
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4236 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4237
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4238 class OCTINTERP_API line : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4239 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4240 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4241 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4242 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4243 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4244 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4245 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4246 // Programming note: Keep property list sorted if new ones are added.
7366
2a2115742cb5 [project @ 2008-01-13 06:46:39 by jwe]
jwe
parents: 7365
diff changeset
4247
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4248 BEGIN_PROPERTIES (line)
20738
f90295782d60 Accept color value of "none" for line objects (bug #44224).
Rik <rik@octave.org>
parents: 20730
diff changeset
4249 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
4250 string_property displayname , ""
25172
7b1b504c2f12 update future version numbers in doc strings and comments
John W. Eaton <jwe@octave.org>
parents: 25103
diff changeset
4251 // 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
4252 radio_property interpreter hd , "{tex}|none|latex"
22759
39f39eb4e476 Implement "linejoin" property (bug #48387)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22755
diff changeset
4253 radio_property linejoin , "{round}|miter|chamfer"
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4254 radio_property linestyle , "{-}|--|:|-.|none"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4255 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
4256 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
4257 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
4258 color_property markerfacecolor , color_property (radio_values ("auto|{none}"), color_values (0, 0, 0))
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4259 double_property markersize , 6
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4260 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
4261 string_property xdatasource , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4262 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
4263 string_property ydatasource , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4264 row_vector_property zdata u , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4265 string_property zdatasource , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4266
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4267 // hidden properties for limit computation
26715
24e11ee4fe45 Improve calculation of zlim and aspect ratios for 2d objects (bug #55634).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26712
diff changeset
4268 row_vector_property xlim hlr , default_data_lim ()
24e11ee4fe45 Improve calculation of zlim and aspect ratios for 2d objects (bug #55634).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26712
diff changeset
4269 row_vector_property ylim hlr , default_data_lim ()
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4270 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
4271 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
4272 bool_property yliminclude hl , "on"
26715
24e11ee4fe45 Improve calculation of zlim and aspect ratios for 2d objects (bug #55634).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26712
diff changeset
4273 bool_property zliminclude hl , "on"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4274 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
4275
22831
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
4276 protected:
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
4277 void init (void)
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
4278 {
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
4279 linewidth.add_constraint ("min", 0, false);
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
4280 markersize.add_constraint ("min", 0, false);
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
4281 }
22831
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
4282
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4283 private:
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4284 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
4285 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
4286
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4287 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
4288
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4289 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
4290
26715
24e11ee4fe45 Improve calculation of zlim and aspect ratios for 2d objects (bug #55634).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26712
diff changeset
4291 void update_zdata (void) { set_zlim (zdata.get_limits ()); }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4292 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4293
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4294 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4295 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4296
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4297 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4298 line (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4299 : 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
4300 { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4301
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
4302 ~line (void) = default;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4303
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4304 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4305
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4306 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4307
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4308 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
4309
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4310 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
4311 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4312 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
4313 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
4314 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
4315 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
4316 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4317 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4318
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4319 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4320
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4321 class OCTINTERP_API text : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4322 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4323 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4324 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4325 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4326 public:
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
4327 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
4328
25884
4e108574385c Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents: 25867
diff changeset
4329 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
4330
4e108574385c Improve OpenGL rendering on high resolution screens with Qt 5 (bug #49053)
John Swensen <jpswensen@gmail.com>
parents: 25867
diff changeset
4331 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
4332
14448
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4333 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
4334 {
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4335 octave_value new_val (val);
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4336
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4337 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
4338 {
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4339 dim_vector dv (1, 3);
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4340
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4341 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
4342 }
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4343
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4344 if (position.set (new_val, false))
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4345 {
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4346 set_positionmode ("manual");
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4347 update_position ();
27320
1dfd6ae74fbf use GCB_ prefix for global listener_mode enum names
John W. Eaton <jwe@octave.org>
parents: 27099
diff changeset
4348 position.run_listeners (GCB_POSTSET);
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4349 mark_modified ();
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4350 }
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4351 else
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
4352 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
4353 }
7a49519913e3 Add custom inline set_postion method for text objects which accepts
Ben Abbott <bpabbott@mac.com>
parents: 14391
diff changeset
4354
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4355 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4356 // properties declarations.
26122
4d1c6c60f6b3 Clean up implementation of uitable in 36e0e5b428e7.
Rik <rik@octave.org>
parents: 26112
diff changeset
4357 // Programming note: Keep property list sorted if new ones are added.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4358
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4359 BEGIN_PROPERTIES (text)
17646
993ea21b7e03 graphics.in.h: Text "edgecolor" property should default to "none".
Rik <rik@octave.org>
parents: 17645
diff changeset
4360 color_property backgroundcolor , color_property (radio_values ("{none}"), color_values (1, 1, 1))
26682
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
4361 color_property color u , color_property (color_values (0, 0, 0), radio_values ("none"))
17645
85a057ad1ba6 Fix graphic color properties which have a radio value as default.
Rik <rik@octave.org>
parents: 17631
diff changeset
4362 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
4363 bool_property editing , "off"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4364 array_property extent rG , Matrix (1, 4, 0.0)
26125
df1cf0f7883a Deprecate "fontangle" property value "oblique" in version 7.
Rik <rik@octave.org>
parents: 26124
diff changeset
4365 // FIXME: DEPRECATED: Remove "oblique" in version 7.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4366 radio_property fontangle u , "{normal}|italic|oblique"
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4367 string_property fontname u , OCTAVE_DEFAULT_FONTNAME
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4368 double_property fontsize u , 10
26858
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26715
diff changeset
4369 bool_property fontsmoothing u , "on"
19047
1288a2f27769 Handle non "points" fontunits properties (bug # 40158)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19044
diff changeset
4370 radio_property fontunits SU , "inches|centimeters|normalized|{points}|pixels"
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
4371 radio_property fontweight u , "{normal}|bold"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4372 radio_property horizontalalignment mu , "{left}|center|right"
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4373 radio_property interpreter u , "{tex}|none|latex"
7377
46b58515067d [project @ 2008-01-15 06:57:15 by jwe]
jwe
parents: 7370
diff changeset
4374 radio_property linestyle , "{-}|--|:|-.|none"
46b58515067d [project @ 2008-01-15 06:57:15 by jwe]
jwe
parents: 7370
diff changeset
4375 double_property linewidth , 0.5
26185
ef0998af70f9 Change "Margin" default of text object to 3.
Rik <rik@octave.org>
parents: 26129
diff changeset
4376 double_property margin , 3
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4377 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
4378 double_property rotation mu , 0
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4379 text_label_property string u , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4380 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
4381 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
4382
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4383 // 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
4384 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
4385 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
4386 row_vector_property zlim hlr , Matrix ()
11281
3f952c6973f7 graphics.h.in: Change intended for 11272.
Ben Abbott <bpabbott@mac.com>
parents: 11250
diff changeset
4387 bool_property xliminclude hl , "off"
3f952c6973f7 graphics.h.in: Change intended for 11272.
Ben Abbott <bpabbott@mac.com>
parents: 11250
diff changeset
4388 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
4389 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
4390 // hidden properties for auto-positioning
12389
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4391 radio_property positionmode hu , "{auto}|manual"
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4392 radio_property rotationmode hu , "{auto}|manual"
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4393 radio_property horizontalalignmentmode hu , "{auto}|manual"
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4394 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
4395 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
4396 // 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
4397 double_property __fontsize_points__ hgr , 0
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4398 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4399
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4400 Matrix get_data_position (void) const;
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4401 Matrix get_extent_matrix (void) const;
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4402 const uint8NDArray& get_pixels (void) const { return pixels; }
21209
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
4403
67d2965af0b5 revamp text rendering classes
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
4404 // 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
4405 octave::text_renderer txt_renderer;
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4406
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4407 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4408 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4409 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4410 position.add_constraint (dim_vector (1, 3));
22831
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
4411 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
4412 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
4413 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
4414 cached_units = get_units ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4415 update_font ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4416 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4417
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4418 private:
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4419 void update_position (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4420 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4421 Matrix pos = get_data_position ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4422 Matrix lim;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4423
26712
f8e7c1750222 Fix auto axes limits with text on negative logarithmic axes.
Markus Mützel <markus.muetzel@gmx.de>
parents: 26682
diff changeset
4424 lim = Matrix (1, 4, pos(0));
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23449
diff changeset
4425 lim(2) = (lim(2) <= 0 ? octave::numeric_limits<double>::Inf () : lim(2));
26712
f8e7c1750222 Fix auto axes limits with text on negative logarithmic axes.
Markus Mützel <markus.muetzel@gmx.de>
parents: 26682
diff changeset
4426 lim(3) = (lim(3) >= 0 ? -octave::numeric_limits<double>::Inf () : lim(3));
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4427 set_xlim (lim);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4428
26712
f8e7c1750222 Fix auto axes limits with text on negative logarithmic axes.
Markus Mützel <markus.muetzel@gmx.de>
parents: 26682
diff changeset
4429 lim = Matrix (1, 4, pos(1));
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23449
diff changeset
4430 lim(2) = (lim(2) <= 0 ? octave::numeric_limits<double>::Inf () : lim(2));
26712
f8e7c1750222 Fix auto axes limits with text on negative logarithmic axes.
Markus Mützel <markus.muetzel@gmx.de>
parents: 26682
diff changeset
4431 lim(3) = (lim(3) >= 0 ? -octave::numeric_limits<double>::Inf () : lim(3));
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4432 set_ylim (lim);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4433
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4434 if (pos.numel () == 3)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4435 {
26712
f8e7c1750222 Fix auto axes limits with text on negative logarithmic axes.
Markus Mützel <markus.muetzel@gmx.de>
parents: 26682
diff changeset
4436 lim = Matrix (1, 4, pos(2));
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23449
diff changeset
4437 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
4438 : lim(2));
26712
f8e7c1750222 Fix auto axes limits with text on negative logarithmic axes.
Markus Mützel <markus.muetzel@gmx.de>
parents: 26682
diff changeset
4439 lim(3) = (lim(3) >= 0 ? -octave::numeric_limits<double>::Inf ()
f8e7c1750222 Fix auto axes limits with text on negative logarithmic axes.
Markus Mützel <markus.muetzel@gmx.de>
parents: 26682
diff changeset
4440 : lim(3));
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4441 set_zliminclude ("on");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4442 set_zlim (lim);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4443 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4444 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4445 set_zliminclude ("off");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4446 }
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4447
12389
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4448 void request_autopos (void);
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4449 void update_positionmode (void) { request_autopos (); }
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4450 void update_rotationmode (void) { request_autopos (); }
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4451 void update_horizontalalignmentmode (void) { request_autopos (); }
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4452 void update_verticalalignmentmode (void) { request_autopos (); }
5367bd36b9f8 implement autopositioning requests from text objects to axes
Konstantinos Poulios <logari81@googlemail.com>
parents: 12334
diff changeset
4453
12440
2ed62b9f949e synchronization of axes position and outerposition
Konstantinos Poulios <logari81@googlemail.com>
parents: 12433
diff changeset
4454 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
4455 void update_rotation (void) { update_text_extent (); }
12777
6c1d0f03c331 Avoid redundant calls to set_font of text renderers (Bug #31305)
Konstantinos Poulios <logari81@gmail.com>
parents: 12685
diff changeset
4456 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
4457 void update_fontsize (void) { update_font (); update_text_extent (); }
26858
0adb232f93b9 Implement axes and text "fontsmoothing" property (bug #55833).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26715
diff changeset
4458 void update_fontsmoothing (void) { update_font (); update_text_extent (); }
26682
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
4459
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
4460 void update_color (void)
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
4461 {
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
4462 if (! color.is ("none"))
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
4463 {
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
4464 update_font ();
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
4465 update_text_extent ();
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
4466 }
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
4467 }
0780d3f4ecad Implement "none" as a color for axes and text objects (bug #52842).
Rik <rik@octave.org>
parents: 26639
diff changeset
4468
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
4469 void update_fontangle (void)
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23258
diff changeset
4470 {
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23258
diff changeset
4471 update_font ();
23210
3a298e07002c Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23201
diff changeset
4472 update_text_extent ();
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
4473 // FIXME: DEPRECATED: Remove warning for "oblique" in version 7.
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
4474 if (fontangle.is ("oblique"))
23210
3a298e07002c Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23201
diff changeset
4475 warning_with_id ("Octave:deprecated-property",
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
4476 "Setting 'fontangle' to '%s' is deprecated, \
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
4477 use 'italic' or 'normal'.", fontangle.current_value ().c_str ());
23210
3a298e07002c Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23201
diff changeset
4478 }
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
4479 void update_fontweight (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
4480
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4481 void update_interpreter (void) { update_text_extent (); }
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4482 void update_horizontalalignment (void) { update_text_extent (); }
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4483 void update_verticalalignment (void) { update_text_extent (); }
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4484
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4485 void update_units (void);
19047
1288a2f27769 Handle non "points" fontunits properties (bug # 40158)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19044
diff changeset
4486 void update_fontunits (const caseless_str& old_fontunits);
10402
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4487
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4488 private:
9f2bf537a651 Implement text extent property
Michael Goffioul <michael.goffioul@gmail.com>
parents: 10317
diff changeset
4489 std::string cached_units;
11455
2be9e22796d2 improvements in text-extent calculation
Konstantinos Poulios <logari81@googlemail.com>
parents: 11394
diff changeset
4490 uint8NDArray pixels;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4491 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4492
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4493 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4494 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4495
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4496 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4497 text (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4498 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4499 {
12433
02669a1aa070 regexp.cc: avoid deprecated Array<T>:resize function
John W. Eaton <jwe@octave.org>
parents: 12389
diff changeset
4500 xproperties.set_clipping ("off");
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4501 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4502
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
4503 ~text (void) = default;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4504
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4505 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4506
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4507 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4508
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4509 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
4510
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4511 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
4512 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4513 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
4514 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
4515 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
4516 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
4517 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4518 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4519
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4520 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4521
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4522 class OCTINTERP_API image : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4523 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4524 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4525 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4526 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4527 public:
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4528 bool is_aliminclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4529 { 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
4530 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
4531 { return aliminclude.current_value (); }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4532
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4533 bool is_climinclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4534 { 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
4535 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
4536 { 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
4537
9680
73153525df9a initial implementation of OpenGL image rendering
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9620
diff changeset
4538 octave_value get_color_data (void) const;
73153525df9a initial implementation of OpenGL image rendering
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9620
diff changeset
4539
19324
68db8396c378 Make "image ()" use the default image cdata
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19087
diff changeset
4540 void initialize_data (void) { update_cdata (); }
68db8396c378 Make "image ()" use the default image cdata
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19087
diff changeset
4541
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4542 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4543 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4544 // Programming note: Keep property list sorted if new ones are added.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4545
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4546 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
4547 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
4548 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
4549 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
4550 radio_property cdatamapping al , "scaled|{direct}"
18899
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4551 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
4552 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
4553 // hidden properties for limit computation
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4554 row_vector_property alim hlr , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4555 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
4556 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
4557 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
4558 bool_property aliminclude hlg , "on"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4559 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
4560 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
4561 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
4562 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
4563 radio_property ydatamode ha , "{auto}|manual"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4564 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4565
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4566 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4567 void init (void)
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4568 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4569 xdata.add_constraint (2);
20273
b8c1b3e9aa91 Fix segfault when '[]' used for row_vector_property.
Rik <rik@octave.org>
parents: 20181
diff changeset
4570 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
4571 ydata.add_constraint (2);
20273
b8c1b3e9aa91 Fix segfault when '[]' used for row_vector_property.
Rik <rik@octave.org>
parents: 20181
diff changeset
4572 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
4573 cdata.add_constraint ("double");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4574 cdata.add_constraint ("single");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4575 cdata.add_constraint ("logical");
26639
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4576 cdata.add_constraint ("int8");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4577 cdata.add_constraint ("int16");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4578 cdata.add_constraint ("int32");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4579 cdata.add_constraint ("int64");
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4580 cdata.add_constraint ("uint8");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4581 cdata.add_constraint ("uint16");
26639
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4582 cdata.add_constraint ("uint32");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4583 cdata.add_constraint ("uint64");
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4584 cdata.add_constraint ("real");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4585 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
4586 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
4587 alphadata.add_constraint ("double");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4588 alphadata.add_constraint ("uint8");
25982
d7e2fd922288 Overhaul processing of size constraints for graphic properties (bug #54918).
Rik <rik@octave.org>
parents: 25981
diff changeset
4589 alphadata.add_constraint (dim_vector (-1, -1));
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4590 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4591
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4592 private:
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4593 void update_alphadata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4594 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4595 if (alphadatamapping_is ("scaled"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4596 set_alim (alphadata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4597 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4598 alim = alphadata.get_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4599 }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4600
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4601 void update_cdata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4602 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4603 if (cdatamapping_is ("scaled"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4604 set_clim (cdata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4605 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4606 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
4607
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4608 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
4609 update_xdata ();
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4610
18899
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4611 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
4612 update_ydata ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4613 }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4614
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4615 void update_xdata (void)
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4616 {
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
4617 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
4618 set_xdatamode ("auto");
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4619
18899
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4620 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
4621 {
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4622 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
4623 set_xdatamode ("auto");
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4624 }
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4625
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4626 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
4627 float dp = pixel_xsize ();
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4628
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4629 limits(0) = limits(0) - dp;
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4630 limits(1) = limits(1) + dp;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4631 set_xlim (limits);
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4632 }
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4633
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4634 void update_ydata (void)
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4635 {
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
4636 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
4637 set_ydatamode ("auto");
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4638
18899
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4639 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
4640 {
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4641 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
4642 set_ydatamode ("auto");
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4643 }
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4644
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4645 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
4646 float dp = pixel_ysize ();
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4647
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4648 limits(0) = limits(0) - dp;
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4649 limits(1) = limits(1) + dp;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4650 set_ylim (limits);
9687
86aa08bbc887 image clipping and axes fixes
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9680
diff changeset
4651 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4652
18899
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4653 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
4654 {
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4655 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
4656 Matrix data;
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4657 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
4658 {
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4659 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
4660 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
4661 }
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4662 return data;
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4663 }
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4664
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4665 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
4666 {
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4667 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
4668 Matrix data;
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4669 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
4670 {
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4671 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
4672 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
4673 }
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4674 return data;
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4675 }
3d9e503aea2c Update image "x/ydata" when "cdata" is changed (bug #42121)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18850
diff changeset
4676
11076
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4677 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
4678 {
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4679 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
4680 float dp;
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4681
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
4682 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
4683 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
4684 else
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4685 {
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4686 if (limits(1) == limits(2))
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4687 dp = 0.5;
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4688 else
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4689 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
4690 }
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4691 return dp;
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4692 }
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4693
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4694 public:
21562
6c2fd62db1f7 maint: Eliminate accidental double spaces in code.
Rik <rik@octave.org>
parents: 21367
diff changeset
4695 float pixel_xsize (void)
11076
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4696 {
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4697 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
4698 }
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4699
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4700 float pixel_ysize (void)
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4701 {
b748b86cb8c1 fix images with width or height of 1
Shai Ayal <shaiay@users.sourceforge.net>
parents: 11075
diff changeset
4702 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
4703 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4704 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4705
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4706 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4707 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4708
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4709 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4710 image (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4711 : base_graphics_object (), xproperties (mh, p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4712 {
19324
68db8396c378 Make "image ()" use the default image cdata
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19087
diff changeset
4713 xproperties.initialize_data ();
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4714 }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4715
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
4716 ~image (void) = default;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4717
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4718 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4719
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4720 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
4721
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4722 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
4723
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4724 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
4725 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
4726 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
4727 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
4728 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
4729 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
4730 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4731 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4732
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4733 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4734
21789
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4735 class OCTINTERP_API light : public base_graphics_object
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4736 {
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4737 public:
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4738 class OCTINTERP_API properties : public base_properties
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4739 {
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4740 // 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
4741 // properties declarations.
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4742 // 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
4743
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4744 BEGIN_PROPERTIES (light)
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4745 color_property color , color_values (1, 1, 1)
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4746 array_property position , default_light_position ()
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4747 radio_property style , "{infinite}|local"
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4748 END_PROPERTIES
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4749
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4750 protected:
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4751 void init (void)
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4752 {
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4753 position.add_constraint (dim_vector (1, 3));
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4754 }
26045
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
4755
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
4756 private:
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
4757 void update_visible (void);
21789
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4758 };
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4759
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4760 private:
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4761 properties xproperties;
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4762
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4763 public:
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4764 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
4765 : base_graphics_object (), xproperties (mh, p)
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4766 { }
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4767
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
4768 ~light (void) = default;
21789
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4769
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4770 base_properties& get_properties (void) { return xproperties; }
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4771
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4772 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
4773
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4774 bool valid_object (void) const { return true; }
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4775
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4776 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
4777 {
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4778 bool retval = xproperties.has_readonly_property (pname);
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4779 if (! retval)
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4780 retval = base_properties::has_readonly_property (pname);
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4781 return retval;
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4782 }
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4783
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4784 protected:
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4785 void initialize (const graphics_object& go);
21789
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4786 };
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4787
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4788 // ---------------------------------------------------------------------
6afdf40be534 Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents: 21782
diff changeset
4789
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
4790 class OCTINTERP_API patch : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4791 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4792 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
4793 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4794 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4795 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
4796 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
4797
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4798 // 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
4799 // 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
4800 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
4801 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4802 msg = bad_data_msg;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4803 return ! msg.empty ();
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
4804 }
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4805
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4806 bool is_aliminclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4807 { 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
4808 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
4809 { 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
4810
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4811 bool is_climinclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4812 { 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
4813 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
4814 { return climinclude.current_value (); }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4815
25423
13b1b9a0d9c5 Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
4816 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
4817
25418
762eb2e33a7f Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 25273
diff changeset
4818 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
4819
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4820 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4821 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4822 // Programming note: Keep property list sorted if new ones are added.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4823
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
4824 BEGIN_PROPERTIES (patch)
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4825 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
4826 double_property ambientstrength , 0.3
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4827 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
4828 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
4829 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
4830 double_property diffusestrength , 0.6
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4831 string_property displayname , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4832 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
4833 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
4834 radio_property edgelighting u , "{none}|flat|gouraud|phong"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4835 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
4836 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
4837 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
4838 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
4839 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
4840 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
4841 array_property facevertexalphadata , Matrix ()
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4842 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
4843 // 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
4844 radio_property interpreter hd , "{tex}|none|latex"
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4845 radio_property linestyle , "{-}|--|:|-.|none"
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4846 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
4847 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
4848 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
4849 color_property markerfacecolor , color_property (radio_values ("{none}|auto|flat"), color_values (0, 0, 0))
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4850 double_property markersize , 6
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4851 double_property specularcolorreflectance , 1.0
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4852 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
4853 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
4854 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
4855 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
4856 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
4857 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
4858 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
4859 array_property zdata u , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4860
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4861 // hidden properties for limit computation
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4862 row_vector_property alim hlr , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4863 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
4864 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
4865 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
4866 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
4867 bool_property aliminclude hlg , "on"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
4868 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
4869 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
4870 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
4871 bool_property zliminclude hl , "on"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4872 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
4873
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4874 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
4875 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4876 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4877 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
4878 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
4879 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
4880 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
4881 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
4882 vertices.add_constraint (dim_vector (-1, 3));
26639
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4883 cdata.add_constraint ("double");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4884 cdata.add_constraint ("single");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4885 cdata.add_constraint ("logical");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4886 cdata.add_constraint ("int8");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4887 cdata.add_constraint ("int16");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4888 cdata.add_constraint ("int32");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4889 cdata.add_constraint ("int64");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4890 cdata.add_constraint ("uint8");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4891 cdata.add_constraint ("uint16");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4892 cdata.add_constraint ("uint32");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4893 cdata.add_constraint ("uint64");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
4894 cdata.add_constraint ("real");
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4895 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
4896 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
4897 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
4898 facevertexcdata.add_constraint (dim_vector (-1, 3));
25982
d7e2fd922288 Overhaul processing of size constraints for graphic properties (bug #54918).
Rik <rik@octave.org>
parents: 25981
diff changeset
4899 facevertexcdata.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
4900 facevertexalphadata.add_constraint (dim_vector (-1, 1));
25982
d7e2fd922288 Overhaul processing of size constraints for graphic properties (bug #54918).
Rik <rik@octave.org>
parents: 25981
diff changeset
4901 facevertexalphadata.add_constraint (dim_vector (0, 0));
21654
a0ebc922fd52 Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents: 21568
diff changeset
4902 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
4903 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
4904 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
4905 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
4906
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
4907 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
4908 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
4909 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
4910 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
4911 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
4912 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
4913 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
4914 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
4915 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
4916 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
4917 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
4918 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4919
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4920 public:
26018
50583f514ae4 Add function to manually trigger calculation of [Vertex|Face]Normals (bug #54922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25991
diff changeset
4921 void update_normals (bool reset, bool force = false)
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4922 {
26018
50583f514ae4 Add function to manually trigger calculation of [Vertex|Face]Normals (bug #54922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25991
diff changeset
4923 update_face_normals (reset, force);
50583f514ae4 Add function to manually trigger calculation of [Vertex|Face]Normals (bug #54922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25991
diff changeset
4924 update_vertex_normals (reset, force);
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4925 }
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4926
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4927
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4928 private:
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4929 std::string bad_data_msg;
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4930
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4931 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
4932
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4933 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
4934
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4935 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
4936
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4937 void update_fvc (void);
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4938
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4939 void update_xdata (void)
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4940 {
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
4941 if (get_xdata ().isempty ())
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4942 {
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4943 // For compatibility with matlab behavior,
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4944 // 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
4945 // 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
4946 set_ydata (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4947 set_zdata (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4948 set_cdata (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4949 set_faces (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4950 }
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4951 else
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4952 {
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4953 update_fvc ();
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4954 update_normals (true);
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4955 }
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4956
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4957 set_xlim (xdata.get_limits ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4958 }
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4959
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4960 void update_ydata (void)
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4961 {
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
4962 if (get_ydata ().isempty ())
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4963 {
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4964 set_xdata (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4965 set_zdata (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4966 set_cdata (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4967 set_faces (Matrix ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4968 }
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4969 else
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4970 {
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4971 update_fvc ();
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4972 update_normals (true);
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4973 }
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4974
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4975 set_ylim (ydata.get_limits ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4976 }
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4977
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4978 void update_zdata (void)
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
4979 {
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4980 update_fvc ();
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4981 update_normals (true);
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4982 set_zlim (zdata.get_limits ());
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4983 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
4984
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
4985 void update_cdata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4986 {
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4987 update_fvc ();
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4988 update_normals (false);
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4989
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4990 if (cdatamapping_is ("scaled"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4991 set_clim (cdata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4992 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4993 clim = cdata.get_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
4994 }
18901
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4995
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18899
diff changeset
4996 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
4997
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
4998 void calc_face_normals (Matrix& normals);
26018
50583f514ae4 Add function to manually trigger calculation of [Vertex|Face]Normals (bug #54922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25991
diff changeset
4999 void update_face_normals (bool reset, bool force = false);
50583f514ae4 Add function to manually trigger calculation of [Vertex|Face]Normals (bug #54922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25991
diff changeset
5000 void update_vertex_normals (bool reset, bool force = false);
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 void update_edgelighting (void)
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5003 {
26045
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
5004 update_normals (false);
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5005 }
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5006
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5007 void update_facelighting (void)
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5008 {
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5009 update_normals (false);
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5010 }
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5011
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5012 void update_facenormalsmode (void)
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5013 {
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5014 update_face_normals (false);
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5015 }
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5016
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5017 void update_vertexnormalsmode (void)
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5018 {
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5019 update_vertex_normals (false);
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5020 }
26045
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
5021
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
5022 void update_visible (void)
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
5023 {
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
5024 if (is_visible ())
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
5025 update_normals (false);
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
5026 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5027 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5028
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5029 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5030 properties xproperties;
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5031 property_list default_properties;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5032
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5033 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5034 patch (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5035 : 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
5036 { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5037
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
5038 ~patch (void) = default;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5039
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5040 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5041
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
5042 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
5043
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5044 bool valid_object (void) const { return true; }
18567
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5045
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5046 bool has_readonly_property (const caseless_str& pname) const
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5047 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5048 bool retval = xproperties.has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5049 if (! retval)
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5050 retval = base_properties::has_readonly_property (pname);
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5051 return retval;
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5052 }
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5053
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5054 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
5055
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5056 protected:
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25423
diff changeset
5057 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
5058
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5059 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5060
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5061 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5062
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
5063 class OCTINTERP_API surface : public base_graphics_object
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5064 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5065 public:
7821
f79dcba526a8 Export nested properties classes of all graphics object.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7527
diff changeset
5066 class OCTINTERP_API properties : public base_properties
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5067 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5068 public:
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
5069 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
5070
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
5071 bool is_aliminclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5072 { 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
5073 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
5074 { 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
5075
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5076 bool is_climinclude (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5077 { 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
5078 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
5079 { return climinclude.current_value (); }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5080
25423
13b1b9a0d9c5 Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
5081 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
5082
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5083 // See the genprops.awk script for an explanation of the
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5084 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5085 // Programming note: Keep property list sorted if new ones are added.
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5086
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
5087 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
5088 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
5089 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
5090 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
5091 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
5092 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
5093 radio_property cdatamapping al , "{scaled}|direct"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5094 string_property cdatasource , ""
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
5095 double_property diffusestrength , 0.6
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5096 string_property displayname , ""
7846
d7737a4268b7 Fix typos in property names (edgealpha/facealpha).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7844
diff changeset
5097 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
5098 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
5099 radio_property edgelighting u , "{none}|flat|gouraud|phong"
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5100 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
5101 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
5102 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
5103 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
5104 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
5105 // 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
5106 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
5107 radio_property linestyle , "{-}|--|:|-.|none"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5108 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
5109 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
5110 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
5111 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
5112 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
5113 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
5114 double_property specularcolorreflectance , 1
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
5115 double_property specularexponent , 10
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
5116 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
5117 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
5118 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
5119 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
5120 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
5121 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
5122 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
5123 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
5124 string_property zdatasource , ""
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5125
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
5126 // hidden properties for limit computation
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5127 row_vector_property alim hlr , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5128 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
5129 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
5130 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
5131 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
5132 bool_property aliminclude hlg , "on"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5133 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
5134 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
5135 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
5136 bool_property zliminclude hl , "on"
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5137 END_PROPERTIES
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5138
7363
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
5139 protected:
c31e5dab4f85 [project @ 2008-01-12 08:21:57 by jwe]
jwe
parents: 7307
diff changeset
5140 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5141 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5142 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
5143 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
5144 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
5145 cdata.add_constraint ("double");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5146 cdata.add_constraint ("single");
26639
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
5147 cdata.add_constraint ("logical");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
5148 cdata.add_constraint ("int8");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
5149 cdata.add_constraint ("int16");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
5150 cdata.add_constraint ("int32");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
5151 cdata.add_constraint ("int64");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
5152 cdata.add_constraint ("uint8");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
5153 cdata.add_constraint ("uint16");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
5154 cdata.add_constraint ("uint32");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
5155 cdata.add_constraint ("uint64");
edb11e68b571 Add support for more types for graphics property "cdata" (bug #55436).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26521
diff changeset
5156 cdata.add_constraint ("real");
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5157 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
5158 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
5159 alphadata.add_constraint ("double");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5160 alphadata.add_constraint ("uint8");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5161 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
5162 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
5163 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
5164 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
5165 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
5166
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
5167 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
5168 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
5169 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
5170 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
5171 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
5172 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
5173 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
5174 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
5175 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
5176 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
5177 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
5178 }
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
5179
25867
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5180 public:
26018
50583f514ae4 Add function to manually trigger calculation of [Vertex|Face]Normals (bug #54922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25991
diff changeset
5181 void update_normals (bool reset, bool force = false)
25867
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5182 {
26018
50583f514ae4 Add function to manually trigger calculation of [Vertex|Face]Normals (bug #54922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25991
diff changeset
5183 update_face_normals (reset, force);
50583f514ae4 Add function to manually trigger calculation of [Vertex|Face]Normals (bug #54922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25991
diff changeset
5184 update_vertex_normals (reset, force);
25867
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5185 }
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5186
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5187
7829
8ca8e97e8c0a Add rendering interface for surface object (no implementation yet).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7828
diff changeset
5188 private:
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5189 void update_alphadata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5190 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5191 if (alphadatamapping_is ("scaled"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5192 set_alim (alphadata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5193 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5194 alim = alphadata.get_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5195 }
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5196
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5197 void update_cdata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5198 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5199 if (cdatamapping_is ("scaled"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5200 set_clim (cdata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5201 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5202 clim = cdata.get_limits ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
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
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
5205 void update_xdata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5206 {
25867
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5207 update_normals (true);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5208 set_xlim (xdata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5209 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11577
diff changeset
5210
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
5211 void update_ydata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5212 {
25867
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5213 update_normals (true);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5214 set_ylim (ydata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5215 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
5216
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
5217 void update_zdata (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5218 {
25867
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5219 update_normals (true);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5220 set_zlim (zdata.get_limits ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5221 }
7862
8f3459a90bf3 Redesign axis limit computation handling (using hidden limit properties in child objects)
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7860
diff changeset
5222
26018
50583f514ae4 Add function to manually trigger calculation of [Vertex|Face]Normals (bug #54922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25991
diff changeset
5223 void update_face_normals (bool reset, bool force = false);
50583f514ae4 Add function to manually trigger calculation of [Vertex|Face]Normals (bug #54922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25991
diff changeset
5224 void update_vertex_normals (bool reset, bool force = false);
25867
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5225
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5226 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
5227 { 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
5228
a0ebc922fd52 Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791)
mmuetzel <markus.muetzel@gmx.de>
parents: 21568
diff changeset
5229 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
5230 { 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
5231
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5232 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
5233 { update_normals (false); }
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5234
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5235 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
5236 { update_normals (false); }
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5237
26045
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
5238 void update_visible (void)
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
5239 {
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
5240 if (is_visible ())
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
5241 update_normals (false);
10145b9ad883 Update normals when turning visibility of surface and patch on (bug #54970).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26037
diff changeset
5242 }
25867
49ffa78f9243 Use "facenormals" for flat lighting on surfaces (bug #54024).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25449
diff changeset
5243
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5244 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5245
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5246 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5247 properties xproperties;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5248
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5249 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5250 surface (const graphics_handle& mh, const graphics_handle& p)
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5251 : 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
5252 { }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5253
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
5254 ~surface (void) = default;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5255
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5256 base_properties& get_properties (void) { return xproperties; }
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5257
7222
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
5258 const base_properties& get_properties (void) const { return xproperties; }
dd8b3bbeeaf9 [project @ 2007-11-30 06:23:25 by jwe]
jwe
parents: 7214
diff changeset
5259
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5260 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
5261
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5262 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
5263 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5264 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
5265 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
5266 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
5267 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
5268 }
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5269 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
5270
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5271 // ---------------------------------------------------------------------
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5272
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5273 class OCTINTERP_API hggroup : public base_graphics_object
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5274 {
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5275 public:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5276 class OCTINTERP_API properties : public base_properties
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5277 {
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5278 public:
26930
ead8f91c5556 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26918
diff changeset
5279 void remove_child (const graphics_handle& h, bool from_root = false);
26982
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
5280
25423
13b1b9a0d9c5 Move management of lights in axes from GL to graphics backend.
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
5281 void adopt (const graphics_handle& h);
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 // 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
5284 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5285 // 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
5286
8247
e41f420875db set name of root_figure object to root
John W. Eaton <jwe@octave.org>
parents: 8222
diff changeset
5287 BEGIN_PROPERTIES (hggroup)
15519
f915996325b7 Add missing DisplayName and EraseMode properties to hggroups (bug #37442)
Ben Abbott <bpabbott@mac.com>
parents: 15468
diff changeset
5288 string_property displayname , ""
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5289
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5290 // hidden properties for limit computation
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5291 row_vector_property alim hr , Matrix ()
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5292 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
5293 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
5294 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
5295 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
5296 bool_property aliminclude h , "on"
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5297 bool_property climinclude h , "on"
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5298 bool_property xliminclude h , "on"
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5299 bool_property yliminclude h , "on"
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5300 bool_property zliminclude h , "on"
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5301 END_PROPERTIES
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5302
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5303 private:
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5304 void update_limits (void) const;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5305
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5306 void update_limits (const graphics_handle& h) const;
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5307
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5308 protected:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5309 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5310 { }
11175
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
5311
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5312 };
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5313
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5314 private:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5315 properties xproperties;
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5316
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5317 public:
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5318 hggroup (const graphics_handle& mh, const graphics_handle& p)
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5319 : 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
5320 { }
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5321
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
5322 ~hggroup (void) = default;
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5323
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5324 base_properties& get_properties (void) { return xproperties; }
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 const base_properties& get_properties (void) const { return xproperties; }
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5327
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5328 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
5329
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5330 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
5331
c0a95a5c6d25 Address the speed of plotting large hggroup groups and in particular
David Bateman <dbateman@free.fr>
parents: 11167
diff changeset
5332 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
5333 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
5334
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
5335 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
5336 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5337 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
5338 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
5339 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
5340 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
5341 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5342
7865
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5343 };
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5344
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5345 // ---------------------------------------------------------------------
b74039822fd2 Add support for hggroup
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7864
diff changeset
5346
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5347 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
5348 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5349 public:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5350 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
5351 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5352 public:
26930
ead8f91c5556 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26918
diff changeset
5353 void remove_child (const graphics_handle& h, bool from_root = false)
26982
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
5354 {
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
5355 base_properties::remove_child (h, from_root);
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
5356 }
8d7265e353a0 Improve performance when closing figures (bug #55908).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26878
diff changeset
5357
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5358 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
5359 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5360 base_properties::adopt (h);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5361 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5362
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5363 // 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
5364 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5365 // 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
5366
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5367 BEGIN_PROPERTIES (uimenu)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5368 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
5369 callback_property callback , Matrix ()
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5370 bool_property checked , "off"
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5371 bool_property enable , "on"
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5372 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
5373 string_property label , ""
20045
ae12edf69bce Set default uimenu position property to 0 (Bug #44770)
John Donoghue
parents: 19987
diff changeset
5374 double_property position , 0
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5375 bool_property separator , "off"
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
5376
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5377 // 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
5378 string_property __fltk_label__ h , ""
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
5379 any_property __object__ h , Matrix ()
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5380 END_PROPERTIES
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5381
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5382 protected:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5383 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
5384 {
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
5385 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
5386 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5387 };
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5388
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5389 private:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5390 properties xproperties;
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5391
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5392 public:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5393 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
5394 : 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
5395 { }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5396
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
5397 ~uimenu (void) = default;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5398
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5399 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
5400
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5401 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
5402
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5403 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
5404
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
5405 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
5406 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5407 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
5408 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
5409 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
5410 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
5411 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5412
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5413 };
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 // ---------------------------------------------------------------------
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11089
diff changeset
5416
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5417 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
5418 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5419 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5420 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
5421 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5422 public:
20181
aa36fb998a4d maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents: 20171
diff changeset
5423
aa36fb998a4d maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents: 20171
diff changeset
5424 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
5425 { dependent_obj_list.push_back (gh); }
69f92e0affd2 Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20051
diff changeset
5426
20181
aa36fb998a4d maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents: 20171
diff changeset
5427 // FIXME: the list may contain duplicates.
aa36fb998a4d maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents: 20171
diff changeset
5428 // Should we return only unique elements?
aa36fb998a4d maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents: 20171
diff changeset
5429 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
5430 { return dependent_obj_list; }
69f92e0affd2 Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20051
diff changeset
5431
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5432 // 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
5433 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5434 // 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
5435
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5436 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
5437 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
5438 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
5439
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
5440 // Octave-specific properties
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
5441 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
5442 END_PROPERTIES
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5443
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5444 protected:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5445 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5446 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5447 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
5448 position.add_constraint (dim_vector (2, 1));
20171
b70f8da6dcd3 Default uicontextmenu visible to 'off' (Bug #44939)
John Donoghue
parents: 20077
diff changeset
5449 visible.set (octave_value (false));
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5450 }
20077
69f92e0affd2 Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20051
diff changeset
5451
69f92e0affd2 Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20051
diff changeset
5452 private:
69f92e0affd2 Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20051
diff changeset
5453 // 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
5454 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
5455 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5456
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5457 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5458 properties xproperties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5459
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5460 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5461 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
5462 : 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
5463 { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5464
20077
69f92e0affd2 Handle uicontextmenu deletion/reset (bug #44801)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20051
diff changeset
5465 ~uicontextmenu (void);
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5466
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5467 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
5468
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5469 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
5470
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5471 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
5472
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
5473 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
5474 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5475 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
5476 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
5477 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
5478 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
5479 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5480
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5481 };
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 // ---------------------------------------------------------------------
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5484
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5485 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
5486 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5487 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5488 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
5489 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5490 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5491 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
5492 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
5493
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
5494 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
5495
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5496 // 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
5497 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5498 // 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
5499
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5500 BEGIN_PROPERTIES (uicontrol)
25429
ecc488aa56a0 Change default ui* objects color for compatibility (bug #53805)
Guillaume Flandin <guillaume.offline@gmail.com>
parents: 25425
diff changeset
5501 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
5502 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
5503 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
5504 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
5505 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
5506 array_property extent rG , Matrix (1, 4, 0.0)
26125
df1cf0f7883a Deprecate "fontangle" property value "oblique" in version 7.
Rik <rik@octave.org>
parents: 26124
diff changeset
5507 // FIXME: DEPRECATED: Remove "oblique" in version 7.
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5508 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
5509 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
5510 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
5511 radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels"
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5512 radio_property fontweight u , "{normal}|bold"
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5513 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
5514 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
5515 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
5516 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
5517 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
5518 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
5519 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
5520 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
5521 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
5522 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
5523 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
5524 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
5525 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
5526 radio_property verticalalignment , "top|{middle}|bottom"
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
5527
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
5528 // Octave-specific properties
26037
864448a7f347 Don't set keyboard focus on newly created uicontrol objects (bug #54942)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26024
diff changeset
5529 bool_property __focus__ h , "off"
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
5530 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
5531 END_PROPERTIES
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5532
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5533 private:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5534 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
5535
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5536 protected:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5537 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5538 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5539 cdata.add_constraint ("double");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5540 cdata.add_constraint ("single");
25891
54635fcf99b8 uicontrol: Allow uint8 for "cdata" (bug #54697).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25884
diff changeset
5541 cdata.add_constraint ("uint8");
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5542 cdata.add_constraint (dim_vector (-1, -1, 3));
25981
63b3d5e4e5c3 Allow 'cdata' property of uicontrol to be set to '[]' (bug #54918).
Rik <rik@octave.org>
parents: 25966
diff changeset
5543 cdata.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
5544 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
5545 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
5546 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
5547 cached_units = get_units ();
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
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5550 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
5551
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5552 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
5553 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
5554 void update_fontsize (void) { update_text_extent (); }
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5555 void update_fontangle (void)
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23258
diff changeset
5556 {
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23258
diff changeset
5557 update_text_extent ();
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5558 // FIXME: DEPRECATED: Remove warning for "oblique" in version 7.
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5559 if (fontangle.is ("oblique"))
23210
3a298e07002c Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23201
diff changeset
5560 warning_with_id ("Octave:deprecated-property",
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5561 "Setting 'fontangle' to '%s' is deprecated, \
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5562 use 'italic' or 'normal'.", fontangle.current_value ().c_str ());
23210
3a298e07002c Deprecate "light" and "demi" values for "fontweight" property (bug #50353).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23201
diff changeset
5563 }
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5564 void update_fontweight (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
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5566 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
5567
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5568 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
5569
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5570 };
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5571
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5572 private:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5573 properties xproperties;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5574
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5575 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5576 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
5577 : 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
5578 { }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5579
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
5580 ~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
5581
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5582 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
5583
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5584 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
5585
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5586 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
5587
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5588 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
5589 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5590 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
5591 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
5592 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
5593 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
5594 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5595 };
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 // ---------------------------------------------------------------------
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5598
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5599 class OCTINTERP_API uibuttongroup : public base_graphics_object
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5600 {
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5601 public:
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5602 class OCTINTERP_API properties : public base_properties
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5603 {
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5604 public:
27730
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27709
diff changeset
5605 void remove_child (const graphics_handle& h, bool from_root = false);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27709
diff changeset
5606
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27709
diff changeset
5607 void adopt (const graphics_handle& h);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27709
diff changeset
5608
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5609 Matrix get_boundingbox (bool internal = false,
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5610 const Matrix& parent_pix_size = Matrix ()) const;
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5611
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
5612 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
5613
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5614 // See the genprops.awk script for an explanation of the
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5615 // properties declarations.
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5616 // 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
5617
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5618 BEGIN_PROPERTIES (uibuttongroup)
25429
ecc488aa56a0 Change default ui* objects color for compatibility (bug #53805)
Guillaume Flandin <guillaume.offline@gmail.com>
parents: 25425
diff changeset
5619 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
5620 radio_property bordertype , "none|{etchedin}|etchedout|beveledin|beveledout|line"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5621 double_property borderwidth , 1
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5622 bool_property clipping , "on"
26125
df1cf0f7883a Deprecate "fontangle" property value "oblique" in version 7.
Rik <rik@octave.org>
parents: 26124
diff changeset
5623 // FIXME: DEPRECATED: Remove "oblique" in version 7.
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5624 radio_property fontangle , "{normal}|italic|oblique"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5625 string_property fontname , OCTAVE_DEFAULT_FONTNAME
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5626 double_property fontsize , 10
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5627 radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels"
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5628 radio_property fontweight , "{normal}|bold"
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5629 color_property foregroundcolor , color_values (0, 0, 0)
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5630 color_property highlightcolor , color_values (1, 1, 1)
26194
4f1b3651fa5f Implement "SizeChangedFcn" for uipanel and uibuttongroup (bug #55085).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26185
diff changeset
5631 array_property position S , default_panel_position ()
26129
3c61c8137664 Add sizechangedfcn property to uipanel objects.
Rik <rik@octave.org>
parents: 26125
diff changeset
5632 // FIXME: "resizefcn" is no longer recommended by Matlab,
3c61c8137664 Add sizechangedfcn property to uipanel objects.
Rik <rik@octave.org>
parents: 26125
diff changeset
5633 // and has been replaced with "sizechangedfcn"
3c61c8137664 Add sizechangedfcn property to uipanel objects.
Rik <rik@octave.org>
parents: 26125
diff changeset
5634 // Eventually this will need to be hidden, and then removed.
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5635 callback_property resizefcn , Matrix ()
24120
0d446e938f1f maint: clean up code formatting in generated graphics.h
Mike Miller <mtmiller@octave.org>
parents: 24071
diff changeset
5636 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
5637 callback_property selectionchangedfcn , Matrix ()
25449
d2d9701d2dcb Change default ShadowColor property to match Matlab (bug #53805).
Rik <rik@octave.org>
parents: 25436
diff changeset
5638 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
5639 callback_property sizechangedfcn , Matrix ()
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5640 radio_property units S , "{normalized}|inches|centimeters|points|pixels|characters"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5641 string_property title , ""
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5642 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
5643
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
5644 // Octave-specific properties
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
5645 any_property __object__ h , Matrix ()
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5646 END_PROPERTIES
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5647
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5648 protected:
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5649 void init (void)
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 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
5652 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
5653 fontsize.add_constraint ("min", 0.0, false);
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5654 }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5655
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5656 // void update_text_extent (void);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5657 // void update_string (void) { update_text_extent (); }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5658 // void update_fontname (void) { update_text_extent (); }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5659 // void update_fontsize (void) { update_text_extent (); }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5660 // void update_fontangle (void) { update_text_extent (); }
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5661 // void update_fontweight (void) { update_fontweight (); }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5662
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5663 void update_units (const caseless_str& old_units);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5664 void update_fontunits (const caseless_str& old_units);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5665
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5666 };
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5667
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5668 private:
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5669 properties xproperties;
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5670
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5671 public:
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5672 uibuttongroup (const graphics_handle& mh, const graphics_handle& p)
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5673 : base_graphics_object (), xproperties (mh, p)
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5674 { }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5675
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
5676 ~uibuttongroup (void) = default;
21824
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 base_properties& get_properties (void) { return xproperties; }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5679
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5680 const base_properties& get_properties (void) const { return 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 bool valid_object (void) const { return true; }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5683
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5684 bool has_readonly_property (const caseless_str& pname) const
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 bool retval = xproperties.has_readonly_property (pname);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5687 if (! retval)
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5688 retval = base_properties::has_readonly_property (pname);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents: 21789
diff changeset
5689 return retval;
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
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
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
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5696 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
5697 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5698 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5699 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
5700 {
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5701 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5702 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
5703 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
5704
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
5705 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
5706
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5707 // 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
5708 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5709 // 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
5710
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5711 BEGIN_PROPERTIES (uipanel)
25429
ecc488aa56a0 Change default ui* objects color for compatibility (bug #53805)
Guillaume Flandin <guillaume.offline@gmail.com>
parents: 25425
diff changeset
5712 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
5713 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
5714 double_property borderwidth , 1
26125
df1cf0f7883a Deprecate "fontangle" property value "oblique" in version 7.
Rik <rik@octave.org>
parents: 26124
diff changeset
5715 // FIXME: DEPRECATED: Remove "oblique" in version 7.
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5716 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
5717 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
5718 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
5719 radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels"
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5720 radio_property fontweight , "{normal}|bold"
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5721 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
5722 color_property highlightcolor , color_values (1, 1, 1)
26194
4f1b3651fa5f Implement "SizeChangedFcn" for uipanel and uibuttongroup (bug #55085).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26185
diff changeset
5723 array_property position S , default_panel_position ()
26129
3c61c8137664 Add sizechangedfcn property to uipanel objects.
Rik <rik@octave.org>
parents: 26125
diff changeset
5724 // FIXME: "resizefcn" is no longer recommended by Matlab,
3c61c8137664 Add sizechangedfcn property to uipanel objects.
Rik <rik@octave.org>
parents: 26125
diff changeset
5725 // and has been replaced with "sizechangedfcn"
3c61c8137664 Add sizechangedfcn property to uipanel objects.
Rik <rik@octave.org>
parents: 26125
diff changeset
5726 // Eventually this will need to be hidden, and then removed.
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5727 callback_property resizefcn , Matrix ()
25449
d2d9701d2dcb Change default ShadowColor property to match Matlab (bug #53805).
Rik <rik@octave.org>
parents: 25436
diff changeset
5728 color_property shadowcolor , color_values (0.7, 0.7, 0.7)
26129
3c61c8137664 Add sizechangedfcn property to uipanel objects.
Rik <rik@octave.org>
parents: 26125
diff changeset
5729 callback_property sizechangedfcn , Matrix ()
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5730 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
5731 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
5732 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
5733 // Octave-specific properties
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
5734 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
5735 END_PROPERTIES
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5736
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5737 protected:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5738 void init (void)
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19834
diff changeset
5739 {
22831
96228c17a66a Add input checking for double_property and handle_property (task #11311)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22759
diff changeset
5740 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
5741 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
5742 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
5743 }
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 18819
diff changeset
5744
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5745 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
5746 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
5747
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5748 };
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5749
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5750 private:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5751 properties xproperties;
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5752
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5753 public:
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5754 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
5755 : 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
5756 { }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5757
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
5758 ~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
5759
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5760 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
5761
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5762 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
5763
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
5764 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
5765
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5766 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
5767 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5768 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
5769 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
5770 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
5771 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
5772 }
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
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
26112
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5777 class OCTINTERP_API uitable : public base_graphics_object
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5778 {
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5779 public:
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5780 class OCTINTERP_API properties : public base_properties
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5781 {
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5782 public:
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5783 Matrix get_boundingbox (bool internal = false,
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5784 const Matrix& parent_pix_size = Matrix ()) const;
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5785
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5786 double get___fontsize_points__ (double box_pix_height = 0) const;
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5787
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5788 double get_fontsize_pixels (double box_pix_height = 0) const;
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5789
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5790 // See the genprops.awk script for an explanation of the
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5791 // properties declarations.
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5792 // Programming note: Keep property list sorted if new ones are added.
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5793
26122
4d1c6c60f6b3 Clean up implementation of uitable in 36e0e5b428e7.
Rik <rik@octave.org>
parents: 26112
diff changeset
5794 // FIXME: keypressfcn, keyreleasefcn, rearrangeablecolumns properties
4d1c6c60f6b3 Clean up implementation of uitable in 36e0e5b428e7.
Rik <rik@octave.org>
parents: 26112
diff changeset
5795 // seem to have been removed from Matlab.
4d1c6c60f6b3 Clean up implementation of uitable in 36e0e5b428e7.
Rik <rik@octave.org>
parents: 26112
diff changeset
5796
26112
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5797 BEGIN_PROPERTIES (uitable)
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5798 any_property __object__ h , Matrix ()
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5799 array_property backgroundcolor , default_table_backgroundcolor ()
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5800 callback_property celleditcallback , Matrix ()
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5801 callback_property cellselectioncallback , Matrix ()
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5802 row_vector_property columneditable , Matrix ()
26122
4d1c6c60f6b3 Clean up implementation of uitable in 36e0e5b428e7.
Rik <rik@octave.org>
parents: 26112
diff changeset
5803 any_property columnformat S , Cell ()
26112
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5804 any_property columnname , "numbered"
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5805 any_property columnwidth S , "auto"
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5806 any_property data u , Matrix ()
26122
4d1c6c60f6b3 Clean up implementation of uitable in 36e0e5b428e7.
Rik <rik@octave.org>
parents: 26112
diff changeset
5807 bool_property enable , "on"
26112
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5808 array_property extent rG , Matrix (1, 4, 0.0)
26125
df1cf0f7883a Deprecate "fontangle" property value "oblique" in version 7.
Rik <rik@octave.org>
parents: 26124
diff changeset
5809 // FIXME: DEPRECATED: Remove "oblique" in version 7.
26112
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5810 radio_property fontangle u , "{normal}|italic|oblique"
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5811 string_property fontname u , OCTAVE_DEFAULT_FONTNAME
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5812 double_property fontsize u , 10
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5813 radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels"
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5814 radio_property fontweight u , "{normal}|bold"
26112
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5815 color_property foregroundcolor , color_values (0, 0, 0)
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5816 callback_property keypressfcn , Matrix ()
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5817 callback_property keyreleasefcn , Matrix ()
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5818 array_property position , default_table_position ()
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5819 bool_property rearrangeablecolumns , "off"
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5820 any_property rowname , "numbered"
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5821 bool_property rowstriping , "on"
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5822 string_property tooltipstring , ""
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5823 radio_property units S , "normalized|inches|centimeters|points|{pixels}|characters"
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5824 END_PROPERTIES
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5825
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5826 Matrix get_extent_matrix (void) const;
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5827
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5828 Matrix get_backgroundcolor_rgb (void);
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5829
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5830 Matrix get_alternatebackgroundcolor_rgb (void);
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5831
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5832 protected:
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5833 void init (void)
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5834 {
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5835 position.add_constraint (dim_vector (1, 4));
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5836 extent.add_constraint (dim_vector (1, 4));
26122
4d1c6c60f6b3 Clean up implementation of uitable in 36e0e5b428e7.
Rik <rik@octave.org>
parents: 26112
diff changeset
5837 backgroundcolor.add_constraint ("double");
26112
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5838 backgroundcolor.add_constraint (dim_vector (-1, 3));
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5839 columneditable.add_constraint ("logical");
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5840 }
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5841
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5842 void update_units (const caseless_str& old_units);
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5843 void update_fontunits (const caseless_str& old_units);
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5844 void update_table_extent (void) { };
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5845 void update_data (void) { update_table_extent (); }
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5846 void update_fontname (void) { update_table_extent (); }
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5847 void update_fontsize (void) { update_table_extent (); }
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5848 void update_fontangle (void)
26122
4d1c6c60f6b3 Clean up implementation of uitable in 36e0e5b428e7.
Rik <rik@octave.org>
parents: 26112
diff changeset
5849 {
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5850 update_table_extent ();
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5851 // FIXME: DEPRECATED: Remove warning for "oblique" in version 7.
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5852 if (fontangle.is ("oblique"))
26122
4d1c6c60f6b3 Clean up implementation of uitable in 36e0e5b428e7.
Rik <rik@octave.org>
parents: 26112
diff changeset
5853 warning_with_id ("Octave:deprecated-property",
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5854 "Setting 'fontangle' to '%s' is deprecated, \
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5855 use 'italic' or 'normal'.", fontangle.current_value ().c_str ());
26122
4d1c6c60f6b3 Clean up implementation of uitable in 36e0e5b428e7.
Rik <rik@octave.org>
parents: 26112
diff changeset
5856 }
26275
dd97dc559679 maint: Remove deprecated graphics properties.
Rik <rik@octave.org>
parents: 26194
diff changeset
5857 void update_fontweight (void) { update_table_extent (); }
26112
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5858 };
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5859
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5860 private:
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5861 properties xproperties;
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5862
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5863 public:
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5864 uitable (const graphics_handle& mh, const graphics_handle& p)
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5865 : base_graphics_object (), xproperties (mh, p)
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5866 { }
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5867
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5868 ~uitable (void) { }
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5869
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5870 base_properties& get_properties (void) { return xproperties; }
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5871
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5872 const base_properties& get_properties (void) const { return xproperties; }
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5873
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5874 bool valid_object (void) const { return true; }
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5875
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5876 bool has_readonly_property (const caseless_str& pname) const
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5877 {
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5878 bool retval = xproperties.has_readonly_property (pname);
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5879 if (! retval)
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5880 retval = base_properties::has_readonly_property (pname);
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5881 return retval;
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5882 }
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5883 };
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5884
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5885 // ---------------------------------------------------------------------
36e0e5b428e7 Implement uitable (patch #9084)
Andrew Thornton <art27@cantab.net>
parents: 26107
diff changeset
5886
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5887 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
5888 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5889 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5890 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
5891 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5892 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5893 // 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
5894 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5895 // 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
5896
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5897 BEGIN_PROPERTIES (uitoolbar)
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
5898 // 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
5899 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
5900 END_PROPERTIES
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 protected:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5903 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
5904 { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5905 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5906
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5907 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5908 properties xproperties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5909
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5910 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5911 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
5912 : 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
5913 { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5914
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
5915 ~uitoolbar (void) = default;
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5916
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5917 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
5918 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5919 // 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
5920 // 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
5921 xproperties.override_defaults (obj);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5922
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5923 // 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
5924 // 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
5925 // 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
5926 // 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
5927 // 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
5928 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
5929 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5930
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5931 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
5932 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5933 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
5934 // 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
5935 // 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
5936 // default_properties map.
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5937 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
5938 else
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5939 xproperties.set (name, value);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5940 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5941
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5942 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
5943 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5944 octave_value retval;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5945
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5946 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
5947 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
5948 else
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5949 retval = xproperties.get (name);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5950
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5951 return retval;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5952 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5953
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5954 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
5955
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5956 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
5957 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5958 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
5959 }
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5960
19666
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
5961 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
5962 {
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
5963 return default_properties;
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
5964 }
e7df12f37f71 Freset: avoid multiple reseting of properties (bug #43960)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 19663
diff changeset
5965
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5966 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
5967
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5968 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
5969
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5970 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
5971
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5972 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
5973
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
5974 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
5975 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5976 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
5977 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
5978 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
5979 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
5980 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
5981
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5982 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5983 property_list default_properties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5984 };
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 // ---------------------------------------------------------------------
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5987
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5988 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
5989 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5990 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5991 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
5992 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5993 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5994 // 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
5995 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
5996 // 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
5997
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5998 BEGIN_PROPERTIES (uipushtool)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
5999 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
6000 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
6001 bool_property enable , "on"
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6002 bool_property separator , "off"
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6003 string_property tooltipstring , ""
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
6004
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
6005 // Octave-specific properties
26869
992f55ef87f5 Use an uitoolbar and ui*tools to build the default figure toolbar (bug #55795)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26858
diff changeset
6006 string_property __named_icon__ , ""
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
6007 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
6008 END_PROPERTIES
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 protected:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6011 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6012 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6013 cdata.add_constraint ("double");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6014 cdata.add_constraint ("single");
25982
d7e2fd922288 Overhaul processing of size constraints for graphic properties (bug #54918).
Rik <rik@octave.org>
parents: 25981
diff changeset
6015 cdata.add_constraint ("uint8");
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6016 cdata.add_constraint (dim_vector (-1, -1, 3));
25982
d7e2fd922288 Overhaul processing of size constraints for graphic properties (bug #54918).
Rik <rik@octave.org>
parents: 25981
diff changeset
6017 cdata.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
6018 }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6019 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6020
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6021 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6022 properties xproperties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6023
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6024 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6025 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
6026 : 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
6027 { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6028
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
6029 ~uipushtool (void) = default;
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6030
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6031 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
6032
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6033 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
6034
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6035 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
6036
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
6037 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
6038 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
6039 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
6040 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
6041 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
6042 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
6043 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
6044
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6045 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6046
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6047 // ---------------------------------------------------------------------
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6048
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6049 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
6050 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6051 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6052 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
6053 {
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6054 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6055 // 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
6056 // properties declarations.
17099
a033fd3669c0 Alphabetize graphic properties and add properties missing from Matlab.
Rik <rik@octave.org>
parents: 17098
diff changeset
6057 // 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
6058
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6059 BEGIN_PROPERTIES (uitoggletool)
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6060 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
6061 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
6062 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
6063 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
6064 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
6065 bool_property separator , "off"
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6066 bool_property state , "off"
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6067 string_property tooltipstring , ""
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
6068
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
6069 // Octave-specific properties
26869
992f55ef87f5 Use an uitoolbar and ui*tools to build the default figure toolbar (bug #55795)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26858
diff changeset
6070 string_property __named_icon__ , ""
24452
55ddb7a4cca2 Create "pickableparts" as a base graphics property.
Rik <rik@octave.org>
parents: 24451
diff changeset
6071 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
6072 END_PROPERTIES
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6073
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6074 protected:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6075 void init (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6076 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6077 cdata.add_constraint ("double");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6078 cdata.add_constraint ("single");
25982
d7e2fd922288 Overhaul processing of size constraints for graphic properties (bug #54918).
Rik <rik@octave.org>
parents: 25981
diff changeset
6079 cdata.add_constraint ("uint8");
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6080 cdata.add_constraint (dim_vector (-1, -1, 3));
25982
d7e2fd922288 Overhaul processing of size constraints for graphic properties (bug #54918).
Rik <rik@octave.org>
parents: 25981
diff changeset
6081 cdata.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
6082 }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6083 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6084
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6085 private:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6086 properties xproperties;
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6087
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6088 public:
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6089 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
6090 : 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
6091 { }
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6092
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
6093 ~uitoggletool (void) = default;
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6094
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6095 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
6096
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6097 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
6098
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6099 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
6100
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
6101 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
6102 {
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
6103 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
6104 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
6105 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
6106 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
6107 }
8d5cb159fbc7 Add methods to determine if a graphic property is read-only (bug #41629).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18119
diff changeset
6108
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6109 };
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6110
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6111 // ---------------------------------------------------------------------
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13699
diff changeset
6112
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6113 octave_value
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
6114 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
6115 const std::string& func);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6116 bool
18119
ec9b35e60f95 style fixes in graphics.in.h and graphics.cc
John W. Eaton <jwe@octave.org>
parents: 18118
diff changeset
6117 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
6118 const octave_value& arg, const std::string& func);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6119
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6120 // ---------------------------------------------------------------------
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6121
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6122 class graphics_event;
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6123
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6124 class
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6125 base_graphics_event
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6126 {
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6127 public:
25960
ae9d6a491c06 Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25903
diff changeset
6128 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
6129
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6130 friend class graphics_event;
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6131
25960
ae9d6a491c06 Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25903
diff changeset
6132 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
6133 : 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
6134 { };
ae9d6a491c06 Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25903
diff changeset
6135
ae9d6a491c06 Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25903
diff changeset
6136 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
6137 : 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
6138 { };
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6139
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22865
diff changeset
6140 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
6141
25960
ae9d6a491c06 Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25903
diff changeset
6142 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
6143
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6144 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
6145
ae9d6a491c06 Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25903
diff changeset
6146 private:
ae9d6a491c06 Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25903
diff changeset
6147 int m_busyaction;
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6148 };
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6149
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6150 class
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6151 graphics_event
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6152 {
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6153 public:
24252
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
6154
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6155 typedef void (*event_fcn) (void*);
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6156
24252
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
6157 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
6158
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
6159 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
6160
24991
831389905438 omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents: 24795
diff changeset
6161 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
6162
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
6163 ~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
6164
24991
831389905438 omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents: 24795
diff changeset
6165 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
6166
25960
ae9d6a491c06 Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25903
diff changeset
6167 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
6168 {
ae9d6a491c06 Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25903
diff changeset
6169 if (ok ())
ae9d6a491c06 Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25903
diff changeset
6170 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
6171 else
ae9d6a491c06 Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25903
diff changeset
6172 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
6173 }
ae9d6a491c06 Refactor graphics event handling and fix interruption of callbacks (bug #54340)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25903
diff changeset
6174
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6175 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
6176 {
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
6177 if (ok ())
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
6178 rep->execute ();
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
6179 }
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
6180
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
6181 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
6182
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6183 static graphics_event
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6184 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
6185 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
6186 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
6187 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
6188
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6189 static graphics_event
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6190 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
6191 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
6192 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
6193 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
6194
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6195 static graphics_event
26520
278ae90567a7 Don't use C++ callback to notify close request from Qt Figures (bug #54187)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26469
diff changeset
6196 create_mcode_event (const graphics_handle& h, const std::string& cmd,
278ae90567a7 Don't use C++ callback to notify close request from Qt Figures (bug #54187)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26469
diff changeset
6197 int busyaction);
278ae90567a7 Don't use C++ callback to notify close request from Qt Figures (bug #54187)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26469
diff changeset
6198
278ae90567a7 Don't use C++ callback to notify close request from Qt Figures (bug #54187)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26469
diff changeset
6199 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
6200 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
6201
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6202 static graphics_event
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
6203 create_set_event (const graphics_handle& h, const std::string& name,
26469
bf835b1d04b1 Don't use C++ callbacks to notify position changes from Qt figures (bug #48519)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26383
diff changeset
6204 const octave_value& value, bool notify_toolkit = true,
bf835b1d04b1 Don't use C++ callbacks to notify position changes from Qt figures (bug #48519)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26383
diff changeset
6205 bool redraw_figure = false);
7964
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6206 private:
24252
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
6207
f8c263f961c1 use shared_ptr to manage graphics_object and graphics_event objects
John W. Eaton <jwe@octave.org>
parents: 24191
diff changeset
6208 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
6209 };
9cd3ee5298a0 Use common rep/class pattern for graphics events
John W. Eaton <jwe@octave.org>
parents: 7936
diff changeset
6210
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
6211 class OCTINTERP_API gh_manager
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6212 {
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6213 public:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6214
27321
eddce82a57cc don't use singleton pattern for gh_manager object
John W. Eaton <jwe@octave.org>
parents: 27320
diff changeset
6215 gh_manager (octave::interpreter& interp);
eddce82a57cc don't use singleton pattern for gh_manager object
John W. Eaton <jwe@octave.org>
parents: 27320
diff changeset
6216
eddce82a57cc don't use singleton pattern for gh_manager object
John W. Eaton <jwe@octave.org>
parents: 27320
diff changeset
6217 // FIXME: eventually eliminate these static functions and access
eddce82a57cc don't use singleton pattern for gh_manager object
John W. Eaton <jwe@octave.org>
parents: 27320
diff changeset
6218 // gh_manager object through the interpreter.
eddce82a57cc don't use singleton pattern for gh_manager object
John W. Eaton <jwe@octave.org>
parents: 27320
diff changeset
6219
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6220 graphics_handle get_handle (bool integer_figure_handle);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6221
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6222 void free (const graphics_handle& h, bool from_root = false);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6223
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6224 void renumber_figure (const graphics_handle& old_gh,
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6225 const graphics_handle& new_gh);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6226
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6227 graphics_handle lookup (double val) const
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6228 {
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6229 const_iterator p = (octave::math::isnan (val)
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6230 ? m_handle_map.end () : m_handle_map.find (val));
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6231
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6232 return (p != m_handle_map.end ()) ? p->first : graphics_handle ();
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6233 }
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6234
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6235 graphics_handle lookup (const octave_value& val) const
10265
8c583af2cf64 validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents: 10161
diff changeset
6236 {
27321
eddce82a57cc don't use singleton pattern for gh_manager object
John W. Eaton <jwe@octave.org>
parents: 27320
diff changeset
6237 return (val.is_real_scalar ()
eddce82a57cc don't use singleton pattern for gh_manager object
John W. Eaton <jwe@octave.org>
parents: 27320
diff changeset
6238 ? 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
6239 }
8c583af2cf64 validate text object children of axes objects
John W. Eaton <jwe@octave.org>
parents: 10161
diff changeset
6240
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6241 graphics_object get_object (double val) const
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
6242 {
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
6243 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
6244 }
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
6245
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6246 graphics_object get_object (const graphics_handle& h) const
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6247 {
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6248 const_iterator p = (h.ok () ? m_handle_map.find (h) : m_handle_map.end ());
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6249
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6250 return (p != m_handle_map.end ()) ? p->second : graphics_object ();
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6251 }
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6252
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6253 graphics_handle make_graphics_handle (const std::string& go_name,
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6254 const graphics_handle& p,
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6255 bool integer_figure_handle = false,
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6256 bool call_createfcn = true,
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6257 bool notify_toolkit = true);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6258
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6259 graphics_handle make_figure_handle (double val,
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6260 bool notify_toolkit = true);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6261
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6262 void push_figure (const graphics_handle& h);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6263
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6264 void pop_figure (const graphics_handle& h);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6265
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6266 graphics_handle current_figure (void) const
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6267 {
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6268 graphics_handle retval;
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6269
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6270 for (const auto& hfig : m_figure_list)
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6271 {
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6272 if (is_handle_visible (hfig))
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6273 retval = hfig;
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6274 }
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6275
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6276 return retval;
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6277 }
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6278
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6279 Matrix handle_list (bool show_hidden = false)
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6280 {
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6281 Matrix retval (1, m_handle_map.size ());
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6282
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6283 octave_idx_type i = 0;
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6284 for (const auto& h_iter : m_handle_map)
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6285 {
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6286 graphics_handle h = h_iter.first;
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6287
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6288 if (show_hidden || is_handle_visible (h))
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6289 retval(i++) = h.value ();
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6290 }
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6291
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6292 retval.resize (1, i);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6293
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6294 return retval;
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6295 }
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6296
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6297 void lock (void) { m_graphics_lock.lock (); }
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6298
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6299 bool try_lock (void) { return m_graphics_lock.try_lock (); }
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6300
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6301 void unlock (void) { m_graphics_lock.unlock (); }
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6302
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6303 Matrix figure_handle_list (bool show_hidden = false)
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6304 {
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6305 Matrix retval (1, m_figure_list.size ());
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6306
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6307 octave_idx_type i = 0;
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6308 for (const auto& hfig : m_figure_list)
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6309 {
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6310 if (show_hidden || is_handle_visible (hfig))
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6311 retval(i++) = hfig.value ();
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6312 }
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6313
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6314 retval.resize (1, i);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6315
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6316 return retval;
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6317 }
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6318
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6319 void execute_listener (const graphics_handle& h, const octave_value& l);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6320
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6321 void execute_callback (const graphics_handle& h,
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6322 const std::string& name,
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6323 const octave_value& data = Matrix ())
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6324 {
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
6325 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
6326
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
6327 if (true)
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6328 {
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6329 octave::autolock guard (graphics_lock ());
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
6330
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
6331 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
6332
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
6333 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
6334 cb = go.get (name);
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6335 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
6336
20545
c547458dc10e eliminate error_state from most header files
John W. Eaton <jwe@octave.org>
parents: 20459
diff changeset
6337 execute_callback (h, cb, data);
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6338 }
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6339
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6340 void execute_callback (const graphics_handle& h, const octave_value& cb,
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6341 const octave_value& data = Matrix ());
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6342
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6343 void post_callback (const graphics_handle& h, const std::string& name,
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6344 const octave_value& data = Matrix ());
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6345
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6346 void post_function (graphics_event::event_fcn fcn, void *fcn_data = nullptr);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6347
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6348 void post_set (const graphics_handle& h, const std::string& name,
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6349 const octave_value& value, bool notify_toolkit = true,
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6350 bool redraw_figure = false);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6351
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6352 int process_events (bool force = false);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6353
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6354 void enable_event_processing (bool enable = true);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6355
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6356 bool is_handle_visible (const graphics_handle& h) const
8249
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
6357 {
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
6358 bool retval = false;
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
6359
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
6360 graphics_object go = get_object (h);
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
6361
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
6362 if (go.valid_object ())
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
6363 retval = go.is_handle_visible ();
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
6364
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
6365 return retval;
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
6366 }
1f429086565c [mq]: hidden-children
John W. Eaton <jwe@octave.org>
parents: 8247
diff changeset
6367
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6368 void close_all_figures (void);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6369
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6370 void restore_gcbo (void);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6371
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6372 void post_event (const graphics_event& e);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6373
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6374 octave::mutex graphics_lock (void)
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6375 {
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6376 return m_graphics_lock;
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27327
diff changeset
6377 }
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6378
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6379 private:
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6380
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6381 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
6382 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
6383 const_iterator;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6384
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6385 typedef std::set<graphics_handle>::iterator free_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6386 typedef std::set<graphics_handle>::const_iterator const_free_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6387
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6388 typedef std::list<graphics_handle>::iterator figure_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6389 typedef std::list<graphics_handle>::const_iterator const_figure_list_iterator;
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6390
27321
eddce82a57cc don't use singleton pattern for gh_manager object
John W. Eaton <jwe@octave.org>
parents: 27320
diff changeset
6391 octave::interpreter& m_interpreter;
eddce82a57cc don't use singleton pattern for gh_manager object
John W. Eaton <jwe@octave.org>
parents: 27320
diff changeset
6392
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6393 // A map of handles to graphics objects.
27327
728e4d99febb use m_ prefix for gh_manager data members
John W. Eaton <jwe@octave.org>
parents: 27321
diff changeset
6394 std::map<graphics_handle, graphics_object> m_handle_map;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6395
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6396 // The available graphics handles.
27327
728e4d99febb use m_ prefix for gh_manager data members
John W. Eaton <jwe@octave.org>
parents: 27321
diff changeset
6397 std::set<graphics_handle> m_handle_free_list;
728e4d99febb use m_ prefix for gh_manager data members
John W. Eaton <jwe@octave.org>
parents: 27321
diff changeset
6398
728e4d99febb use m_ prefix for gh_manager data members
John W. Eaton <jwe@octave.org>
parents: 27321
diff changeset
6399 // The next handle available if m_handle_free_list is empty.
728e4d99febb use m_ prefix for gh_manager data members
John W. Eaton <jwe@octave.org>
parents: 27321
diff changeset
6400 double m_next_handle;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6401
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6402 // The allocated figure handles. Top of the stack is most recently
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6403 // created.
27327
728e4d99febb use m_ prefix for gh_manager data members
John W. Eaton <jwe@octave.org>
parents: 27321
diff changeset
6404 std::list<graphics_handle> m_figure_list;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6405
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
6406 // The lock for accessing the graphics sytsem.
27327
728e4d99febb use m_ prefix for gh_manager data members
John W. Eaton <jwe@octave.org>
parents: 27321
diff changeset
6407 octave::mutex m_graphics_lock;
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6408
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
6409 // The list of events queued by graphics toolkits.
27327
728e4d99febb use m_ prefix for gh_manager data members
John W. Eaton <jwe@octave.org>
parents: 27321
diff changeset
6410 std::list<graphics_event> m_event_queue;
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6411
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
6412 // The stack of callback objects.
27327
728e4d99febb use m_ prefix for gh_manager data members
John W. Eaton <jwe@octave.org>
parents: 27321
diff changeset
6413 std::list<graphics_object> m_callback_objects;
7936
78400fde223e Support for backend-to-octave event management
John W. Eaton <jwe@octave.org>
parents: 7902
diff changeset
6414
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13236
diff changeset
6415 // A flag telling whether event processing must be constantly on.
27327
728e4d99febb use m_ prefix for gh_manager data members
John W. Eaton <jwe@octave.org>
parents: 27321
diff changeset
6416 int m_event_processing;
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6417 };
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6418
13132
e3e8ca96f923 Support log scale plots with all negative data.
Ben Abbott <bpabbott@mac.com>
parents: 12965
diff changeset
6419 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
6420 double& min_pos, double& max_neg,
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
6421 const Matrix& kids, char limit_type);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6422
10917
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10792
diff changeset
6423 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
6424
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6425 // This function is NOT equivalent to the scripting language function gcf.
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
6426 OCTINTERP_API graphics_handle gcf (void);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6427
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6428 // This function is NOT equivalent to the scripting language function gca.
7365
f5e801eee0d1 [project @ 2008-01-13 06:33:32 by jwe]
jwe
parents: 7364
diff changeset
6429 OCTINTERP_API graphics_handle gca (void);
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6430
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
6431 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
6432
6874
94bda6abc224 [project @ 2007-09-06 21:34:24 by jwe]
jwe
parents:
diff changeset
6433 #endif