# HG changeset patch # User John W. Eaton # Date 1318384959 14400 # Node ID 1e12601d26979545249b23fd58f0a1edbc7ad10b # Parent de081abd32c6a9c2b216d896064f38cc8e62b50d 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. diff -r de081abd32c6 -r 1e12601d2697 src/graphics.cc --- 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 { diff -r de081abd32c6 -r 1e12601d2697 src/graphics.h.in --- a/src/graphics.h.in Tue Oct 11 21:55:21 2011 -0400 +++ b/src/graphics.h.in Tue Oct 11 22:02:39 2011 -0400 @@ -2382,10 +2382,7 @@ virtual bool is_climinclude (void) const { return false; } virtual bool is_aliminclude (void) const { return false; } - bool is_handle_visible (void) const - { - return ! handlevisibility.is ("off"); - } + bool is_handle_visible (void) const; std::set dynamic_property_names (void) const;