Mercurial > hg > octave-nkf
annotate scripts/plot/private/__go_draw_figure__.m @ 14415:eeff2d0a275d
The gnuplot toolkit behavior is indepednet of uimenu children (bug # 35393).
* __go_draw_figure__.m: Behavior for an empty figure and one with only uimenu
children shoudld be the same.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sun, 26 Feb 2012 18:25:20 -0500 |
parents | 72c96de7a403 |
children | 161d06a52360 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
12793
diff
changeset
|
1 ## Copyright (C) 2005-2012 John W. Eaton |
6405 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6405 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6405 | 18 |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8249
diff
changeset
|
19 ## -*- texinfo -*- |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8249
diff
changeset
|
20 ## @deftypefn {Function File} {} __go_draw_figure__ (@var{h}, @var{plot_stream}, @var{enhanced}, @var{mono}) |
6895 | 21 ## Undocumented internal function. |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8249
diff
changeset
|
22 ## @end deftypefn |
6405 | 23 |
24 ## Author: jwe | |
25 | |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10725
diff
changeset
|
26 function __go_draw_figure__ (h, plot_stream, enhanced, mono) |
6405 | 27 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10725
diff
changeset
|
28 if (nargin == 4) |
8249 | 29 htype = get (h, "type"); |
30 if (strcmp (htype, "figure")) | |
9098
5ecdb3d3568f
Allow fontsize to be specified for all objects with fontname == "*".
Ben Abbott <bpabbott@mac.com>
parents:
9062
diff
changeset
|
31 ## Get complete list of children. |
5ecdb3d3568f
Allow fontsize to be specified for all objects with fontname == "*".
Ben Abbott <bpabbott@mac.com>
parents:
9062
diff
changeset
|
32 kids = allchild (h); |
5ecdb3d3568f
Allow fontsize to be specified for all objects with fontname == "*".
Ben Abbott <bpabbott@mac.com>
parents:
9062
diff
changeset
|
33 nkids = length (kids); |
6405 | 34 |
9098
5ecdb3d3568f
Allow fontsize to be specified for all objects with fontname == "*".
Ben Abbott <bpabbott@mac.com>
parents:
9062
diff
changeset
|
35 if (nkids > 0) |
10473
169be980faf9
__go_draw_figure__.m: Untabify.
Ben Abbott <bpabbott@mac.com>
parents:
10159
diff
changeset
|
36 fputs (plot_stream, "\nreset;\n"); |
169be980faf9
__go_draw_figure__.m: Untabify.
Ben Abbott <bpabbott@mac.com>
parents:
10159
diff
changeset
|
37 fputs (plot_stream, "set autoscale keepfix;\n"); |
169be980faf9
__go_draw_figure__.m: Untabify.
Ben Abbott <bpabbott@mac.com>
parents:
10159
diff
changeset
|
38 fputs (plot_stream, "set origin 0, 0\n"); |
169be980faf9
__go_draw_figure__.m: Untabify.
Ben Abbott <bpabbott@mac.com>
parents:
10159
diff
changeset
|
39 fputs (plot_stream, "set size 1, 1\n"); |
10119
1e38d9ed1e28
Respect figure and axes color properties for gnuplot backend
David Bateman <dbateman@free.fr>
parents:
9944
diff
changeset
|
40 bg = get (h, "color"); |
10136
ee18258bc002
Also treat white figure and axes color properties
David Bateman <dbateman@free.fr>
parents:
10120
diff
changeset
|
41 if (isnumeric (bg)) |
10119
1e38d9ed1e28
Respect figure and axes color properties for gnuplot backend
David Bateman <dbateman@free.fr>
parents:
9944
diff
changeset
|
42 fprintf (plot_stream, "set obj 1 rectangle from screen 0,0 to screen 1,1 behind fc rgb \"#%02x%02x%02x\"\n", 255 * bg); |
1e38d9ed1e28
Respect figure and axes color properties for gnuplot backend
David Bateman <dbateman@free.fr>
parents:
9944
diff
changeset
|
43 bg_is_set = true; |
1e38d9ed1e28
Respect figure and axes color properties for gnuplot backend
David Bateman <dbateman@free.fr>
parents:
9944
diff
changeset
|
44 else |
1e38d9ed1e28
Respect figure and axes color properties for gnuplot backend
David Bateman <dbateman@free.fr>
parents:
9944
diff
changeset
|
45 bg_is_set = false; |
1e38d9ed1e28
Respect figure and axes color properties for gnuplot backend
David Bateman <dbateman@free.fr>
parents:
9944
diff
changeset
|
46 endif |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
47 |
10473
169be980faf9
__go_draw_figure__.m: Untabify.
Ben Abbott <bpabbott@mac.com>
parents:
10159
diff
changeset
|
48 for i = nkids:-1:1 |
10568
046b713d21dc
__go_draw_figure__.m: Hidden axes may have visible children.
Ben Abbott <bpabbott@mac.com>
parents:
10528
diff
changeset
|
49 type = get (kids(i), "type"); |
046b713d21dc
__go_draw_figure__.m: Hidden axes may have visible children.
Ben Abbott <bpabbott@mac.com>
parents:
10528
diff
changeset
|
50 switch (type) |
046b713d21dc
__go_draw_figure__.m: Hidden axes may have visible children.
Ben Abbott <bpabbott@mac.com>
parents:
10528
diff
changeset
|
51 case "axes" |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10913
diff
changeset
|
52 if (strcmpi (get (kids (i), "tag"), "legend")) |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
53 ## This is so ugly. If there was a way of getting |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
54 ## gnuplot to give us the text extents of strings |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
55 ## then we could get rid of this mess. |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
56 lh = getfield (get (kids(i), "userdata"), "handle"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
57 if (isscalar (lh)) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
58 ## We have a legend with a single parent. It'll be handled |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
59 ## below as a gnuplot key to the axis it corresponds to |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
60 continue; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
61 else |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
62 ca = lh(1); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
63 ## Rely upon listener to convert axes position |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
64 ## to "normalized" units. |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
65 legend_axes_units = get (kids(i), "units"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
66 legend_axes_position = get (kids(i), "position"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
67 legend_axes_outerposition = get (kids(i), "outerposition"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
68 legend_axes_box = get (kids(i), "box"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
69 legend_axes_ylim = get (kids(i), "ylim"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
70 orig_axes_units = get (ca, "units"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
71 hlgnd = get (kids(i)); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
72 |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
73 unwind_protect |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
74 set (ca, "units", "normalized"); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
75 set (kids(i), "units", "normalized", "box", "off", |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
76 "ylim", [-2, -1], "position", get (ca(1), "position"), |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
77 "outerposition", get (ca(1), "outerposition")); |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10913
diff
changeset
|
78 |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
79 ## Create a new set of lines with the appropriate |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
80 ## displaynames, etc |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
81 toberm = []; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
82 hobj = get (kids(i), "children"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
83 for j = numel (hobj) : -1 : 1 |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
84 if (! strcmp (get (hobj(j), "type"), "text")) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
85 continue; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
86 endif |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
87 displayname = get (hobj(j), "string"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
88 ll = []; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
89 lm = []; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
90 for k = numel (hobj) : -1 : 1 |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
91 if (! strcmp (get (hobj(k), "type"), "line")) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
92 continue; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
93 endif |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
94 if (get (hobj(j), "userdata") |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
95 != get (hobj(k), "userdata")) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
96 continue; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
97 endif |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
98 if (! strcmp (get (hobj(k), "linestyle"), "none")) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
99 ll = hobj(k); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
100 endif |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
101 if (! strcmp (get (hobj(k), "marker"), "none")) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
102 lm = hobj(k); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
103 endif |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
104 endfor |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
105 |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
106 if (! isempty (ll)) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
107 if (!isempty (lm)) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
108 toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(lm,"color"), "linestyle", get(ll,"linestyle"), "marker", get(lm,"marker"), "markeredgecolor", get(lm,"markeredgecolor"), "markerfacecolor", get(lm,"markerfacecolor"), "markersize", get (lm, "markersize"), "displayname", displayname, "parent", kids(i))]; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
109 else |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
110 toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(ll,"color"), "linestyle", get(ll,"linestyle"), "marker", "none", "displayname", displayname, "parent", kids(i))]; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
111 endif |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
112 elseif (! isempty (lm)) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
113 toberm = [toberm, line("xdata",[0,0],"ydata",[0,0], "color", get(lm,"color"), "linestyle", "none", "marker", get(lm,"marker"), "markeredgecolor", get(lm,"markeredgecolor"), "markerfacecolor", get(lm,"markerfacecolor"), "markersize", get (lm, "markersize"), "displayname", displayname, "parent", kids(i))]; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
114 endif |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
115 endfor |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
116 if (bg_is_set) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
117 fprintf (plot_stream, "set border linecolor rgb \"#%02x%02x%02x\"\n", 255 * (1 - bg)); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
118 endif |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
119 __go_draw_axes__ (kids(i), plot_stream, enhanced, mono, |
11204
d2f3a904ac6b
Unset the foreground color for the gnuplot backend earlier (fixes #31533)
David Bateman <dbateman@free.fr>
parents:
11198
diff
changeset
|
120 bg_is_set, false, hlgnd); |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
121 unwind_protect_cleanup |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
122 ## Return axes "units" and "position" back to |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
123 ## their original values. |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
124 set (ca, "units", orig_axes_units); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
125 set (kids(i), "units", legend_axes_units, |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
126 "box", legend_axes_box, |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
127 "ylim", legend_axes_ylim, |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
128 "position", legend_axes_position, |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
129 "outerposition", legend_axes_outerposition); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
130 delete (toberm); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
131 bg_is_set = false; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
132 end_unwind_protect |
10725
3c59ce262c66
Add the whitebg function
David Bateman <dbateman@free.fr>
parents:
10568
diff
changeset
|
133 endif |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
134 else |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
135 ## Rely upon listener to convert axes position |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
136 ## to "normalized" units. |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
137 orig_axes_units = get (kids(i), "units"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
138 orig_axes_position = get (kids(i), "position"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
139 unwind_protect |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
140 set (kids(i), "units", "normalized"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
141 fg = get (kids(i), "color"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
142 if (isnumeric (fg) && strcmp (get (kids(i), "visible"), "on")) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
143 fprintf (plot_stream, "set obj 2 rectangle from graph 0,0 to graph 1,1 behind fc rgb \"#%02x%02x%02x\"\n", 255 * fg); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
144 fg_is_set = true; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
145 else |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
146 fg_is_set = false; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
147 endif |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
148 if (bg_is_set) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
149 fprintf (plot_stream, "set border linecolor rgb \"#%02x%02x%02x\"\n", 255 * (1 - bg)); |
10995
e81914f3921f
Update legend code to support fltk (fixes #29348 and partially fixes #30461)
David Bateman <dbateman@free.fr>
parents:
10913
diff
changeset
|
150 endif |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
151 ## Find if this axes has an associated legend axes and pass it |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
152 ## to __go_draw_axes__ |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
153 hlegend = []; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
154 fkids = get (h, "children"); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
155 for j = 1 : numel(fkids) |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
156 if (ishandle (fkids (j)) |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
157 && strcmp (get (fkids (j), "type"), "axes") |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
158 && (strcmp (get (fkids (j), "tag"), "legend"))) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
159 udata = get (fkids (j), "userdata"); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
160 if (isscalar(udata.handle) |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
161 && ! isempty (intersect (udata.handle, kids (i)))) |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
162 hlegend = get (fkids (j)); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
163 break; |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
164 endif |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
165 endif |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
166 endfor |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
167 __go_draw_axes__ (kids(i), plot_stream, enhanced, mono, |
11204
d2f3a904ac6b
Unset the foreground color for the gnuplot backend earlier (fixes #31533)
David Bateman <dbateman@free.fr>
parents:
11198
diff
changeset
|
168 bg_is_set, fg_is_set, hlegend); |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
169 unwind_protect_cleanup |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
170 ## Return axes "units" and "position" back to |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
171 ## their original values. |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
172 set (kids(i), "units", orig_axes_units); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
173 set (kids(i), "position", orig_axes_position); |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
174 bg_is_set = false; |
11204
d2f3a904ac6b
Unset the foreground color for the gnuplot backend earlier (fixes #31533)
David Bateman <dbateman@free.fr>
parents:
11198
diff
changeset
|
175 fg_is_set = false; |
11198
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
176 end_unwind_protect |
9f080d23396f
Fix multi-parented legends with the gnuplot backend (fixes #30461 and #31522)
David Bateman <dbateman@free.fr>
parents:
11155
diff
changeset
|
177 endif |
11155
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
10995
diff
changeset
|
178 case "uimenu" |
f0e9befd6a1c
add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents:
10995
diff
changeset
|
179 ## ignore uimenu objects |
14415
eeff2d0a275d
The gnuplot toolkit behavior is indepednet of uimenu children (bug # 35393).
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
180 kids(i) = []; |
10568
046b713d21dc
__go_draw_figure__.m: Hidden axes may have visible children.
Ben Abbott <bpabbott@mac.com>
parents:
10528
diff
changeset
|
181 otherwise |
046b713d21dc
__go_draw_figure__.m: Hidden axes may have visible children.
Ben Abbott <bpabbott@mac.com>
parents:
10528
diff
changeset
|
182 error ("__go_draw_figure__: unknown object class, %s", type); |
046b713d21dc
__go_draw_figure__.m: Hidden axes may have visible children.
Ben Abbott <bpabbott@mac.com>
parents:
10528
diff
changeset
|
183 endswitch |
10473
169be980faf9
__go_draw_figure__.m: Untabify.
Ben Abbott <bpabbott@mac.com>
parents:
10159
diff
changeset
|
184 endfor |
14415
eeff2d0a275d
The gnuplot toolkit behavior is indepednet of uimenu children (bug # 35393).
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
185 if (isempty (kids)) |
eeff2d0a275d
The gnuplot toolkit behavior is indepednet of uimenu children (bug # 35393).
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
186 fputs (plot_stream, "\nreset; clear;\n"); |
eeff2d0a275d
The gnuplot toolkit behavior is indepednet of uimenu children (bug # 35393).
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
187 fflush (plot_stream); |
eeff2d0a275d
The gnuplot toolkit behavior is indepednet of uimenu children (bug # 35393).
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
188 else |
eeff2d0a275d
The gnuplot toolkit behavior is indepednet of uimenu children (bug # 35393).
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
189 fputs (plot_stream, "\nunset multiplot;\n"); |
eeff2d0a275d
The gnuplot toolkit behavior is indepednet of uimenu children (bug # 35393).
Ben Abbott <bpabbott@mac.com>
parents:
14138
diff
changeset
|
190 endif |
9098
5ecdb3d3568f
Allow fontsize to be specified for all objects with fontname == "*".
Ben Abbott <bpabbott@mac.com>
parents:
9062
diff
changeset
|
191 else |
10473
169be980faf9
__go_draw_figure__.m: Untabify.
Ben Abbott <bpabbott@mac.com>
parents:
10159
diff
changeset
|
192 fputs (plot_stream, "\nreset; clear;\n"); |
169be980faf9
__go_draw_figure__.m: Untabify.
Ben Abbott <bpabbott@mac.com>
parents:
10159
diff
changeset
|
193 fflush (plot_stream); |
9098
5ecdb3d3568f
Allow fontsize to be specified for all objects with fontname == "*".
Ben Abbott <bpabbott@mac.com>
parents:
9062
diff
changeset
|
194 endif |
6405 | 195 else |
196 error ("__go_draw_figure__: expecting figure object, found `%s'", | |
10473
169be980faf9
__go_draw_figure__.m: Untabify.
Ben Abbott <bpabbott@mac.com>
parents:
10159
diff
changeset
|
197 htype); |
6405 | 198 endif |
199 else | |
200 print_usage (); | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
201 endif |
6405 | 202 |
203 endfunction | |
204 |