changeset 10920:91ff0d7ee94b

Don't pass figure handle to __calc_dimensions__.
author Ben Abbott <bpabbott@mac.com>
date Fri, 27 Aug 2010 21:06:04 -0400
parents 2a3279d11794
children 56f9c10e9e98
files scripts/ChangeLog scripts/plot/__go_draw_axes__.m scripts/plot/colorbar.m scripts/plot/private/__actual_axis_position__.m
diffstat 4 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Aug 27 20:06:19 2010 -0400
+++ b/scripts/ChangeLog	Fri Aug 27 21:06:04 2010 -0400
@@ -1,5 +1,8 @@
 2010-08-27  Ben Abbott <bpabbott@mac.com>
 
+	* plot/colorbar.m, * plot/__go_draw_axes__.m,
+	plot/private/__actual_axis_position__.m: Don't pass figure handle to
+	__calc_dimensions__.
 	* plot/private/__ghostscript__.m: Don't set anti-aliasing options for
 	vector formats.
 	* plot/__print_parse_opts__.m: Fix tests.
--- a/scripts/plot/__go_draw_axes__.m	Fri Aug 27 20:06:19 2010 -0400
+++ b/scripts/plot/__go_draw_axes__.m	Fri Aug 27 21:06:04 2010 -0400
@@ -48,7 +48,7 @@
     nd = __calc_dimensions__ (h);
 
     if (strcmpi (axis_obj.plotboxaspectratiomode, "manual"))
-      pos = __actual_axis_position__ (axis_obj);
+      pos = __actual_axis_position__ (h);
     else
       pos = axis_obj.position;
     endif
--- a/scripts/plot/colorbar.m	Fri Aug 27 20:06:19 2010 -0400
+++ b/scripts/plot/colorbar.m	Fri Aug 27 21:06:04 2010 -0400
@@ -107,6 +107,7 @@
 
   if (! deleting)
     obj = get (ax);
+    obj.__my_handle__ = ax;
     position = obj.position;
     clen = rows (get (get (ax, "parent"), "colormap"));
     cext = get (ax, "clim");
@@ -220,6 +221,7 @@
       (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off")))
     loc = get (cax, "location");
     obj = get (h);
+    obj.__my_handle__ = h;
     obj.position = orig_props.position;
     obj.outerposition = orig_props.outerposition;
     [pos, cpos, vertical, mirror] =  ...
--- a/scripts/plot/private/__actual_axis_position__.m	Fri Aug 27 20:06:19 2010 -0400
+++ b/scripts/plot/private/__actual_axis_position__.m	Fri Aug 27 21:06:04 2010 -0400
@@ -24,14 +24,18 @@
 
 ## Author: Ben Abbott
 
-function pos = __actual_axis_position__ (axis_obj)
-  if (ishandle (axis_obj))
-    axis_obj = get (axis_obj);
+function pos = __actual_axis_position__ (h)
+
+  if (ishandle (h))
+    axis_obj = get (h);
+  elseif (isstruct (h))
+    axis_obj = h;
+    h = axis_obj.__my_handle__;
   endif
 
   ## When using {rltb}margin, Gnuplot does not handle the specified
   ## aspect ratio properly, so handle it here.
-  if (__calc_dimensions__ (axis_obj.parent) == 2
+  if (__calc_dimensions__ (h) == 2
       || all (mod (axis_obj.view, 90) == 0))
     aspect_ratio_2d = axis_obj.plotboxaspectratio(1:2);
   else