annotate scripts/plot/util/isfigure.m @ 30564:796f54d4ddbf stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021. In all .txi and .texi files except gpl.txi and gpl.texi in the doc/liboctave and doc/interpreter directories, change the copyright to "Octave Project Developers", the same as used for other source files. Update copyright notices for 2022 (not done since 2019). For gpl.txi and gpl.texi, change the copyright notice to be "Free Software Foundation, Inc." and leave the date at 2007 only because this file only contains the text of the GPL, not anything created by the Octave Project Developers. Add Paul Thomas to contributors.in.
author John W. Eaton <jwe@octave.org>
date Tue, 28 Dec 2021 18:22:40 -0500
parents 7854d5752dd2
children 83f9f8bda883
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
3 ## Copyright (C) 2005-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27898
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
7 ##
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
8 ## This file is part of Octave.
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24479
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24479
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## (at your option) any later version.
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
14 ##
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
18 ## GNU General Public License for more details.
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
19 ##
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24479
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
25
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
27 ## @deftypefn {} {} isfigure (@var{h})
17094
60228ef13f20 isfigure.m: Expand to allow matrix inputs and return a logical array.
Rik <rik@octave.org>
parents: 14363
diff changeset
28 ## Return true if @var{h} is a figure graphics handle and false otherwise.
60228ef13f20 isfigure.m: Expand to allow matrix inputs and return a logical array.
Rik <rik@octave.org>
parents: 14363
diff changeset
29 ##
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
30 ## If @var{h} is a matrix then return a logical array which is true where the
21546
f7f97d7e9294 doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents: 20852
diff changeset
31 ## elements of @var{h} are figure graphics handles and false where they are
f7f97d7e9294 doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents: 20852
diff changeset
32 ## not.
24479
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
33 ## @seealso{isaxes, ishghandle, isgraphics}
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
34 ## @end deftypefn
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
35
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
36 function retval = isfigure (h)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
37
28891
de5f2f9a64ff maint: Use same coding style when checking for a minimum of 1 input.
Rik <rik@octave.org>
parents: 28886
diff changeset
38 if (nargin < 1)
17094
60228ef13f20 isfigure.m: Expand to allow matrix inputs and return a logical array.
Rik <rik@octave.org>
parents: 14363
diff changeset
39 print_usage ();
60228ef13f20 isfigure.m: Expand to allow matrix inputs and return a logical array.
Rik <rik@octave.org>
parents: 14363
diff changeset
40 endif
60228ef13f20 isfigure.m: Expand to allow matrix inputs and return a logical array.
Rik <rik@octave.org>
parents: 14363
diff changeset
41
24479
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
42 retval = ishghandle (h);
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
43
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
44 if (any (retval))
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
45 retval(retval) = strcmp (get (h(retval), "type"), "figure");
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
46 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
47
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents:
diff changeset
48 endfunction
13123
6efa1a691713 Add further tests for scripts/plot.
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
49
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
50
13123
6efa1a691713 Add further tests for scripts/plot.
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
51 %!test
13124
2ea1658ad049 Don't use explicit figure number for tests to avoid interference with any figures opened by user.
Kai Habel <kai.habel@gmx.de>
parents: 13123
diff changeset
52 %! hf = figure ("visible", "off");
13141
e81ddf9cacd5 maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 13124
diff changeset
53 %! unwind_protect
13124
2ea1658ad049 Don't use explicit figure number for tests to avoid interference with any figures opened by user.
Kai Habel <kai.habel@gmx.de>
parents: 13123
diff changeset
54 %! assert (isfigure (hf));
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
55 %! assert (! isfigure (-hf));
13123
6efa1a691713 Add further tests for scripts/plot.
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
56 %! unwind_protect_cleanup
6efa1a691713 Add further tests for scripts/plot.
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
57 %! close (hf);
6efa1a691713 Add further tests for scripts/plot.
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
58 %! end_unwind_protect
24479
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
59
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
60 %!test
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
61 %! hf = figure ("visible", "off");
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
62 %! unwind_protect
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
63 %! assert (isfigure ([hf NaN]), [true false]);
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
64 %! unwind_protect_cleanup
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
65 %! close (hf);
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
66 %! end_unwind_protect
6d2dc40a7c00 isaxes.m, isgraphics.m, isfigure.m: Clean up related isXXX graphics functions.
Rik <rik@octave.org>
parents: 24423
diff changeset
67
28886
d8318c12d903 test: remove unnecessary BIST tests in m-files checking for excessive number of inputs.
Rik <rik@octave.org>
parents: 27923
diff changeset
68 %!error <Invalid call> isfigure ()