Mercurial > hg > octave-lyh
annotate scripts/plot/orient.m @ 8920:eb63fbe60fab
update copyright notices
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 07 Mar 2009 10:41:27 -0500 |
parents | 5dd06f19e9be |
children | cd0c4a5a12c8 |
rev | line source |
---|---|
8920 | 1 ## Copyright (C) 2001, 2005, 2006, 2007, 2008, 2009 Paul Kienzle |
5364 | 2 ## |
5365 | 3 ## This file is part of Octave. |
5364 | 4 ## |
5365 | 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. | |
5365 | 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. | |
5364 | 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/>. | |
5364 | 18 |
5365 | 19 ## -*- texinfo -*- |
20 ## @deftypefn {Function File} {} orient (@var{orientation}) | |
6895 | 21 ## Set the default print orientation. Valid values for |
22 ## @var{orientation} include @code{"landscape"} and @code{"portrait"}. | |
23 ## If called with no arguments, return the default print orientation. | |
5365 | 24 ## @end deftypefn |
5364 | 25 |
5365 | 26 ## Author: Paul Kienzle |
27 ## Adapted-By: jwe | |
5364 | 28 |
6257 | 29 function retval = orient (varargin) |
5365 | 30 |
6257 | 31 nargs = nargin; |
5364 | 32 |
8248 | 33 if (nargs > 0 && numel (varargin{1}) == 1 && isfigure (varargin{1})) |
6257 | 34 cf = varargin{1}; |
35 varargin(1) = []; | |
36 nargs--; | |
37 else | |
38 cf = gcf (); | |
39 endif | |
40 | |
41 if (nargs == 0) | |
42 retval = get (cf, "paperorientation"); | |
5364 | 43 elseif (nargin == 1) |
6257 | 44 orientation = varargin{1}; |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
8189
diff
changeset
|
45 if (strcmpi (orientation, "landscape") || strcmpi (orientation, "portrait")) |
6257 | 46 set (cf, "paperorientation", orientation) |
5364 | 47 else |
48 error ("orient: unknown orientation"); | |
49 endif | |
50 else | |
6046 | 51 print_usage (); |
5364 | 52 endif |
53 | |
54 endfunction | |
55 | |
6441 | 56 %!shared |
57 %! set (gcf (), "visible", "off") | |
6257 | 58 %!assert(orient,"portrait") # default |
59 %!test orient('landscape') | |
60 %!assert(orient,"landscape") # change to landscape | |
5364 | 61 %!test orient('portrait') |
62 %!assert(orient,"portrait") # change to portrait | |
63 %!fail("orient('nobody')","unknown orientation") | |
6257 | 64 %!assert(orient,"portrait") # errors don't change the state |