annotate scripts/plot/util/findall.m @ 29359:7854d5752dd2

maint: merge stable to default.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Feb 2021 10:10:40 -0500
parents 5394d688d456 0a5b15007766
children 796f54d4ddbf
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 ##
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27978
diff changeset
3 ## Copyright (C) 2008-2021 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27555
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/>.
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
7 ##
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
8 ## This file is part of Octave.
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24409
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
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: 24409
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: 22532
diff changeset
13 ## (at your option) any later version.
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
14 ##
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22532
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22532
diff changeset
18 ## GNU General Public License for more details.
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
19 ##
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
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: 24409
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 ########################################################################
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
25
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
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: 19697
diff changeset
27 ## @deftypefn {} {@var{h} =} findall ()
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
28 ## @deftypefnx {} {@var{h} =} findall (@var{prop_name}, @var{prop_value}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
29 ## @deftypefnx {} {@var{h} =} findall (@var{prop_name}, @var{prop_value}, "-@var{logical_op}", @var{prop_name}, @var{prop_value})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
30 ## @deftypefnx {} {@var{h} =} findall ("-property", @var{prop_name})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
31 ## @deftypefnx {} {@var{h} =} findall ("-regexp", @var{prop_name}, @var{pattern})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
32 ## @deftypefnx {} {@var{h} =} findall (@var{hlist}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
33 ## @deftypefnx {} {@var{h} =} findall (@var{hlist}, "flat", @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
34 ## @deftypefnx {} {@var{h} =} findall (@var{hlist}, "-depth", @var{d}, @dots{})
24407
5528840346e7 doc: Improve documentation for findobj, findall.
Rik <rik@octave.org>
parents: 23219
diff changeset
35 ## Find graphics object, including hidden ones, with specified properties.
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
36 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
37 ## The return value @var{h} is a list of handles to the found graphic objects.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
38 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
39 ## @code{findall} performs the same search as @code{findobj}, but it
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17238
diff changeset
40 ## includes hidden objects (HandleVisibility = @qcode{"off"}). For full
28959
5394d688d456 doc: Use @code{} within alternate text for @xref,@pxref macros for better Info display.
Rik <rik@octave.org>
parents: 27978
diff changeset
41 ## documentation, @pxref{XREFfindobj,,@code{findobj}}.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
42 ## @seealso{findobj, allchild, get, set}
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
43 ## @end deftypefn
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
44
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
45 function h = findall (varargin)
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
46
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
47 unwind_protect
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
48 shh = get (0, "showhiddenhandles");
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
49 set (0, "showhiddenhandles", "on");
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
50 h = findobj (varargin{:});
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
51 unwind_protect_cleanup
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
52 set (0, "showhiddenhandles", shh);
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
53 end_unwind_protect
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
54
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
55 endfunction
13096
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
56
13977
08ae07e40d4f Only run uimenu tests if FLTK toolkit is available (Bug #34908)
Rik <octave@nomad.inbox5.com>
parents: 13141
diff changeset
57
27555
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
58 %!test
17119
bd50e0660545 test: Add missing semicolons to suppress output in some plot %!tests.
Rik <rik@octave.org>
parents: 17107
diff changeset
59 %! 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
60 %! unwind_protect
13111
ebb42fb2da04 Various fixes for tests in scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 13096
diff changeset
61 %! h = findall (hf);
27555
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
62 %! types = {"uitoolbar"};
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
63 %! htb = uitoolbar (hf);
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
64 %! types = [types {"uimenu", "uimenu", "uimenu", ...
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
65 %! "uimenu", "uimenu", "uimenu"}];
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
66 %! hm1 = uimenu (hf, "label", "menu1", "handlevisibility", "off");
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
67 %! uimenu (hm1, "label", "menu1");
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
68 %! hm2 = uimenu (hf, "label", "menu2", "handlevisibility", "off");
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
69 %! uimenu (hm2, "label", "menu2");
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
70 %! hm3 = uimenu (hf, "label", "menu3");
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
71 %! uimenu (hm3, "label", "menu3");
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
72 %! types = [types {"uipushtool", "uitoggletool", "uipushtool"}];
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
73 %! uipushtool (htb, "handlevisibility", "off");
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
74 %! uitoggletool (htb);
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
75 %! uipushtool (htb);
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
76 %! h = setxor (findall (hf), h);
c2f2fb1df9ed findall.m: Fix failing test after cset d0f778462a51 (bug #55970)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26876
diff changeset
77 %! assert (get (h, "type"), types(:));
13096
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
78 %! unwind_protect_cleanup
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
79 %! close (hf);
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
80 %! end_unwind_protect