Mercurial > octave
annotate scripts/plot/util/struct2hdl.m @ 31706:597f3ee61a48 stable
update Octave Project Developers copyright for the new year
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 06 Jan 2023 13:11:27 -0500 |
parents | a40c0b7aa376 |
children | 939e5d952675 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
31706
597f3ee61a48
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31253
diff
changeset
|
3 ## Copyright (C) 2012-2023 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27743
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
7 ## |
17795
0a8c35ae5ce1
maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
8 ## This file is part of Octave. |
0a8c35ae5ce1
maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24472
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
11 ## 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:
24472
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
13 ## (at your option) any later version. |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
14 ## |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22622
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
18 ## GNU General Public License for more details. |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
19 ## |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
21 ## 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:
24472
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
25 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20735
diff
changeset
|
27 ## @deftypefn {} {@var{h} =} struct2hdl (@var{s}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20735
diff
changeset
|
28 ## @deftypefnx {} {@var{h} =} struct2hdl (@var{s}, @var{p}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20735
diff
changeset
|
29 ## @deftypefnx {} {@var{h} =} struct2hdl (@var{s}, @var{p}, @var{hilev}) |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
30 ## Construct a graphics handle object @var{h} from the structure @var{s}. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
31 ## |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
17189
diff
changeset
|
32 ## The structure must contain the fields @qcode{"handle"}, @qcode{"type"}, |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
33 ## @qcode{"children"}, @qcode{"properties"}, and @qcode{"special"}. |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
34 ## |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
35 ## If the handle of an existing figure or axes is specified, @var{p}, the new |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
36 ## object will be created as a child of that object. If no parent handle is |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
37 ## provided then a new figure and the necessary children will be constructed |
26878
3c7c5b7c3044
doc: Refer to "root object" rather than "root figure object".
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
38 ## using the default values from the root object. |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
39 ## |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
40 ## A third boolean argument @var{hilev} can be passed to specify whether the |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
41 ## function should preserve listeners/callbacks, e.g., for legends or |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
16933
diff
changeset
|
42 ## hggroups. The default is false. |
18580
13c80c3e9660
Add new functions hgsave and hgload (bug #39532).
Massimiliano Fasi <mogrob.sanit@gmail.com> and Rik <rik@octave.org>
parents:
18317
diff
changeset
|
43 ## @seealso{hdl2struct, hgload, findobj} |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
44 ## @end deftypefn |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
45 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
46 function [h, pout] = struct2hdl (s, p=[], hilev = false) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
47 |
28789
28de41192f3c
Eliminate unneeded verification of nargin, nargout in m-files.
Rik <rik@octave.org>
parents:
28311
diff
changeset
|
48 if (nargin < 1) |
28de41192f3c
Eliminate unneeded verification of nargin, nargout in m-files.
Rik <rik@octave.org>
parents:
28311
diff
changeset
|
49 print_usage (); |
28de41192f3c
Eliminate unneeded verification of nargin, nargout in m-files.
Rik <rik@octave.org>
parents:
28311
diff
changeset
|
50 endif |
28de41192f3c
Eliminate unneeded verification of nargin, nargout in m-files.
Rik <rik@octave.org>
parents:
28311
diff
changeset
|
51 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
52 fields = {"handle", "type", "children", "properties", "special"}; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
53 partypes = {"root", "figure", "axes", "hggroup"}; |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
54 othertypes = {"line", "patch", "scatter", "surface", "image", "text"}; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
55 alltypes = [partypes othertypes]; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
56 |
28789
28de41192f3c
Eliminate unneeded verification of nargin, nargout in m-files.
Rik <rik@octave.org>
parents:
28311
diff
changeset
|
57 if (! isstruct (s)) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
58 print_usage (); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
59 elseif (! all (isfield (s, fields))) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
60 print_usage (); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
61 elseif (isscalar (p)) |
24423
1d52db450db4
Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents:
24370
diff
changeset
|
62 if (! ishghandle (p)) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
63 error ("struct2hdl: P is not a handle to a graphic object"); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
64 endif |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
65 if (any (strcmp (get (p).type, partypes))) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
66 paridx = find (strcmp (get (p).type, alltypes)); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
67 kididx = find (strcmp (s.type, alltypes)); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
68 if (kididx <= paridx) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
69 error ("struct2hdl: incompatible input handles"); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
70 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
71 else |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
72 error ("struct2hdl: %s object can't be parent object", get (p).type); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
73 endif |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
74 hpar = p; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
75 p = [NaN; hpar]; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
76 ## create appropriate parent if needed |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
77 if (any (strcmp (s.type, othertypes))) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
78 for ii = (paridx+1) : (numel (partypes)-1) |
24370
b1d1229d9e83
maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
79 eval (["hpar = " partypes{ii} '("parent", hpar);']); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
80 p = [p [NaN; hpar]]; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
81 endfor |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
82 elseif (any (strcmp (s.type, {"hggroup", "axes"}))) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
83 for ii = (paridx+1) : (kididx-1) |
24370
b1d1229d9e83
maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
84 eval (["hpar = " partypes{ii} '("parent", hpar);']); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
85 p = [p [NaN; hpar]]; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
86 endfor |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
87 else |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
88 par = NaN; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
89 endif |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
90 elseif (isempty (p)) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
91 if (any (strcmp (s.type, othertypes))) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
92 par = axes (); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
93 elseif (any (strcmp (s.type, {"hggroup", "axes"}))) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
94 par = figure (); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
95 else |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
96 par = NaN; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
97 endif |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
98 p = [NaN; par]; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
99 endif |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
100 ## read parent (last column) in p and remove it if duplicate |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
101 par = p(2,end); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
102 tst = find (p(2,:) == par); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
103 if (numel (tst) > 1) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
104 p = p(1:2, 1:(tst(end)-1)); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
105 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
106 |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
107 ## Use lowercase for all properties |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
108 s.properties = cell2struct (struct2cell (s.properties), ... |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
109 tolower (fieldnames (s.properties))); |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
110 |
17386
6dbc866379e2
Replace cellfun() occurrences with faster code where possible.
Rik <rik@octave.org>
parents:
17383
diff
changeset
|
111 ## Place the "*mode" properties at the end to avoid having the updaters |
15799
d0579fed7e22
struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents:
15775
diff
changeset
|
112 ## change the mode to "manual" when the value is "auto". |
15775
a1d1386daeed
struct2hdl.m: Set the "*.mode" properties last. (Bug # 37645)
Ben Abbott <bpabbott@mac.com>
parents:
15011
diff
changeset
|
113 names = fieldnames (s.properties); |
a1d1386daeed
struct2hdl.m: Set the "*.mode" properties last. (Bug # 37645)
Ben Abbott <bpabbott@mac.com>
parents:
15011
diff
changeset
|
114 n = strncmp (cellfun (@fliplr, names, "uniformoutput", false), "edom", 4); |
28310
1379ebcb00c3
Replace uses of axes property "activepositionproperty" by "positionconstraint" (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28298
diff
changeset
|
115 n = (n | strcmp (names, "positionconstraint")); |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
116 names = [names(! n); names(n)]; |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
117 n_pos = find (strcmp (names, "position") | strcmp (names, "outerposition")); |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
118 if (strcmp (s.type, "axes") && numel (n_pos) == 2) |
28311
f9b5357f4a7e
struct2hdl.m: Allowing loading old figure files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28310
diff
changeset
|
119 if (isfield (s.properties, "positionconstraint")) |
f9b5357f4a7e
struct2hdl.m: Allowing loading old figure files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28310
diff
changeset
|
120 positionconstraint = s.properties.positionconstraint; |
f9b5357f4a7e
struct2hdl.m: Allowing loading old figure files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28310
diff
changeset
|
121 else |
f9b5357f4a7e
struct2hdl.m: Allowing loading old figure files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28310
diff
changeset
|
122 ## loading old figure file before "positionconstraint" property was added |
f9b5357f4a7e
struct2hdl.m: Allowing loading old figure files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28310
diff
changeset
|
123 positionconstraint = s.properties.activepositionproperty; |
f9b5357f4a7e
struct2hdl.m: Allowing loading old figure files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28310
diff
changeset
|
124 endif |
f9b5357f4a7e
struct2hdl.m: Allowing loading old figure files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28310
diff
changeset
|
125 if (strcmp (positionconstraint, "outerposition")) |
f9b5357f4a7e
struct2hdl.m: Allowing loading old figure files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28310
diff
changeset
|
126 names{n_pos(1)} = "position"; |
f9b5357f4a7e
struct2hdl.m: Allowing loading old figure files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28310
diff
changeset
|
127 names{n_pos(2)} = "outerposition"; |
f9b5357f4a7e
struct2hdl.m: Allowing loading old figure files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28310
diff
changeset
|
128 else |
15799
d0579fed7e22
struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents:
15775
diff
changeset
|
129 names{n_pos(1)} = "outerposition"; |
d0579fed7e22
struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents:
15775
diff
changeset
|
130 names{n_pos(2)} = "position"; |
d0579fed7e22
struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents:
15775
diff
changeset
|
131 endif |
d0579fed7e22
struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents:
15775
diff
changeset
|
132 endif |
29255
216ef81dafb6
struct2hdl.m: Set "units" property early.
Markus Mützel <markus.muetzel@gmx.de>
parents:
27985
diff
changeset
|
133 ## Set "units" property early |
216ef81dafb6
struct2hdl.m: Set "units" property early.
Markus Mützel <markus.muetzel@gmx.de>
parents:
27985
diff
changeset
|
134 n = strcmp (names, "units"); |
216ef81dafb6
struct2hdl.m: Set "units" property early.
Markus Mützel <markus.muetzel@gmx.de>
parents:
27985
diff
changeset
|
135 names = [names(n); names(! n)]; |
216ef81dafb6
struct2hdl.m: Set "units" property early.
Markus Mützel <markus.muetzel@gmx.de>
parents:
27985
diff
changeset
|
136 ## Reorder the properties |
15775
a1d1386daeed
struct2hdl.m: Set the "*.mode" properties last. (Bug # 37645)
Ben Abbott <bpabbott@mac.com>
parents:
15011
diff
changeset
|
137 s.properties = orderfields (s.properties, names); |
a1d1386daeed
struct2hdl.m: Set the "*.mode" properties last. (Bug # 37645)
Ben Abbott <bpabbott@mac.com>
parents:
15011
diff
changeset
|
138 |
25002
64c6e8bfc9e5
Fix Octave not loading figures saved in older versions (bug #53468)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24534
diff
changeset
|
139 ## Silence deprecation warnings |
64c6e8bfc9e5
Fix Octave not loading figures saved in older versions (bug #53468)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24534
diff
changeset
|
140 warning ("off", "Octave:deprecated-property", "local"); |
25115
e512eaba5206
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
141 |
27743
d51b3c6f3892
Map "applicationdata" to "__appdata__" recursively (bug #57212).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27535
diff
changeset
|
142 ## Translate field names for Matlab .fig files |
d51b3c6f3892
Map "applicationdata" to "__appdata__" recursively (bug #57212).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27535
diff
changeset
|
143 ## FIXME: Is it ok to do this unconditionally? |
28921
967cfcde2e35
maint: Use parentheses around conditional expressions.
Rik <rik@octave.org>
parents:
28892
diff
changeset
|
144 if (isfield (s.properties, "applicationdata")) |
27743
d51b3c6f3892
Map "applicationdata" to "__appdata__" recursively (bug #57212).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27535
diff
changeset
|
145 s.properties.__appdata__ = s.properties.applicationdata; |
d51b3c6f3892
Map "applicationdata" to "__appdata__" recursively (bug #57212).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27535
diff
changeset
|
146 s.properties = rmfield (s.properties, "applicationdata"); |
d51b3c6f3892
Map "applicationdata" to "__appdata__" recursively (bug #57212).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27535
diff
changeset
|
147 endif |
d51b3c6f3892
Map "applicationdata" to "__appdata__" recursively (bug #57212).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27535
diff
changeset
|
148 |
d51b3c6f3892
Map "applicationdata" to "__appdata__" recursively (bug #57212).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27535
diff
changeset
|
149 ## Create object |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
150 if (strcmp (s.type, "root")) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
151 h = 0; |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
152 s.properties = rmfield (s.properties, ... |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
153 {"callbackobject", "commandwindowsize", ... |
25272
49a8d0a2d7ae
Move exclusion of saved graphics properties from hdl2struct to struct2hdl.
Rik <rik@octave.org>
parents:
25115
diff
changeset
|
154 "monitorpositions", "pointerwindow", ... |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
155 "screendepth", "screenpixelsperinch", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
156 "screensize"}); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
157 elseif (strcmp (s.type, "figure")) |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
158 [h, s] = createfigure (s); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
159 elseif (strcmp (s.type, "axes")) |
25272
49a8d0a2d7ae
Move exclusion of saved graphics properties from hdl2struct to struct2hdl.
Rik <rik@octave.org>
parents:
25115
diff
changeset
|
160 ## legends and colorbars are "transformed" in to normal axes |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
161 ## if hilev is not requested. |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
162 if (! hilev && isfield (s.properties, "tag")) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
163 if (strcmp (s.properties.tag, "legend")) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
164 s.properties.tag = ""; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
165 s.properties.userdata = []; |
28892
3cac3ceb9629
maint: Use coding style with parentheses after function name to distinguish from a variable.
Rik <rik@octave.org>
parents:
28789
diff
changeset
|
166 par = gcf (); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
167 elseif (strcmp (s.properties.tag, "colorbar")) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
168 s.properties.tag = ""; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
169 s.properties.userdata = []; |
28892
3cac3ceb9629
maint: Use coding style with parentheses after function name to distinguish from a variable.
Rik <rik@octave.org>
parents:
28789
diff
changeset
|
170 par = gcf (); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
171 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
172 endif |
28284
a41095478d9b
struct2hdl.m: Restore loading axes objects from .fig files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28230
diff
changeset
|
173 ## remove read only properties |
28298
e55ff14249c3
Mirror new base property "contextmenu" in "uicontextmenu" (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28286
diff
changeset
|
174 ## FIXME: Remove "interactions", "layout", "legend", "toolbar", "xaxis", |
e55ff14249c3
Mirror new base property "contextmenu" in "uicontextmenu" (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28286
diff
changeset
|
175 ## "yaxis", and "zaxis" from this list once they are implemented. |
e55ff14249c3
Mirror new base property "contextmenu" in "uicontextmenu" (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28286
diff
changeset
|
176 ro_props = {"interactions", "layout", "legend", "nextseriesindex", ... |
e55ff14249c3
Mirror new base property "contextmenu" in "uicontextmenu" (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28286
diff
changeset
|
177 "tightinset", "toolbar", "xaxis", "yaxis", "zaxis"}; |
28284
a41095478d9b
struct2hdl.m: Restore loading axes objects from .fig files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28230
diff
changeset
|
178 has_ro_props = cellfun (@(x) isfield (s.properties, x), ro_props); |
a41095478d9b
struct2hdl.m: Restore loading axes objects from .fig files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28230
diff
changeset
|
179 if (any (has_ro_props)) |
a41095478d9b
struct2hdl.m: Restore loading axes objects from .fig files (bug #58336).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28230
diff
changeset
|
180 s.properties = rmfield (s.properties, ro_props(has_ro_props)); |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
181 endif |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
182 [h, s] = createaxes (s, p, par); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
183 elseif (strcmp (s.type, "line")) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
184 h = createline (s, par); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
185 elseif (strcmp (s.type, "patch")) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
186 [h, s] = createpatch (s, par); |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
187 elseif (strcmp (s.type, "scatter")) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
188 [h, s] = createscatter (s, par); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
189 elseif (strcmp (s.type, "text")) |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
190 if (isfield (s.properties, "extent")) |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
191 s.properties = rmfield (s.properties, "extent"); |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
192 endif |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
193 h = createtext (s, par); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
194 elseif (strcmp (s.type, "image")) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
195 h = createimage (s, par); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
196 elseif (strcmp (s.type, "surface")) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
197 h = createsurface (s, par); |
27535
303df1e804d4
struct2hdl.m: Allow light objects to be constructed (bug #57093)
Guillaume Flandin
parents:
27300
diff
changeset
|
198 elseif (strcmp (s.type, "light")) |
303df1e804d4
struct2hdl.m: Allow light objects to be constructed (bug #57093)
Guillaume Flandin
parents:
27300
diff
changeset
|
199 h = createlight (s, par); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
200 elseif (strcmp (s.type, "hggroup")) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
201 [h, s, p] = createhg (s, p, par, hilev); |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
202 elseif (any (strcmp (s.type, {"uimenu", "uicontextmenu",... |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
203 "uicontrol", "uipanel", "uibuttongroup",... |
28230
cb0194e0cb0e
struct2hdl.m: Allow loading of uitoggletool objects (bug #58196).
Rik <rik@octave.org>
parents:
27985
diff
changeset
|
204 "uitoolbar", "uipushtool", "uitoggletool"... |
cb0194e0cb0e
struct2hdl.m: Allow loading of uitoggletool objects (bug #58196).
Rik <rik@octave.org>
parents:
27985
diff
changeset
|
205 "uitable"}))) |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
206 if (isfield (s.properties, "extent")) |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
207 s.properties = rmfield (s.properties, "extent"); |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
208 endif |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
209 [h, s] = createui (s, par); |
27300
301186dbef68
struct2hdl.m: Add capability to restore uicontextmenus (bug #44670).
Guillaume Flandin <guillaume.offline@gmail.com>
parents:
26878
diff
changeset
|
210 if (strcmp (s.type, "uicontextmenu")) |
301186dbef68
struct2hdl.m: Add capability to restore uicontextmenus (bug #44670).
Guillaume Flandin <guillaume.offline@gmail.com>
parents:
26878
diff
changeset
|
211 set (p(2, ismember (p(1,:), s.special)), 'UIContextMenu', h); |
301186dbef68
struct2hdl.m: Add capability to restore uicontextmenus (bug #44670).
Guillaume Flandin <guillaume.offline@gmail.com>
parents:
26878
diff
changeset
|
212 endif |
15941
8135bce0812a
struct2hdl.m: send error when the requested object type is not implemented.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
15799
diff
changeset
|
213 else |
21385
89fa0694aa2e
Fix check-missing-semicolon QA target (bug #47277).
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
214 error ("struct2hdl: %s objects are not implemented yet", s.type); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
215 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
216 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
217 ## children |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
218 p = [p [s.handle; h]]; # [original; new] |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
219 kids = s.children; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
220 nkids = length (kids); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
221 ii = 0; |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
222 while (nkids) |
20735
418ae0cb752f
Replace ++,-- with in-place operators for performance.
Rik <rik@octave.org>
parents:
20714
diff
changeset
|
223 ii += 1; |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
224 if (! any (ii == s.special)) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
225 [h2, p] = struct2hdl (s.children(ii), [p [s.handle; h]], hilev); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
226 endif |
20735
418ae0cb752f
Replace ++,-- with in-place operators for performance.
Rik <rik@octave.org>
parents:
20714
diff
changeset
|
227 nkids -= 1; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
228 endwhile |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
229 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
230 ## paste properties |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
231 setprops (s, h, p, hilev); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
232 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
233 pout = p; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
234 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
235 endfunction |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
236 |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
237 function [h, sout] = createfigure (s) |
28945
6e460773bdda
maint: Use newlines after "function" and before "endfunction" for clarity.
Rik <rik@octave.org>
parents:
28921
diff
changeset
|
238 |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
239 ## Create figure initially invisible to speed up loading. |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
240 opts = {"visible", "off"}; |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
241 if (isfield (s.properties, "integerhandle")) # see also bug #53342. |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
242 opts = [opts {"integerhandle", s.properties.integerhandle}]; |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
243 s.properties = rmfield (s.properties, "integerhandle"); |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
244 endif |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
245 h = figure (opts{:}); |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
246 rmprops = {"currentaxes", "currentcharacter", "currentobject", ... |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
247 "currentpoint", "number"}; |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
248 rmprops (! isfield (s.properties, rmprops)) = []; |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
249 s.properties = rmfield (s.properties, rmprops); |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
250 if (! isfield (s.properties, "visible")) |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
251 s.properties.visible = "on"; |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
252 endif |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
253 addmissingprops (h, s.properties); |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
254 sout = s; |
28945
6e460773bdda
maint: Use newlines after "function" and before "endfunction" for clarity.
Rik <rik@octave.org>
parents:
28921
diff
changeset
|
255 |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
256 endfunction |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
257 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
258 function [h, sout] = createaxes (s, p, par) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
259 |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
260 if (! isfield (s.properties, "tag") |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
261 || ! any (strcmpi (s.properties.tag, {"colorbar", "legend"}))) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
262 ## regular axes |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
263 propval = {"position", s.properties.position}; |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
264 hid = {"__autopos_tag__", "looseinset"}; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
265 for ii = 1:numel (hid) |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
266 prop = hid{ii}; |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
267 if (isfield (s.properties, prop)) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
268 val = s.properties.(prop); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
269 propval = [propval, prop, val]; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
270 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
271 endfor |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
272 h = axes (propval{:}, "parent", par); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
273 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
274 if (isfield (s.properties, "__plotyy_axes__")) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
275 plty = s.properties.__plotyy_axes__; |
17567
0b3cf264ec2f
struct2hdl.m: addproperty __plotyy_axes__ of type "data", not "any".
Rik <rik@octave.org>
parents:
17386
diff
changeset
|
276 addproperty ("__plotyy_axes__", h, "data"); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
277 tmp = [p [s.handle; h]]; |
29591
0023c109e1b0
struct2hdl.m: Fix bug loading plotyy figures (bug #60488).
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
278 tst = ismember (tmp(1,:), plty); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
279 if (sum (tst) == numel (plty)) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
280 for ii = 1:numel (plty) |
29591
0023c109e1b0
struct2hdl.m: Fix bug loading plotyy figures (bug #60488).
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
281 plty(ii) = tmp(2, find (tmp(1,:) == plty(ii))); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
282 endfor |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
283 for ii = 1:numel (plty) |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
284 set (plty(ii), "__plotyy_axes__", plty); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
285 endfor |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
286 endif |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
287 s.properties = rmfield (s.properties, "__plotyy_axes__"); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
288 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
289 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
290 ## delete non-default and already set properties |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
291 fields = fieldnames (s.properties); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
292 tst = cellfun (@(x) isprop (h, x), fields); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
293 s.properties = rmfield (s.properties, fields(find (tst == 0))); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
294 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
295 elseif (strcmp (s.properties.tag, "legend")) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
296 ## legends |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
297 oldax = s.properties.userdata.handle; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
298 idx = find (p == oldax); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
299 newax = p(idx+1); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
300 strings = {}; |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
301 kids = s.children; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
302 kids(s.special) = []; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
303 oldh = unique (arrayfun (@(x) x.properties.userdata(end), kids)); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
304 for ii = 1:length (oldh) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
305 idx = find (p(1:2:end) == oldh(ii)) * 2; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
306 if (! isempty (idx)) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
307 newh(ii) = p(idx); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
308 if (! strcmp (get (newh(ii), "type"), "hggroup")) |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
309 str = get (newh(ii), "displayname"); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
310 strings = [strings str]; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
311 else |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
312 str = get (get (newh(ii), "children")(1), "displayname"); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
313 strings = [strings str]; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
314 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
315 else |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
316 error ("struct2hdl: didn't find a legend item"); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
317 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
318 endfor |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
319 location = s.properties.location; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
320 orientation = s.properties.orientation; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
321 textpos = s.properties.textposition; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
322 box = s.properties.box; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
323 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
324 h = legend (newax, newh, strings, "location", location, ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
325 "orientation", orientation); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
326 set (h, "textposition", textpos); # bug makes "textposition" |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
327 # redefine the legend |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
328 h = legend (newax, newh, strings, "location", location, ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
329 "orientation", orientation); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
330 ## box |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
331 if (strcmp (box, "on")) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
332 legend ("boxon"); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
333 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
334 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
335 ## visibility |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
336 tst = arrayfun (@(x) strcmp (x.properties.visible, "on"), kids); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
337 if (! any (tst)) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
338 legend ("hide"); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
339 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
340 |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21562
diff
changeset
|
341 ## remove all properties such as "textposition" that redefine |
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21562
diff
changeset
|
342 ## the entire legend. Also remove chidren. |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
343 s.properties = rmfield (s.properties, ... |
24472
19d63669d174
Don't use "userdata" property internally for legend private data.
Rik <rik@octave.org>
parents:
24423
diff
changeset
|
344 {"__appdata__", "xlabel",... |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
345 "ylabel", "zlabel", "location", ... |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
346 "title", "string","orientation", ... |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
347 "visible", "textposition"}); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
348 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
349 s.children = []; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
350 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
351 elseif (strcmp (s.properties.tag, "colorbar")) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
352 ## colorbar |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
353 oldax = s.properties.axes; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
354 if (! isempty (idx = find (oldax == p))) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
355 ax = p(idx+1); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
356 location = s.properties.location; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
357 h = colorbar ("peer", ax, location); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
358 s.properties = rmfield (s.properties, ... |
24472
19d63669d174
Don't use "userdata" property internally for legend private data.
Rik <rik@octave.org>
parents:
24423
diff
changeset
|
359 {"__appdata__", "xlabel" ... |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
360 "ylabel", "zlabel", ... |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
361 "title", "axes"}); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
362 s.children= []; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
363 else |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
364 error ("hdl2struct: didn't find an object"); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
365 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
366 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
367 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
368 sout = s; |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
369 |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
370 endfunction |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
371 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
372 function h = createline (s, par) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
373 h = line ("parent", par); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
374 addmissingprops (h, s.properties); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
375 endfunction |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
376 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
377 function [h, sout] = createpatch (s, par) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
378 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
379 prp.faces = s.properties.faces; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
380 prp.vertices = s.properties.vertices; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
381 prp.facevertexcdata = s.properties.facevertexcdata; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
382 h = patch (prp); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
383 set (h, "parent", par); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
384 s.properties = rmfield (s.properties, |
18317
0187ed948627
Fix segfault with copyobj() and patch objects.
Rik <rik@octave.org>
parents:
17795
diff
changeset
|
385 {"faces", "vertices", "facevertexcdata"}); |
0187ed948627
Fix segfault with copyobj() and patch objects.
Rik <rik@octave.org>
parents:
17795
diff
changeset
|
386 ## Also remove derived properties. Otherwise there is a possibility for |
0187ed948627
Fix segfault with copyobj() and patch objects.
Rik <rik@octave.org>
parents:
17795
diff
changeset
|
387 ## a segfault when 'set (h, properties)' is used to restore properties |
0187ed948627
Fix segfault with copyobj() and patch objects.
Rik <rik@octave.org>
parents:
17795
diff
changeset
|
388 ## which do not match in size the ones created with from the call to patch(). |
0187ed948627
Fix segfault with copyobj() and patch objects.
Rik <rik@octave.org>
parents:
17795
diff
changeset
|
389 s.properties = rmfield (s.properties, {"xdata", "ydata", "zdata", "cdata"}); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
390 addmissingprops (h, s.properties); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
391 sout = s; |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
392 |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
393 endfunction |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
394 |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
395 function [h, sout] = createscatter (s, par) |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
396 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
397 if (isempty (s.properties.zdata)) |
31253
a40c0b7aa376
maint: changes to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
30820
diff
changeset
|
398 ## 2-D scatter |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
399 h = scatter (s.properties.xdata, s.properties.ydata); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
400 else |
31253
a40c0b7aa376
maint: changes to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
30820
diff
changeset
|
401 ## 3-D scatter |
28286
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
402 h = scatter3 (s.properties.xdata, s.properties.ydata, s.properties.zdata); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
403 endif |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
404 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
405 set (h, "parent", par); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
406 s.properties = rmfield (s.properties, |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
407 {"xdata", "ydata", "zdata"}); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
408 addmissingprops (h, s.properties); |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
409 sout = s; |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
410 |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
411 endfunction |
496735a910c1
Add graphics object "scatter" (bug #58282).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28284
diff
changeset
|
412 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
413 function h = createtext (s, par) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
414 h = text ("parent", par); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
415 addmissingprops (h, s.properties); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
416 endfunction |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
417 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
418 function h = createimage (s, par) |
17189
b1fd3dc31c42
struct2hdl.m: Call image() with a single piece of data to avoid loading default.img.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
419 h = image (1, "parent", par); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
420 addmissingprops (h, s.properties); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
421 endfunction |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
422 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
423 function h = createsurface (s, par) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
424 h = surface ("parent", par); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
425 addmissingprops (h, s.properties); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
426 endfunction |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
427 |
27535
303df1e804d4
struct2hdl.m: Allow light objects to be constructed (bug #57093)
Guillaume Flandin
parents:
27300
diff
changeset
|
428 function h = createlight (s, par) |
303df1e804d4
struct2hdl.m: Allow light objects to be constructed (bug #57093)
Guillaume Flandin
parents:
27300
diff
changeset
|
429 h = light ("parent", par); |
303df1e804d4
struct2hdl.m: Allow light objects to be constructed (bug #57093)
Guillaume Flandin
parents:
27300
diff
changeset
|
430 addmissingprops (h, s.properties); |
303df1e804d4
struct2hdl.m: Allow light objects to be constructed (bug #57093)
Guillaume Flandin
parents:
27300
diff
changeset
|
431 endfunction |
303df1e804d4
struct2hdl.m: Allow light objects to be constructed (bug #57093)
Guillaume Flandin
parents:
27300
diff
changeset
|
432 |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
433 function [h, s] = createui (s, par) |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
434 if (isfield (s.properties, "style") && strcmp (s.properties.style, "frame")) |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
435 s.type = "uipanel"; # frame is deprecated: use uipanel instead |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
436 endif |
26031
8e0475e6ec15
struct2hdl.m: Add missing semicolon to suppress output in cset a21d7d269472.
Rik <rik@octave.org>
parents:
26030
diff
changeset
|
437 h = feval (s.type, "parent", par); |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
438 addmissingprops (h, s.properties); |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
439 endfunction |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
440 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
441 function [h, sout, pout] = createhg (s, p, par, hilev) |
30379
363fb10055df
maint: Style check m-files ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29591
diff
changeset
|
442 |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
443 ## Here we infer from properties the type of hggroup we should build |
30820
620607ec6608
Fix saving and loading of polar plots (bug #62093)
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
444 ## and call the corresponding high level functions. |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
445 ## We manually set "hold on" to avoid next hggroup be deleted |
30820
620607ec6608
Fix saving and loading of polar plots (bug #62093)
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
446 ## the proper value of axes "nextplot" will finally be recovered. |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
447 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
448 hold on; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
449 if (hilev) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
450 [h, s, p] = createhg_hilev (s, p, par); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
451 if (numel (s.children) != numel (get (h).children)) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
452 warning (["struct2hdl: could not infer the hggroup type. ", ... |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
453 "Will build objects but listener/callback functions ", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
454 "will be lost"]); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
455 if (isfield (h, "bargroup")) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
456 delete (get (h).bargroup); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
457 else |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
458 delete (h); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
459 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
460 h = hggroup ("parent", par); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
461 addmissingprops (h, s.properties); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
462 s.special = []; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
463 else |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
464 oldkids = s.children; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
465 newkids = get (h).children; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
466 nkids = numel (oldkids); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
467 ii = 1; |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
468 while (nkids) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
469 p = [p [oldkids(ii++).handle; newkids(nkids--)]]; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
470 endwhile |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
471 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
472 else |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
473 h = hggroup ("parent", par); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
474 addmissingprops (h, s.properties); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
475 s.special = []; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
476 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
477 |
30820
620607ec6608
Fix saving and loading of polar plots (bug #62093)
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
478 ## Check for polar plots with special "polar_grid" object |
620607ec6608
Fix saving and loading of polar plots (bug #62093)
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
479 ## FIXME: A hack to fix bug #62093. |
620607ec6608
Fix saving and loading of polar plots (bug #62093)
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
480 if (strcmp (s.properties.tag, "polar_grid")) |
620607ec6608
Fix saving and loading of polar plots (bug #62093)
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
481 s.properties.handlevisibility = "off"; |
620607ec6608
Fix saving and loading of polar plots (bug #62093)
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
482 endif |
620607ec6608
Fix saving and loading of polar plots (bug #62093)
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
483 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
484 sout = s; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
485 pout = p; |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
486 |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
487 endfunction |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
488 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
489 function [h, sout, pout] = createhg_hilev (s, p, par) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
490 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
491 fields = s.properties; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
492 if (isfield (fields, "contourmatrix")) |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
493 ## contours |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
494 xdata = s.properties.xdata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
495 ydata = s.properties.ydata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
496 zdata = s.properties.zdata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
497 levellist = s.properties.levellist; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
498 textlist = s.properties.textlist; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
499 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
500 ## contour creation |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
501 if (isempty (s.children(1).properties.zdata)) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
502 if (strcmpi (s.properties.fill, "on")) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
503 [cm2, h] = contourf (xdata, ydata, zdata, levellist); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
504 else |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
505 [cm2, h] = contour (xdata, ydata, zdata, levellist); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
506 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
507 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
508 ## labels |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
509 if (strcmpi (s.properties.showtext, "on")) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
510 clabel (cm2, h, textlist); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
511 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
512 else |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
513 [cm2, h] = contour3 (xdata, ydata, zdata, levellist); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
514 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
515 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
516 ## delete already set properties and children |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
517 s.properties = rmfield (s.properties, ... |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
518 {"xdata", "ydata", "zdata", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
519 "contourmatrix", "levellist", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
520 "fill", "labelspacing", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
521 "levellistmode", "levelstep", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
522 "levelstepmode", "textlist"... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
523 "textlistmode" , "textstep", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
524 "textstepmode", "zlevel", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
525 "zlevelmode"}); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
526 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
527 elseif (isfield (fields, "udata") && isfield (fields, "vdata")) |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
528 ## quiver |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
529 xdata = s.properties.xdata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
530 ydata = s.properties.ydata; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
531 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
532 udata = s.properties.udata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
533 vdata = s.properties.vdata; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
534 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
535 h = quiver (xdata, ydata, udata, vdata); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
536 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
537 ## delete already set properties and children |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
538 s.properties = rmfield (s.properties, ... |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
539 {"xdata", "ydata", "zdata", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
540 "xdatasource", "ydatasource", "zdatasource", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
541 "udata", "vdata", "wdata", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
542 "udatasource", "vdatasource", "wdatasource"}); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
543 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
544 elseif (isfield (fields, "format")) |
31253
a40c0b7aa376
maint: changes to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
30820
diff
changeset
|
545 ## errorbar |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
546 form = s.properties.format; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
547 xdata = s.properties.xdata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
548 ydata = s.properties.ydata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
549 xldata = s.properties.xldata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
550 ldata = s.properties.ldata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
551 xudata = s.properties.xudata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
552 udata = s.properties.udata; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
553 |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
15941
diff
changeset
|
554 switch (form) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
555 case "xerr" |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
556 h = errorbar (xdata, ydata, xldata, xudata, ">"); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
557 case "yerr" |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
558 h = errorbar (xdata, ydata, ldata, udata, "~"); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
559 case "xyerr" |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
560 h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "~>"); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
561 case "box" |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
562 h = errorbar (xdata, ydata, xldata, xudata, "#"); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
563 case "boxy" |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
564 h = errorbar (xdata, ydata, ldata, udata, "#~"); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
565 case "boxxy" |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
566 h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "#~>"); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
567 otherwise |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
568 error ("struct2hdl: couldn't guess the errorbar format"); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
569 endswitch |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
570 ## delete already set properties |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
571 s.properties = rmfield (s.properties, ... |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
572 {"xdata", "ydata", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
573 "xldata", "ldata", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
574 "xudata", "udata", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
575 "xldatasource", "ldatasource", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
576 "xudatasource", "udatasource", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
577 "format"}); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
578 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
579 elseif (isfield (fields, "bargroup")) |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
580 ## bar plot |
18857
7bbe3658c5ef
maint: Use "FIXME:" coding convention in m-files.
Rik <rik@octave.org>
parents:
18625
diff
changeset
|
581 ## FIXME: Here we don't have access to brothers so we first create all |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
582 ## the barseries of the bargroup (but the last), then retrieve information, |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
583 ## and rebuild the whole bargroup. |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
584 ## The duplicate are deleted after calling "setprops" |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
585 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
586 bargroup = s.properties.bargroup; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
587 oldh = s.handle; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
588 |
17383
1a4d036e1456
struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
589 temp = ismember ([p(1:2:end) oldh], bargroup); |
1a4d036e1456
struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
590 |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
591 tst = sum (temp) == length (bargroup); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
592 |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
593 if (isscalar (bargroup) || ! tst) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
594 xdata = s.properties.xdata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
595 ydata = s.properties.ydata; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
596 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
597 h = bar (xdata, ydata); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
598 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
599 ## delete already set properties, |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
600 s.properties = rmfield (s.properties, ... |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
601 {"xdata", "ydata", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
602 "xdatasource", "ydatasource", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
603 "bargroup", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
604 "barwidth", "baseline"}); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
605 else |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
606 xdata = []; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
607 ydata = []; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
608 |
31253
a40c0b7aa376
maint: changes to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
30820
diff
changeset
|
609 ## Build x/y matrix |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
610 nbar = length (bargroup); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
611 tmp = struct ("handle", NaN, "type", "", "children", [], "special", []); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
612 for ii = 1:(nbar - 1) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
613 idx = find (p(1:2:end) == bargroup(ii)) * 2; |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
614 hdl = p(idx); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
615 xdata = [xdata get(hdl).xdata]; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
616 ydata = [ydata get(hdl).ydata]; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
617 tmp.children(ii) = hdl2struct (hdl); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
618 endfor |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
619 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
620 xdata = [xdata s.properties.xdata]; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
621 ydata = [ydata s.properties.ydata]; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
622 width = s.properties.barwidth; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
623 h = bar (ydata, width); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
624 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
625 ## replace previous handles in "match", copy props and delete redundant |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
626 for ii = 1:(nbar - 1) |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
627 props = tmp.children(ii).properties; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
628 bl = props.baseline; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
629 tmp.children(ii).properties = rmfield (props, {"baseline", "bargroup"}); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
630 setprops (tmp.children(ii), h(ii), p, 1); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
631 delete (tmp.children(ii).handle); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
632 delete (bl); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
633 idxpar = find (p == tmp.children(ii).handle); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
634 p(idxpar) = h(ii); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
635 idxkid = idxpar - 2; |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
636 p(idxkid) = get (h(ii), "children"); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
637 endfor |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
638 p(2,((end-nbar+2):end)) = h(1:(end-1)); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
639 h = h(end); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
640 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
641 ## delete already set properties , |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
642 s.properties = rmfield (s.properties, ... |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
643 {"xdata", "ydata", "bargroup"... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
644 "barwidth", "baseline"}); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
645 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
646 elseif (isfield (fields, "baseline")) |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
647 ## stem plot |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
648 xdata = s.properties.xdata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
649 ydata = s.properties.ydata; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
650 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
651 h = stem (xdata, ydata); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
652 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
653 ## delete already set properties, |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
654 s.properties = rmfield (s.properties, ... |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
655 {"xdata", "ydata", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
656 "xdatasource", "ydatasource", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
657 "baseline"}); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
658 elseif (isfield (fields, "basevalue")) |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
659 ## area plot |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
660 xdata = s.properties.xdata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
661 ydata = s.properties.ydata; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
662 level = s.properties.basevalue; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
663 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
664 h = area (xdata, ydata, level); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
665 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
666 ## delete already set properties, |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
667 s.properties = rmfield (s.properties, ... |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
668 {"xdata", "ydata", ... |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
669 "xdatasource", "ydatasource"}); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
670 else |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21562
diff
changeset
|
671 warning ("struct2hdl: could not infer the hggroup type. Will build objects but listener/callback functions will be lost"); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
672 h = hggroup ("parent", par); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
673 addmissingprops (h, s.properties); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
674 s.special = []; # children will be treated as normal children |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
675 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
676 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
677 sout = s; |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
678 pout = p; |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
679 |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
680 endfunction |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
681 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
682 function setprops (s, h, p, hilev) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
683 |
26030
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
684 isspecial = (isfield (s.properties, "tag") |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
685 && any (strcmpi (s.properties.tag, {"colorbar", "legend"}))); |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
686 if (! isspecial) |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
687 try |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
688 specs = s.children(s.special); |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
689 catch |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
690 specs = []; |
a21d7d269472
struct2hdl.m: Allow restoring uiXXX objects (bug #44670).
Rik <rik@octave.org>
parents:
25273
diff
changeset
|
691 end_try_catch |
17383
1a4d036e1456
struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
692 if (isempty (specs)) |
1a4d036e1456
struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
693 hdls = []; |
1a4d036e1456
struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
694 else |
1a4d036e1456
struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
695 hdls = [specs.handle]; |
1a4d036e1456
struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents:
17338
diff
changeset
|
696 endif |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
697 nh = length (hdls); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
698 msg = ""; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
699 if (! nh) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
700 set (h, s.properties); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
701 else |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
702 ## Specials are objects that where automatically constructed with |
25272
49a8d0a2d7ae
Move exclusion of saved graphics properties from hdl2struct to struct2hdl.
Rik <rik@octave.org>
parents:
25115
diff
changeset
|
703 ## current object. Among them are "x(yz)labels", "title", and |
49a8d0a2d7ae
Move exclusion of saved graphics properties from hdl2struct to struct2hdl.
Rik <rik@octave.org>
parents:
25115
diff
changeset
|
704 ## high level hggroup children |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
705 fields = fieldnames (s.properties); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
706 vals = struct2cell (s.properties); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
707 idx = find (cellfun (@(x) valcomp(x, hdls) , vals)); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
708 s.properties = rmfield (s.properties, fields(idx)); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
709 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
710 ## set all properties but special handles |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
711 set (h, s.properties); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
712 |
21562
6c2fd62db1f7
maint: Eliminate accidental double spaces in code.
Rik <rik@octave.org>
parents:
21385
diff
changeset
|
713 ## find props with val == (one of special handles) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
714 nf = length (idx); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
715 fields = fields(idx); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
716 vals = vals(idx); |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
717 while (nf) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
718 field = fields{nf}; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
719 idx = find (hdls == vals{nf}); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
720 spec = specs(idx); |
25272
49a8d0a2d7ae
Move exclusion of saved graphics properties from hdl2struct to struct2hdl.
Rik <rik@octave.org>
parents:
25115
diff
changeset
|
721 ## FIXME: Wouldn't it be better to call struct2hdl recursively |
49a8d0a2d7ae
Move exclusion of saved graphics properties from hdl2struct to struct2hdl.
Rik <rik@octave.org>
parents:
25115
diff
changeset
|
722 ## for this handle? That way the function could determine |
49a8d0a2d7ae
Move exclusion of saved graphics properties from hdl2struct to struct2hdl.
Rik <rik@octave.org>
parents:
25115
diff
changeset
|
723 ## based on type what special actions to take. |
49a8d0a2d7ae
Move exclusion of saved graphics properties from hdl2struct to struct2hdl.
Rik <rik@octave.org>
parents:
25115
diff
changeset
|
724 try |
49a8d0a2d7ae
Move exclusion of saved graphics properties from hdl2struct to struct2hdl.
Rik <rik@octave.org>
parents:
25115
diff
changeset
|
725 spec.properties = rmfield (spec.properties, "extent"); |
49a8d0a2d7ae
Move exclusion of saved graphics properties from hdl2struct to struct2hdl.
Rik <rik@octave.org>
parents:
25115
diff
changeset
|
726 end_try_catch |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
727 if (isprop (h, field)) |
25272
49a8d0a2d7ae
Move exclusion of saved graphics properties from hdl2struct to struct2hdl.
Rik <rik@octave.org>
parents:
25115
diff
changeset
|
728 h2 = get (h, field); |
25002
64c6e8bfc9e5
Fix Octave not loading figures saved in older versions (bug #53468)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24534
diff
changeset
|
729 addmissingprops (h2, spec.properties); |
64c6e8bfc9e5
Fix Octave not loading figures saved in older versions (bug #53468)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24534
diff
changeset
|
730 set (h2, spec.properties); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
731 endif |
20735
418ae0cb752f
Replace ++,-- with in-place operators for performance.
Rik <rik@octave.org>
parents:
20714
diff
changeset
|
732 nf -= 1; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
733 endwhile |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
734 |
21562
6c2fd62db1f7
maint: Eliminate accidental double spaces in code.
Rik <rik@octave.org>
parents:
21385
diff
changeset
|
735 ## If hggroup children were created by high level functions, |
6c2fd62db1f7
maint: Eliminate accidental double spaces in code.
Rik <rik@octave.org>
parents:
21385
diff
changeset
|
736 ## copy only useful properties. |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
737 if (hilev) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
738 if (strcmp (s.type, "hggroup")) |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
739 nold = numel (s.children); |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
740 nnew = numel (get (h).children); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
741 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
742 if (nold == nnew) |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
743 hnew = get (h).children; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
744 ii = 1; |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
745 while (ii <= nnew) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
746 try |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
747 set (hnew (ii), "displayname", ... |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
748 s.children(ii).properties.displayname); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
749 catch |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
750 sprintf ("struct2hdl: couldn't set hggroup children #%d props.", ii); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
751 end_try_catch |
20735
418ae0cb752f
Replace ++,-- with in-place operators for performance.
Rik <rik@octave.org>
parents:
20714
diff
changeset
|
752 ii += 1; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
753 endwhile |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
754 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
755 else |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
756 error ("struct2hdl: non-conformant number of children in hgggroup"); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
757 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
758 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
759 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
760 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
761 |
18625
ee125c82e01e
struct2hdl.m: handle properly objects with non-empy "tag" (bug #42047).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
18580
diff
changeset
|
762 else |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
763 set (h, s.properties); |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
764 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
765 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
766 endfunction |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
767 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
768 function out = valcomp (x, hdls) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
769 |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
770 if (isfloat (x) && isscalar (x)) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
771 out = any (x == hdls); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
772 else |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
773 out = 0; |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
774 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
775 |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
776 endfunction |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
777 |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
778 function addmissingprops (h, props) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
779 |
22622
4191f8b5070c
Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
780 hid = {"__autopos_tag__", "looseinset"}; |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
781 oldfields = fieldnames (props); |
25002
64c6e8bfc9e5
Fix Octave not loading figures saved in older versions (bug #53468)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24534
diff
changeset
|
782 for ii = 1:numel (oldfields) |
64c6e8bfc9e5
Fix Octave not loading figures saved in older versions (bug #53468)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24534
diff
changeset
|
783 prop = oldfields{ii}; |
64c6e8bfc9e5
Fix Octave not loading figures saved in older versions (bug #53468)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24534
diff
changeset
|
784 if (! isprop (h, prop) && ! any (strcmp (prop, hid))) |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
785 addproperty (prop, h, "any"); |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
786 endif |
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
787 endfor |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
788 |
14867
97ce18b62d0f
New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff
changeset
|
789 endfunction |
15011
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
790 |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
791 |
f34bea431e4f
maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
792 ## FIXME: Need validation tests |