Mercurial > hg > octave-lyh
changeset 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 | ec3a55bd876b |
children | 4c85b8056d0b |
files | src/ChangeLog src/graphics.cc |
diffstat | 2 files changed, 33 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2008-10-07 David Bateman <dbateman@free.fr> + + * graphics.cc (F__go_delete__): Allow arrays of graphic handles. + 2008-10-01 Jaroslav Hajek <highegg@gmail.com> * OPERATORS/op-i64-i64.cc: Instantiate all 64-bit operations.
--- 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");