diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-12-20 John W. Eaton + + * graphics.cc (graphics_handle::is_visible): New function. + * graphics.h.in: Provide decl. + * DLD-FUNCTIONS/fltk_backend.cc (figure_manager::do_update_canvas): + Don't show canvas if it is invisible. + 2012-12-17 Konstantinos Poulios * graphics.h.in (class axes::properties): Tag xtickmode, ytickmode diff --git a/src/DLD-FUNCTIONS/fltk_backend.cc b/src/DLD-FUNCTIONS/fltk_backend.cc --- a/src/DLD-FUNCTIONS/fltk_backend.cc +++ b/src/DLD-FUNCTIONS/fltk_backend.cc @@ -827,12 +827,12 @@ break; } - if (uimenu->items_to_show ()) - show_menubar (); - else - hide_menubar (); + if (uimenu->items_to_show () && figp.is_visible ()) + show_menubar (); + else + hide_menubar (); - mark_modified(); + mark_modified(); } } @@ -1635,7 +1635,7 @@ wm_iterator win; if ((win = windows.find (idx)) != windows.end ()) { - if (ca.ok ()) + if (ca.is_visible ()) win->second->show_canvas (); else win->second->hide_canvas (); diff --git a/src/graphics.cc b/src/graphics.cc --- a/src/graphics.cc +++ b/src/graphics.cc @@ -759,6 +759,34 @@ // --------------------------------------------------------------------- +// An object is visible if its "visible" property is "on" and all its +// parents are also visible. + +bool +graphics_handle::is_visible (void) const +{ + if (ok ()) + { + graphics_object go = gh_manager::get_object (*this); + + if (go) + { + base_properties& go_props = go.get_properties (); + + if (go_props.is_visible ()) + { + graphics_handle gh = go.get_parent (); + + return gh.ok () ? gh.is_visible () : true; + } + else + return false; + } + } + + return false; +} + bool base_property::set (const octave_value& v, bool do_run ) { diff --git a/src/graphics.h.in b/src/graphics.h.in --- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -110,6 +110,8 @@ bool ok (void) const { return ! xisnan (val); } + bool is_visible (void) const; + private: double val; };