Mercurial > octave
changeset 21838:30d4645ecb98
close.m: Allow 'force' argument with figure handles (bug #48173).
* close.m: Update docstring to mention new usage. Update input validation to
always allow a figure handle or 'all' as the first argument. Update BIST
tests.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 08 Jun 2016 12:40:17 -0700 |
parents | 3ef630a564f8 |
children | 6b4f6339df91 |
files | scripts/plot/util/close.m |
diffstat | 1 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/close.m Wed Jun 08 12:14:39 2016 -0700 +++ b/scripts/plot/util/close.m Wed Jun 08 12:40:17 2016 -0700 @@ -18,8 +18,9 @@ ## -*- texinfo -*- ## @deftypefn {} {} close +## @deftypefnx {} {} close @var{h} ## @deftypefnx {} {} close (@var{h}) -## @deftypefnx {} {} close @var{h} +## @deftypefnx {} {} close (@var{h}, "force") ## @deftypefnx {} {} close all ## @deftypefnx {} {} close all hidden ## @deftypefnx {} {} close all force @@ -35,9 +36,8 @@ ## If the argument @qcode{"all hidden"} is given then all figures, including ## hidden ones, are closed. ## -## If the argument @qcode{"all force"} is given then all figures are closed -## even when @qcode{"closerequestfcn"} has been altered to prevent closing -## the window. +## If the argument @qcode{"force"} is given then figures are closed even when +## @qcode{"closerequestfcn"} has been altered to prevent closing the window. ## ## Implementation Note: @code{close} operates by calling the function specified ## by the @qcode{"closerequestfcn"} property for each figure. By default, the @@ -81,8 +81,12 @@ if (ischar (arg1) && strcmpi (arg1, "all")) figs = (allchild (0))'; figs = figs(isfigure (figs)); + elseif (any (isfigure (arg1))) + figs = arg1(isfigure (arg1)); + elseif (isempty (arg1)) + figs = []; # Silently accept null argument for Matlab compatibility else - error ('close: first argument must be "all" with "hidden" or "force"'); + error ('close: first argument must be "all" or a figure handle'); endif if (strcmpi (arg2, "force")) delete (figs); @@ -118,8 +122,6 @@ %!error <first argument must be "all" or a figure> close ({"all"}) %!error <first argument must be "all" or a figure> close ("all_and_more") %!error <first argument must be "all" or a figure> close (-1) -%!error <first argument must be "all" with "hidden"> close foo hidden -%!error <first argument must be "all" with "hidden"> close foo force %!error <second argument must be "hidden"> close all hid %!error <second argument must be "hidden"> close all for