# HG changeset patch # User John W. Eaton # Date 1224701871 14400 # Node ID 81b124f463f93f0b7902b2dada3a7686d3b6d818 # Parent 1c213dff76fcd2575b202eda344090b544570fed properly update currentaxes when axes are deleted diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2008-10-22 John W. Eaton + * graphics.cc (figure::properties::remove_child): New function. + * graphics.h.in: Provide decl. + * gl-render.cc (opengl_renderer::draw): Get all children. * DLD-FUNCTIONS/fltk_backend.cc (__fltk_redraw__): diff --git a/src/graphics.cc b/src/graphics.cc --- a/src/graphics.cc +++ b/src/graphics.cc @@ -2026,6 +2026,32 @@ } void +figure::properties::remove_child (const graphics_handle& gh) +{ + base_properties::remove_child (gh); + + if (gh == currentaxes.handle_value ()) + { + graphics_handle new_currentaxes; + + for (octave_idx_type i = 0; i < children.numel (); i++) + { + graphics_handle kid = children(i); + + graphics_object go = gh_manager::get_object (kid); + + if (go.isa ("axes")) + { + new_currentaxes = kid; + break; + } + } + + currentaxes = new_currentaxes; + } +} + +void figure::properties::set_visible (const octave_value& val) { std::string s = val.string_value (); diff --git a/src/graphics.h.in b/src/graphics.h.in --- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -2218,6 +2218,8 @@ class OCTINTERP_API properties : public base_properties { public: + void remove_child (const graphics_handle& h); + void set_visible (const octave_value& val); graphics_backend get_backend (void) const