comparison scripts/plot/orient.m @ 5364:dd230a6f68f6

[project @ 2005-05-23 19:59:53 by jwe]
author jwe
date Mon, 23 May 2005 19:59:53 +0000
parents
children c9c773d8333f
comparison
equal deleted inserted replaced
5363:37f62a7778c2 5364:dd230a6f68f6
1 ## Copyright (C) 2001 Paul Kienzle
2 ##
3 ## This program is free software; you can redistribute it and/or modify
4 ## it under the terms of the GNU General Public License as published by
5 ## the Free Software Foundation; either version 2 of the License, or
6 ## (at your option) any later version.
7 ##
8 ## This program is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ## GNU General Public License for more details.
12 ##
13 ## You should have received a copy of the GNU General Public License
14 ## along with this program; if not, write to the Free Software
15 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
17 ## orient("landscape"|"portrait")
18 ## Set default print orientation
19 ##
20 ## ret = orient
21 ## Return default print orientation
22
23 function ret = orient(orientation)
24
25 static __print_orientation = "landscape";
26
27 if (nargin == 0)
28 ret = __print_orientation;
29
30 elseif (nargin == 1)
31
32 if strcmp(orientation,"landscape") || strcmp(orientation,"portrait")
33 __print_orientation = orientation;
34 else
35 error ("orient: unknown orientation");
36 endif
37
38 else
39
40 usage("orient(['portrait' | 'landscape']) OR ret=orient");
41
42 endif
43
44 endfunction
45
46 %!assert(orient,"landscape") # default
47 %!test orient('portrait')
48 %!assert(orient,"portrait") # change to portrait
49 %!test orient('landscape')
50 %!assert(orient,"landscape") # change to landscape
51 %!fail("orient('nobody')","unknown orientation")
52 %!assert(orient,"landscape") # errors don't change the state