# HG changeset patch # User David Bateman # Date 1223479767 14400 # Node ID 32e9e8103390532874051b0ce02a79aee279ac93 # Parent ec3a55bd876bfc212580ed8f065b9a6880f9f0f5 Allow arrays of graphic handles to F__go_delete__ diff -r ec3a55bd876b -r 32e9e8103390 src/ChangeLog --- a/src/ChangeLog Wed Oct 08 14:35:33 2008 +0200 +++ b/src/ChangeLog Wed Oct 08 11:29:27 2008 -0400 @@ -1,3 +1,7 @@ +2008-10-07 David Bateman + + * graphics.cc (F__go_delete__): Allow arrays of graphic handles. + 2008-10-01 Jaroslav Hajek * OPERATORS/op-i64-i64.cc: Instantiate all 64-bit operations. diff -r ec3a55bd876b -r 32e9e8103390 src/graphics.cc --- a/src/graphics.cc Wed Oct 08 14:35:33 2008 +0200 +++ b/src/graphics.cc Wed Oct 08 11:29:27 2008 -0400 @@ -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");