# HG changeset patch # User jwe # Date 1197392259 0 # Node ID c0c6aa5afff45f197cc93dd5993b5ee9f53f84ba # Parent c8d362c69013b0624bd3ee22ea142171fe5d67e4 [project @ 2007-12-11 16:52:56 by jwe] diff -r c8d362c69013 -r c0c6aa5afff4 scripts/ChangeLog --- a/scripts/ChangeLog Tue Dec 11 01:54:19 2007 +0000 +++ b/scripts/ChangeLog Tue Dec 11 16:57:39 2007 +0000 @@ -1,3 +1,8 @@ +2007-12-11 David Bateman + + * plot/__plt_get_axis_arg__.m: Ignore integer valued handles as + object handles are all now non integer. + 2007-12-10 John W. Eaton * plot/sombrero.m, plot/peaks.m: Use surf instead of mesh. diff -r c8d362c69013 -r c0c6aa5afff4 scripts/plot/__plt_get_axis_arg__.m --- a/scripts/plot/__plt_get_axis_arg__.m Tue Dec 11 01:54:19 2007 +0000 +++ b/scripts/plot/__plt_get_axis_arg__.m Tue Dec 11 16:57:39 2007 +0000 @@ -30,7 +30,10 @@ nogca = false; endif - if (nargin > 1 && length (varargin) > 0 && ishandle (varargin{1})) + ## Figure handles are integers, but object handles are non integer, + ## therefore ignore integer scalars. + if (nargin > 1 && length (varargin) > 0 && ishandle (varargin{1}) + && floor(varargin{1}) != varargin{1}) tmp = varargin{1}; obj = get (tmp); if (strcmp (obj.type, "axes") || strcmp (obj.type, "hggroup")) @@ -47,7 +50,7 @@ if (isempty (f)) h = []; else - h = get (f, 'currentaxes'); + h = get (f, "currentaxes"); endif if (isempty (h)) if (nogca) diff -r c8d362c69013 -r c0c6aa5afff4 src/ChangeLog --- a/src/ChangeLog Tue Dec 11 01:54:19 2007 +0000 +++ b/src/ChangeLog Tue Dec 11 16:57:39 2007 +0000 @@ -1,3 +1,12 @@ +2007-12-11 David Bateman + + * graphics.cc (axes::properties::properties): + Initialize xcolor, ycolor, and zcolor to (0, 0, 0). + + * graphics.h.in (gh_manager::next_handle): Now double. + * graphics.cc (gh_manager::get_handle, gh_manager::gh_manager): + Set fractional part of next_handle to a random value. + 2007-12-10 John W. Eaton * ov-cell.cc (octave_cell::all_strings): Handle empty elements. diff -r c8d362c69013 -r c0c6aa5afff4 src/graphics.cc --- a/src/graphics.cc Tue Dec 11 01:54:19 2007 +0000 +++ b/src/graphics.cc Tue Dec 11 16:57:39 2007 +0000 @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -454,7 +455,13 @@ handle_free_list.erase (p); } else - retval = next_handle--; + { + static double maxrand = RAND_MAX + 2.0; + + retval = graphics_handle (next_handle); + + next_handle = trunc (next_handle) - 1.0 - (rand () + 1.0) / maxrand; + } } return retval; @@ -1080,7 +1087,7 @@ } axes::properties::properties (const graphics_handle& mh, - const graphics_handle& p) + const graphics_handle& p) : base_properties (go_name, mh, p), position (Matrix ()), title (octave_NaN), @@ -1120,10 +1127,10 @@ xticklabelmode ("auto"), yticklabelmode ("auto"), zticklabelmode ("auto"), - color (color_values(0, 0, 0), radio_values ("flat|none|interp")), - xcolor (), - ycolor (), - zcolor (), + color (color_values (0, 0, 0), radio_values ("flat|none|interp")), + xcolor (color_values (0, 0, 0)), + ycolor (color_values (0, 0, 0)), + zcolor (color_values (0, 0, 0)), xscale (radio_values ("{linear}|log")), yscale (radio_values ("{linear}|log")), zscale (radio_values ("{linear}|log")), @@ -2556,7 +2563,7 @@ vertices (Matrix ()), facecolor (radio_values ("{flat}|none|interp")), facealpha (1.0), - edgecolor (color_values(0, 0, 0), radio_values ("flat|none|interp")), + edgecolor (color_values (0, 0, 0), radio_values ("flat|none|interp")), linestyle ("-"), linewidth (0.5), marker ("none"), @@ -2753,7 +2760,7 @@ cdata (Matrix ()), facecolor (radio_values ("{flat}|none|interp")), facealpha (1.0), - edgecolor (color_values(0, 0, 0), radio_values ("flat|none|interp")), + edgecolor (color_values (0, 0, 0), radio_values ("flat|none|interp")), linestyle ("-"), linewidth (0.5), marker ("none"), @@ -2946,8 +2953,11 @@ return parent_obj.get_factory_default (type () + name); } +// We use a random value for the handle to avoid issues with plots and +// scalar values for the first argument. gh_manager::gh_manager (void) - : handle_map (), handle_free_list (), next_handle (-1) + : handle_map (), handle_free_list (), + next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)) { handle_map[0] = graphics_object (new root_figure ()); } diff -r c8d362c69013 -r c0c6aa5afff4 src/graphics.h.in --- a/src/graphics.h.in Tue Dec 11 01:54:19 2007 +0000 +++ b/src/graphics.h.in Tue Dec 11 16:57:39 2007 +0000 @@ -2140,7 +2140,7 @@ std::set handle_free_list; // The next handle available if handle_free_list is empty. - graphics_handle next_handle; + double next_handle; // The allocated figure handles. Top of the stack is most recently // created.