Mercurial > hg > octave-lyh
annotate scripts/plot/graphics_toolkit.m @ 12482:3244c6e0af4a
polynomial/polyval.m: Compute offset/normalization only when needed.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sat, 26 Feb 2011 16:21:02 -0500 |
parents | 68ac95d2460c |
children | fb5955171b0b |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2008-2011 Michael Goffioul |
8060
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 ## |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 ## |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 ## your option) any later version. |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 ## |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 ## General Public License for more details. |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 ## |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
20 ## @deftypefn {Function File} {} graphics_toolkit (@var{name}) |
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
21 ## @deftypefnx {Function File} {} graphics_toolkit (@var{hlist}, @var{name}) |
12344
68ac95d2460c
Periodic grammarcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents:
11576
diff
changeset
|
22 ## Change the default graphics toolkit to @var{name}. If the |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
23 ## toolkit is not already loaded, it is first initialized by calling the |
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
24 ## function @code{__init_@var{name}__}. |
8060
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 ## |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
26 ## When called with a list of figure handles, @var{hlist}, the graphics |
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
27 ## toolkit is changed only for the listed figures. |
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
28 ## @seealso{available_graphics_toolkits} |
8060
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 ## @end deftypefn |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
31 function graphics_toolkit (varargin) |
8060
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 name = ""; |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 hlist = []; |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 if (nargin == 1) |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 if (ischar (varargin{1})) |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 name = varargin{1}; |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 else |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
40 error ("graphics_toolkit: invalid graphics toolkit NAME"); |
8060
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 endif |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 elseif (nargin == 2) |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 if (isnumeric (varargin{1}) && ischar (varargin{2})) |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 hlist = varargin{1}; |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 name = varargin{2}; |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 elseif (ischar (varargin{2})) |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
47 error ("graphics_toolkit: invalid handle list"); |
8060
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 else |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
49 error ("graphics_toolkit: invalid graphics toolkit NAME"); |
8060
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 endif |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 else |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 print_usage (); |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 endif |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
55 if (! any (strcmp (available_graphics_toolkits (), name))) |
8060
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 feval (["__init_", name, "__"]); |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
57 if (! any (strcmp (available_graphics_toolkits (), name))) |
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
58 error ("graphics_toolkit: %s toolkit was not correctly registered", |
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
59 name); |
8060
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
60 endif |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
61 endif |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 if (isempty (hlist)) |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
64 set (0, "defaultfigure__graphics_toolkit__", name); |
8060
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
65 else |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
66 for h = hlist(:)' |
11576
8ac9687dbe9f
rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
67 set (h, "__graphics_toolkit__", name); |
8060
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
68 endfor |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
69 endif |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
70 |
09f32aac8fbc
Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 endfunction |