# HG changeset patch # User John W. Eaton # Date 1461958436 14400 # Node ID 6b5f90d9a10b34cf58d359395488da7323092748 # Parent c32590cd0080b1e1c7d8ed2347a349b8e7a0fcd2 allow close to accept a column vector or matrix of handles * graphics.cc (F__go_execute_callback__): Handle array of handles. * close.m: Pass array of figure handles to __go_execute_callback__ instead of using a loop. diff -r c32590cd0080 -r 6b5f90d9a10b libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Fri Apr 29 18:43:08 2016 +1000 +++ b/libinterp/corefcn/graphics.cc Fri Apr 29 15:33:56 2016 -0400 @@ -10527,19 +10527,24 @@ if (nargin < 2 || nargin > 3) print_usage (); - double val = args(0).xdouble_value ("__go_execute_callback__: invalid graphics object"); - - graphics_handle h = gh_manager::lookup (val); - - if (! h.ok ()) - error ("__go_execute_callback__: invalid graphics object (= %g)", val); + const NDArray vals = args(0).xarray_value ("__go_execute_callback__: invalid graphics object"); std::string name = args(1).xstring_value ("__go_execute_callback__: invalid callback name"); - if (nargin == 2) - gh_manager::execute_callback (h, name); - else - gh_manager::execute_callback (h, name, args(2)); + for (octave_idx_type i = 0; i < vals.numel (); i++) + { + double val = vals(i); + + graphics_handle h = gh_manager::lookup (val); + + if (! h.ok ()) + error ("__go_execute_callback__: invalid graphics object (= %g)", val); + + if (nargin == 2) + gh_manager::execute_callback (h, name); + else + gh_manager::execute_callback (h, name, args(2)); + } return ovl (); } diff -r c32590cd0080 -r 6b5f90d9a10b scripts/plot/util/close.m --- a/scripts/plot/util/close.m Fri Apr 29 18:43:08 2016 +1000 +++ b/scripts/plot/util/close.m Fri Apr 29 15:33:56 2016 -0400 @@ -92,9 +92,7 @@ error ('close: second argument must be "hidden" or "force"'); endif - for h = figs - __go_execute_callback__ (h, "closerequestfcn"); - endfor + __go_execute_callback__ (figs, "closerequestfcn"); if (nargout > 0) retval = 1;