5364
|
1 ## Copyright (C) 2001 Paul Kienzle |
|
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 |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## 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. |
5364
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
5365
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
5364
|
19 |
5365
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} orient (@var{orientation}) |
|
22 ## Set default print orientation. Valid values for @var{orientation} |
|
23 ## include @code{"landscape"} and @code{"portrait"}. If called with no |
|
24 ## arguments, return the default print orientation. |
|
25 ## @end deftypefn |
5364
|
26 |
5365
|
27 ## Author: Paul Kienzle |
|
28 ## Adapted-By: jwe |
5364
|
29 |
5365
|
30 ## PKG_ADD: mark_as_command orient |
|
31 |
|
32 function retval = orient (orientation) |
|
33 |
|
34 static __print_orientation__ = "landscape"; |
5364
|
35 |
|
36 if (nargin == 0) |
5365
|
37 retval = __print_orientation__; |
5364
|
38 elseif (nargin == 1) |
5365
|
39 if (strcmp (orientation, "landscape") || strcmp (orientation, "portrait")) |
|
40 __print_orientation__ = orientation; |
5364
|
41 else |
|
42 error ("orient: unknown orientation"); |
|
43 endif |
|
44 else |
5365
|
45 usage("orient ([\"portrait\"|\"landscape\"]) OR ret = orient ()"); |
5364
|
46 endif |
|
47 |
|
48 endfunction |
|
49 |
|
50 %!assert(orient,"landscape") # default |
|
51 %!test orient('portrait') |
|
52 %!assert(orient,"portrait") # change to portrait |
|
53 %!test orient('landscape') |
|
54 %!assert(orient,"landscape") # change to landscape |
|
55 %!fail("orient('nobody')","unknown orientation") |
|
56 %!assert(orient,"landscape") # errors don't change the state |