diff src/graphics.cc @ 13324:1e12601d2697

make handles with their handlevisibility property set to "callback" visible in callback functions * graphics.cc (executing_callback): New file scope variable. (callback_property::execute): Protect executing_callback and set it to true when executing callback function. * graphics.cc (base_properties::is_handle_visible): Move here from graphics.h.in. Check executing_callback to decide whether handles that have their handlevisibility property set to "callback" should be visible.
author John W. Eaton <jwe@octave.org>
date Tue, 11 Oct 2011 22:02:39 -0400
parents de081abd32c6
children f81fcceb394c
line wrap: on
line diff
--- a/src/graphics.cc	Tue Oct 11 21:55:21 2011 -0400
+++ b/src/graphics.cc	Tue Oct 11 22:02:39 2011 -0400
@@ -1387,6 +1387,11 @@
   return false;
 }
 
+// If TRUE, we are executing any callback function, or the functions it
+// calls.  Used to determine handle visibility inside callback
+// functions.
+static bool executing_callback = false;
+
 void
 callback_property::execute (const octave_value& data) const
 {
@@ -1397,9 +1402,14 @@
   // callback routines.
   frame.protect_var (executing);
 
+  // We are executing a callback function, so allow handles that have
+  // their handlevisibility property set to "callback" to be visible.
+  frame.protect_var (executing_callback);
+
   if (! executing)
     {
       executing = true;
+      executing_callback = true;
 
       if (callback.is_defined () && ! callback.is_empty ())
         gh_manager::execute_callback (get_parent (), callback, data);
@@ -2448,6 +2458,13 @@
     obj.update_axis_limits (axis_type, h);
 }
 
+bool
+base_properties::is_handle_visible (void) const
+{
+  return (handlevisibility.is ("on")
+          || executing_callback && ! handlevisibility.is ("off"));
+}
+
 graphics_toolkit
 base_properties::get_toolkit (void) const
 {