7050
|
1 ## Copyright (C) 2007 David Bateman |
|
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 |
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
|
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 |
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
|
18 |
|
19 ## Undocumented internal function. |
|
20 |
|
21 function retval = __axes_limits__ (fcn, varargin) |
|
22 retval = []; |
|
23 fcnmode = sprintf("%smode", fcn); |
|
24 |
|
25 if (nargin > 1 && isscalar (varargin{1}) && ishandle (varargin{1})) |
7208
|
26 h = varargin{1}; |
7050
|
27 off = 1; |
|
28 if (! strcmp (get (h, "type"), "axes")) |
|
29 error ("%s: expecting first argument to be an axes object", fcn); |
|
30 endif |
|
31 else |
|
32 off = 0; |
|
33 h = gca (); |
|
34 endif |
|
35 |
|
36 if (nargin == off + 1) |
|
37 retval = get (h, fcn); |
|
38 else |
7208
|
39 arg = varargin{off + 1}; |
7050
|
40 |
|
41 if (ischar (arg)) |
|
42 arg = tolower (arg); |
|
43 if (strcmp ("mode", arg)) |
|
44 |
|
45 retval = get (h, fcnmode); |
|
46 elseif (strcmp ("auto", arg) || strcmp ("manual", arg)) |
|
47 set (h, fcnmode, arg); |
|
48 endif |
|
49 else |
|
50 if (!isnumeric (arg) && any (size(arg(:)) != [2, 1])) |
|
51 error ("%s: argument must be a 2 element vector", fcn); |
|
52 else |
|
53 set (h, fcn, arg (:)); |
|
54 endif |
|
55 endif |
|
56 endif |
|
57 endfunction |