diff src/graphics.cc @ 13327:f81fcceb394c

axes: only update the currentaxes property of the parent figure if the axes object is visible * graphics.cc (F__is_handle_visible__): New function. is_handle_visible (const graphics_handle&)): New function. is_handle_visible (double): New function. is_handle_visible (const octave_valueu&)): New function. * axes.m: Only set currentaxes property in parent and currentfigure property in root if axes object is visible.
author John W. Eaton <jwe@octave.org>
date Wed, 12 Oct 2011 11:18:12 -0400
parents 1e12601d2697
children 22ce748da25f
line wrap: on
line diff
--- a/src/graphics.cc	Wed Oct 12 10:38:21 2011 -0400
+++ b/src/graphics.cc	Wed Oct 12 11:18:12 2011 -0400
@@ -7666,6 +7666,59 @@
   return retval;
 }
 
+static bool
+is_handle_visible (const graphics_handle& h)
+{
+  return h.ok () && gh_manager::is_handle_visible (h);
+}
+
+static bool
+is_handle_visible (double val)
+{
+  return is_handle_visible (gh_manager::lookup (val));
+}
+
+static octave_value
+is_handle_visible (const octave_value& val)
+{
+  octave_value retval = false;
+
+  if (val.is_real_scalar () && is_handle_visible (val.double_value ()))
+    retval = true;
+  else if (val.is_numeric_type () && val.is_real_type ())
+    {
+      const NDArray handles = val.array_value ();
+
+      if (! error_state)
+        {
+          boolNDArray result (handles.dims ());
+
+          for (octave_idx_type i = 0; i < handles.numel (); i++)
+            result.xelem (i) = is_handle_visible (handles (i));
+
+          retval = result;
+        }
+    }
+
+  return retval;
+}
+
+DEFUN (__is_handle_visible__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} __is_handle_visible__ (@var{h})\n\
+Undocumented internal function.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    retval = is_handle_visible (args(0));
+  else
+    print_usage ();
+
+  return retval;
+}
+
 DEFUN (reset, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} reset (@var{h}, @var{property})\n\