7017
|
1 ## Copyright (C) 1996, 1997, 2006, 2007 John W. Eaton |
6257
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
7016
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
6257
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
7016
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
6257
|
18 |
6895
|
19 ## Undocumented internal function. |
6257
|
20 |
|
21 ## Author: jwe |
|
22 |
7215
|
23 function [h, varargin, narg] = __plt_get_axis_arg__ (caller, varargin) |
|
24 |
|
25 if (islogical (caller)) |
|
26 nogca = caller; |
|
27 caller = varargin{1}; |
|
28 varargin(1) = []; |
|
29 else |
|
30 nogca = false; |
|
31 endif |
6257
|
32 |
7286
|
33 ## Figure handles are integers, but object handles are non integer, |
|
34 ## therefore ignore integer scalars. |
|
35 if (nargin > 1 && length (varargin) > 0 && ishandle (varargin{1}) |
|
36 && floor(varargin{1}) != varargin{1}) |
6257
|
37 tmp = varargin{1}; |
6925
|
38 obj = get (tmp); |
7215
|
39 if (strcmp (obj.type, "axes") || strcmp (obj.type, "hggroup")) |
|
40 h = ancestor (tmp, "axes"); |
6925
|
41 varargin(1) = []; |
|
42 if (isempty (varargin)) |
|
43 varargin = {}; |
6257
|
44 endif |
|
45 else |
6925
|
46 error ("%s: expecting first argument to be axes handle", caller); |
6257
|
47 endif |
6925
|
48 else |
7215
|
49 f = get (0, "currentfigure"); |
7216
|
50 if (isempty (f)) |
|
51 h = []; |
|
52 else |
7286
|
53 h = get (f, "currentaxes"); |
7216
|
54 endif |
|
55 if (isempty (h)) |
|
56 if (nogca) |
|
57 h = NaN; |
|
58 else |
|
59 h = gca (); |
|
60 endif |
7215
|
61 endif |
6927
|
62 if (nargin < 2) |
|
63 varargin = {}; |
|
64 endif |
6257
|
65 endif |
|
66 |
7215
|
67 narg = length (varargin); |
|
68 |
6257
|
69 endfunction |