Mercurial > hg > octave-lyh
diff src/graphics.cc @ 8196:32e9e8103390
Allow arrays of graphic handles to F__go_delete__
author | David Bateman <dbateman@free.fr> |
---|---|
date | Wed, 08 Oct 2008 11:29:27 -0400 |
parents | 277218396978 |
children | f6ca8ff51818 |
line wrap: on
line diff
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -4419,32 +4419,40 @@ { graphics_handle h = octave_NaN; - double val = args(0).double_value (); + const NDArray vals = args (0).array_value (); if (! error_state) { - h = gh_manager::lookup (val); - - if (h.ok ()) + for (octave_idx_type i = 0; i < vals.numel (); i++) { - graphics_object obj = gh_manager::get_object (h); - - graphics_handle parent_h = obj.get_parent (); - - graphics_object parent_obj = gh_manager::get_object (parent_h); - - // NOTE: free the handle before removing it from its parent's - // children, such that the object's state is correct when - // the deletefcn callback is executed - - gh_manager::free (h); - - parent_obj.remove_child (h); - - Vdrawnow_requested = true; + h = gh_manager::lookup (vals.elem (i)); + + if (h.ok ()) + { + graphics_object obj = gh_manager::get_object (h); + + graphics_handle parent_h = obj.get_parent (); + + graphics_object parent_obj = + gh_manager::get_object (parent_h); + + // NOTE: free the handle before removing it from its parent's + // children, such that the object's state is correct + // when the deletefcn callback is executed + + gh_manager::free (h); + + parent_obj.remove_child (h); + + Vdrawnow_requested = true; + } + else + { + error ("delete: invalid graphics object (= %g)", + vals.elem (i)); + break; + } } - else - error ("delete: invalid graphics object (= %g)", val); } else error ("delete: invalid graphics object");