Mercurial > hg > octave-nkf
annotate scripts/plot/__print_parse_opts__.m @ 11113:a8ac114ec9ab
Stylefixes, replace end by endif.
author | Thorsten Meyer <thorsten.meyier@gmx.de> |
---|---|
date | Mon, 18 Oct 2010 20:40:12 +0200 |
parents | d81b6144c4ba |
children | a44f979a35ce |
rev | line source |
---|---|
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
1 ## Copyright (C) 2008, 2009 David Bateman |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
2 ## |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
4 ## |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
8 ## your option) any later version. |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
9 ## |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
13 ## General Public License for more details. |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
14 ## |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
18 |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
20 ## @deftypefn {Function File} {[@var{x}, @var{y}, @var{buttons}] =} ginput (@var{n}) |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
21 ## Return which mouse buttons were pressed and keys were hit on the current |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
22 ## figure. If @var{n} is defined, then wait for @var{n} mouse clicks |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
23 ## before returning. If @var{n} is not defined, then @code{ginput} will |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
24 ## loop until the return key is pressed. |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
25 ## @end deftypefn |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
26 |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
27 function arg_st = __print_parse_opts__ (varargin) |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
28 |
11009 | 29 persistent warn_on_missing_binary = true |
30 | |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
31 arg_st.append_to_file = false; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
32 arg_st.canvas_size = []; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
33 arg_st.debug = false; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
34 arg_st.debug_file = "octave-print-commands.log"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
35 arg_st.devopt = ""; |
11009 | 36 arg_st.epstool_binary = __quote_path__ (__find_binary__ ("epstool")); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
37 arg_st.figure = get (0, "currentfigure"); |
10889
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
38 arg_st.fig2dev_binary = __quote_path__ (__find_binary__ ("fig2dev")); |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
39 arg_st.fontsize = ""; |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
40 arg_st.font = ""; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
41 arg_st.force_solid = 0; # 0=default, -1=dashed, +1=solid |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
42 arg_st.formatted_for_printing = false; |
10889
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
43 arg_st.ghostscript.binary = __quote_path__ (__ghostscript_binary__ ()); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
44 arg_st.ghostscript.debug = false; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
45 arg_st.ghostscript.device = ""; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
46 arg_st.ghostscript.epscrop = true; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
47 arg_st.ghostscript.level = []; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
48 arg_st.ghostscript.output = ""; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
49 arg_st.ghostscript.papersize = ""; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
50 arg_st.ghostscript.pageoffset = []; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
51 arg_st.ghostscript.resolution = 150; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
52 arg_st.ghostscript.antialiasing = false; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
53 arg_st.loose = false; |
11009 | 54 arg_st.lpr_binary = __quote_path__ (__find_binary__ ("lpr")); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
55 arg_st.name = ""; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
56 arg_st.orientation = ""; |
10889
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
57 arg_st.pstoedit_binary = __quote_path__ (__find_binary__ ("pstoedit")); |
11009 | 58 arg_st.preview = ""; |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
59 arg_st.printer = ""; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
60 arg_st.send_to_printer = false; |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
61 arg_st.special_flag = "textnormal"; |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
62 arg_st.tight_flag = false; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
63 arg_st.use_color = 0; # 0=default, -1=mono, +1=color |
11009 | 64 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
65 if (isunix ()) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
66 arg_st.lpr_options = "-l"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
67 elseif (ispc ()) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
68 arg_st.lpr_options = "-o l"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
69 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
70 arg_st.lpr_options = ""; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
71 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
72 arg_st.unlink = {}; |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
73 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
74 for i = 1:nargin |
11009 | 75 arg = strtrim (varargin{i}); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
76 if (ischar (arg)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
77 if (strcmp (arg, "-color")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
78 arg_st.use_color = 1; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
79 elseif (strcmp (arg, "-append")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
80 arg_st.append_to_file = true; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
81 elseif (strcmp (arg, "-mono")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
82 arg_st.use_color = -1; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
83 elseif (strcmp (arg, "-solid")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
84 arg_st.force_solid = 1; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
85 elseif (strcmp (arg, "-dashed")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
86 arg_st.force_solid = -1; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
87 elseif (strncmp (arg, "-portrait", numel (arg))) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
88 arg_st.orientation = "portrait"; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
89 elseif (strncmp (arg, "-landscape", numel (arg))) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
90 arg_st.orientation = "landscape"; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
91 elseif (strcmp (arg, "-loose")) |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
92 arg_st.loose = true; |
11027
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
93 arg_st.tight_flag = false; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
94 elseif (strcmp (arg, "-tight")) |
11027
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
95 arg_st.loose = false; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
96 arg_st.tight_flag = true; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
97 elseif (strcmp (arg, "-textspecial")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
98 arg_st.special_flag = "textspecial"; |
11009 | 99 elseif (any (strcmp (arg, {"-interchange", "-metafile", "-pict", "-tiff"}))) |
100 arg_st.preview = arg(2:end); | |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
101 elseif (strncmp (arg, "-debug", 6)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
102 arg_st.debug = true; |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
103 arg_st.ghostscript.debug = true; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
104 if (length (arg) > 7) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
105 arg_st.debug_file = arg(8:end); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
106 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
107 elseif (length (arg) > 2 && arg(1:2) == "-d") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
108 arg_st.devopt = tolower (arg(3:end)); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
109 elseif (length (arg) > 2 && arg(1:2) == "-P") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
110 arg_st.printer = arg; |
11009 | 111 elseif (strncmp (arg, "-EPSTOOL:", 9)) |
112 arg_st.epstool_binary = arg{10:end}; | |
113 elseif (strncmp (arg, "-FIG2DEV:", 9)) | |
114 arg_st.fig2dev_binary = arg{10:end}; | |
115 elseif (strncmp (arg, "-PSTOEDIT:", 9)) | |
116 arg_st.pstoedit_binary = arg{10:end}; | |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
117 elseif ((length (arg) > 2) && arg(1:2) == "-G") |
10889
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
118 arg_st.ghostscript.binary = file_in_path (EXEC_PATH, arg(3:end)); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
119 if (isempty (arg_st.ghostscript.binary)) |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
120 error ("print: Ghostscript binary ""%s"" could not be located", |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
121 arg(3:end)) |
10889
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
122 else |
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
123 arg_st.ghostscript_binary = __quote_path__ (arg_st.ghostscript_binary); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
124 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
125 elseif (length (arg) > 2 && arg(1:2) == "-F") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
126 idx = rindex (arg, ":"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
127 if (idx) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
128 arg_st.font = arg(3:idx-1); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
129 arg_st.fontsize = str2num (arg(idx+1:end)); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
130 else |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
131 arg_st.font = arg(3:end); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
132 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
133 elseif (length (arg) > 2 && arg(1:2) == "-S") |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
134 arg_st.canvas_size = str2num (arg(3:end)); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
135 elseif (length (arg) > 2 && arg(1:2) == "-r") |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
136 arg_st.ghostscript.resolution = arg(3:end); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
137 elseif (length (arg) > 2 && arg(1:2) == "-f") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
138 arg_st.figure = str2num (arg(3:end)); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
139 elseif (length (arg) >= 1 && arg(1) == "-") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
140 error ("print: unknown option `%s'", arg); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
141 elseif (length (arg) > 0) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
142 arg_st.name = arg; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
143 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
144 elseif (isfigure (arg)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
145 arg_st.figure = arg; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
146 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
147 error ("print: expecting inputs to be character string options or a figure handle"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
148 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
149 endfor |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
150 |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
151 if (arg_st.ghostscript.resolution == 0) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
152 ## Do as Matlab does. |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
153 arg_st.ghostscript.resolution = num2str (get (0, "screenpixelsperinch")); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
154 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
155 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
156 if (isempty (arg_st.orientation)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
157 if (isfigure (arg_st.figure)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
158 arg_st.orientation = get (arg_st.figure, "paperorientation"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
159 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
160 ## Allows tests to be run without error. |
10861 | 161 arg_st.orientation = "portrait"; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
162 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
163 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
164 |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
165 if (isempty (arg_st.ghostscript.binary)) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
166 arg_st.ghostscript.binary = __ghostscript_binary__ (); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
167 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
168 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
169 dot = rindex (arg_st.name, "."); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
170 if (isempty (arg_st.devopt)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
171 if (dot == 0) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
172 arg_st.devopt = "psc"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
173 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
174 arg_st.devopt = tolower (arg_st.name(dot+1:end)); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
175 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
176 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
177 |
10918
811f8611995d
__print_parse_opts__.m: Fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
178 if (arg_st.use_color == 0) |
811f8611995d
__print_parse_opts__.m: Fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
179 if (any (strcmp ({"ps", "ps2", "eps", "eps2"}, arg_st.devopt))) |
811f8611995d
__print_parse_opts__.m: Fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
180 arg_st.use_color = -1; |
811f8611995d
__print_parse_opts__.m: Fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
181 else |
811f8611995d
__print_parse_opts__.m: Fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
182 arg_st.use_color = 1; |
811f8611995d
__print_parse_opts__.m: Fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
183 endif |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
184 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
185 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
186 if (strcmp (arg_st.devopt, "tex")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
187 arg_st.devopt = "epslatex"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
188 elseif (strcmp (arg_st.devopt, "ill")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
189 arg_st.devopt = "aifm"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
190 elseif (strcmp (arg_st.devopt, "cdr")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
191 arg_st.devopt = "corel"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
192 elseif (strcmp (arg_st.devopt, "meta")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
193 arg_st.devopt = "emf"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
194 elseif (strcmp (arg_st.devopt, "jpg")) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
195 arg_st.devopt = "jpeg"; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
196 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
197 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
198 dev_list = {"aifm", "corel", "fig", "png", "jpeg", ... |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
199 "gif", "pbm", "pbmraw", "dxf", "mf", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
200 "svg", "hpgl", "ps", "ps2", "psc", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
201 "psc2", "eps", "eps2", "epsc", "epsc2", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
202 "emf", "pdf", "pslatex", "epslatex", "epslatexstandalone", ... |
10861 | 203 "pslatexstandalone", "pdflatexstandalone", ... |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
204 "pstex", "tiff", "tiffn" "tikz", "pcxmono", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
205 "pcx24b", "pcx256", "pcx16", "pgm", "pgmraw", ... |
11009 | 206 "ppm", "ppmraw", "pdflatex", "texdraw", ... |
11022
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
207 "pdfcairo", "pngcairo", "pstricks", ... |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
208 "epswrite", "pswrite", "ps2write", "pdfwrite"}; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
209 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
210 suffixes = {"ai", "cdr", "fig", "png", "jpg", ... |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
211 "gif", "pbm", "pbm", "dxf", "mf", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
212 "svg", "hpgl", "ps", "ps", "ps", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
213 "ps", "eps", "eps", "eps", "eps", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
214 "emf", "pdf", "tex", "tex", "tex", ... |
10861 | 215 "tex", "tex", ... |
10876
53ec464300ef
__print_parse_opts__.m: Default pstex suffix should be '.ps'.
Ben Abbott <bpabbott@mac.com>
parents:
10862
diff
changeset
|
216 "ps", "tiff", "tiff", "tikz", "pcx", ... |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
217 "pcx", "pcx", "pcx", "pgm", "pgm", ... |
11009 | 218 "ppm", "ppm", "tex", "tex", ... |
11022
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
219 "pdf", "png", "tex", ... |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
220 "eps", "ps", "ps", "pdf"}; |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
221 |
11027
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
222 if (isfigure (arg_st.figure)) |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
223 __backend__ = get (arg_st.figure, "__backend__"); |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
224 else |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
225 ## Allow tests when no figures are present. |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
226 __backend__ = get (0, "defaultfigure__backend__"); |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
227 endif |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
228 |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
229 if (strcmp (__backend__, "gnuplot") |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
230 && __gnuplot_has_feature__ ("epslatex_implies_eps_filesuffix")) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
231 suffixes(strncmp (dev_list, "epslatex", 8)) = {"eps"}; |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
232 endif |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
233 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
234 match = strcmpi (dev_list, arg_st.devopt); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
235 if (any (match)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
236 default_suffix = suffixes {match}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
237 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
238 default_suffix = arg_st.devopt; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
239 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
240 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
241 if (dot == 0 && ! isempty (arg_st.name)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
242 arg_st.name = strcat (arg_st.name, ".", default_suffix); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
243 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
244 |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
245 if (arg_st.append_to_file) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
246 if (isempty (arg_st.name)) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
247 arg_st.append_to_file = false; |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
248 elseif (any (strcmpi (arg_st.devopt, {"eps", "eps2", "epsc", "epsc2", ... |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
249 "ps", "ps2", "psc", "psc2", "pdf"}))) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
250 have_ghostscript = ! isempty (__ghostscript_binary__ ()); |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
251 if (have_ghostscript) |
11009 | 252 file_exists = ((numel (dir (arg_st.name)) == 1) |
253 && (! isdir (arg_st.name))); | |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
254 if (! file_exists) |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
255 arg_st.append_to_file = false; |
11113
a8ac114ec9ab
Stylefixes, replace end by endif.
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
11031
diff
changeset
|
256 endif |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
257 else |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
258 arg_st.append_to_file = false; |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
259 warning ("print.m: appended output requires ghostscript to be installed.") |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
260 endif |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
261 else |
11009 | 262 warning ("print.m: appended output is not supported for device '%s'", |
263 arg_st.devopt) | |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
264 arg_st.append_to_file = false; |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
265 endif |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
266 endif |
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
267 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
268 if (! isempty (arg_st.printer) || isempty (arg_st.name)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
269 arg_st.send_to_printer = true; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
270 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
271 |
11022
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
272 if (any (strcmp (arg_st.devopt, {"ps", "ps2", "psc", "psc2", "pdf"}))) |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
273 arg_st.formatted_for_printing = true; |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
274 endif |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
275 |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
276 aliases = gs_aliases (); |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
277 if (any (strcmp (arg_st.devopt, fieldnames (aliases)))) |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
278 arg_st.devopt = aliases.(arg_st.devopt); |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
279 endif |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
280 |
11022
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
281 ## FIXME - eps2 & epsc2 needs to be handled |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
282 if (strcmp (arg_st.devopt, "pswrite")) |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
283 arg_st.ghostscript.level = 1; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
284 elseif (strcmp (arg_st.devopt, "ps2write")) |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
285 arg_st.ghostscript.level = 2; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
286 endif |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
287 |
11022
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
288 if ((any (strcmp (arg_st.devopt, gs_device_list)) |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
289 && ! arg_st.formatted_for_printing) |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
290 || any (strcmp (arg_st.devopt, {"pswrite", "ps2write", "pdfwrite"}))) |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
291 ## Use ghostscript for graphic formats |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
292 arg_st.ghostscript.device = arg_st.devopt; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
293 arg_st.ghostscript.output = arg_st.name; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
294 arg_st.ghostscript.antialiasing = true; |
11027
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
295 if (arg_st.formatted_for_printing) |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
296 arg_st.ghostscript.epscrop = ! arg_st.loose; |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
297 else |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
298 ## pstoedit throws errors if the EPS file isn't cropped |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
299 arg_st.ghostscript.epscrop = true; |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
300 endif |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
301 elseif (all (! strcmp (arg_st.devopt, dev_list))) |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
302 ## Assume we are formating output for a printer |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
303 arg_st.formatted_for_printing = true; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
304 arg_st.ghostscript.device = arg_st.devopt; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
305 arg_st.ghostscript.output = arg_st.name; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
306 arg_st.ghostscript.antialiasing = false; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
307 arg_st.ghostscript.epscrop = ! arg_st.loose; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
308 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
309 |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
310 if (isempty (arg_st.canvas_size)) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
311 if (isfigure (arg_st.figure)) |
11009 | 312 [arg_st.ghostscript.papersize, paperposition] = ... |
313 gs_papersize (arg_st.figure, arg_st.orientation); | |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
314 else |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
315 ## allows tests to be run |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
316 arg_st.ghostscript.papersize = "letter"; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
317 paperposition = [0.25, 2.50, 8.00, 6.00] * 72; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
318 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
319 arg_st.canvas_size = paperposition(3:4); |
11027
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
320 if (strcmp (__backend__, "gnuplot") && ! arg_st.ghostscript.epscrop) |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
321 arg_st.ghostscript.pageoffset = paperposition(1:2) - 50; |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
322 else |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
323 arg_st.ghostscript.pageoffset = paperposition(1:2); |
a2bdd9180a3c
__print_parse_opts__.m: Properly crop eps image and fix tests.
Ben Abbott <bpabbott@mac.com>
parents:
11022
diff
changeset
|
324 endif |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
325 else |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
326 ## Convert canvas size to points from pixles. |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
327 arg_st.canvas_size = arg_st.canvas_size * 72 / arg_st.ghostscript.resolution; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
328 arg_st.ghostscript.papersize = arg_st.canvas_size; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
329 arg_st.ghostscript.epscrop = true; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
330 arg_st.ghostscript.pageoffset = [0, 0]; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
331 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
332 |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
333 if (arg_st.formatted_for_printing) |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
334 arg_st.ghostscript.resolution = []; |
11009 | 335 else |
336 arg_st.ghostscript.papersize = ""; | |
337 arg_st.ghostscript.pageoffset = [0, 0]; | |
338 endif | |
339 | |
340 if (warn_on_missing_binary) | |
341 if (isempty (arg_st.ghostscript.binary)) | |
342 warning ("print:missinggs", "print.m: Ghostscript binary is not available.") | |
343 endif | |
344 if (isempty (arg_st.epstool_binary)) | |
345 warning ("print:missinggs", "print.m: epstool binary is not available.") | |
346 endif | |
347 if (isempty (arg_st.fig2dev_binary)) | |
348 warning ("print:missinggs", "print.m: fig2dev binary is not available.") | |
349 endif | |
350 if (isempty (arg_st.pstoedit_binary)) | |
351 warning ("print:missinggs", "print.m: pstoedit binary is not available.") | |
352 endif | |
353 warn_on_missing_binary = false; | |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
354 endif |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
355 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
356 endfunction |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
357 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
358 %!test |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
359 %! opts = __print_parse_opts__ (); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
360 %! assert (opts.devopt, "pswrite"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
361 %! assert (opts.use_color, 1); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
362 %! assert (opts.send_to_printer, true); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
363 %! assert (opts.canvas_size, [576, 432]); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
364 %! assert (opts.ghostscript.device, "pswrite") |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
365 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
366 %!test |
10861 | 367 %! opts = __print_parse_opts__ ("test.pdf", "-S640,480"); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
368 %! assert (opts.canvas_size, [307.2, 230.4], 0.1); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
369 |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
370 %!test |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
371 %! opts = __print_parse_opts__ ("-dpsc", "-append", "-loose"); |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
372 %! assert (opts.devopt, "pswrite"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
373 %! assert (opts.send_to_printer, true); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
374 %! assert (opts.use_color, 1); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
375 %! assert (opts.append_to_file, false); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
376 %! assert (opts.ghostscript.device, "pswrite") |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
377 %! assert (opts.ghostscript.epscrop, false); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
378 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
379 %!test |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
380 %! opts = __print_parse_opts__ ("-deps", "-tight"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
381 %! assert (opts.tight_flag, true); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
382 %! assert (opts.send_to_printer, true); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
383 %! assert (opts.use_color, -1); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
384 %! assert (opts.ghostscript.device, "") |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
385 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
386 %!test |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
387 %! opts = __print_parse_opts__ ("-djpg", "foobar", "-mono", "-loose"); |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
388 %! assert (opts.devopt, "jpeg") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
389 %! assert (opts.name, "foobar.jpg") |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
390 %! assert (opts.ghostscript.device, "jpeg") |
11031
d81b6144c4ba
__print_parse_opts__.m: Fix test.
Ben Abbott <bpabbott@mac.com>
parents:
11027
diff
changeset
|
391 %! assert (opts.ghostscript.epscrop, true); |
11009 | 392 %! assert (opts.ghostscript.papersize, ""); |
393 %! assert (opts.ghostscript.pageoffset, [0, 0]); | |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
394 %! assert (opts.send_to_printer, false); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
395 %! assert (opts.printer, ""); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
396 %! assert (opts.use_color, -1); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
397 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
398 %!test |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
399 %! opts = __print_parse_opts__ ("-ddeskjet", "foobar", "-mono", "-Pmyprinter"); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
400 %! assert (opts.ghostscript.output, "foobar.deskjet") |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
401 %! assert (opts.ghostscript.device, "deskjet") |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
402 %! assert (opts.devopt, "deskjet") |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
403 %! assert (opts.send_to_printer, true); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
404 %! assert (opts.printer, "-Pmyprinter"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
405 %! assert (opts.use_color, -1); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
406 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
407 %!test |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
408 %! opts = __print_parse_opts__ ("-f5", "-dljet3"); |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
409 %! assert (opts.ghostscript.device, "ljet3") |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
410 %! assert (strfind (opts.ghostscript.output, ".ljet3")) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
411 %! assert (opts.devopt, "ljet3") |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
412 %! assert (opts.send_to_printer, true); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
413 %! assert (opts.figure, 5) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
414 |
10889
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
415 function cmd = __quote_path__ (cmd) |
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
416 if (any (cmd == " ") && ! (cmd(1) == """" && cmd(end) == """")) |
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
417 cmd = strcat ("""", strrep (cmd, """", """"""), """"); |
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
418 endif |
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
419 endfunction |
1d7a7fb5074b
__print_parse_opts__.m: Double quote paths with spaces.
Ben Abbott <bpabbott@mac.com>
parents:
10876
diff
changeset
|
420 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
421 function gs = __ghostscript_binary__ () |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
422 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
423 persistent ghostscript_binary = "" |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
424 persistent warn_on_no_ghostscript = true |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
425 persistent warn_on_bad_gsc = true |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
426 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
427 if (isempty (ghostscript_binary)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
428 GSC = getenv ("GSC"); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
429 if (exist (GSC, "file") || (! isempty (GSC) && file_in_path (EXEC_PATH, GSC))) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
430 gs_binaries = {GSC}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
431 elseif (! isempty (GSC) && warn_on_bad_gsc) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
432 warning ("print:badgscenv", |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
433 "print.m: GSC environment variable not set properly.") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
434 warn_on_bad_gsc = false; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
435 gs_binaries = {}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
436 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
437 gs_binaries = {}; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
438 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
439 if (isunix ()) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
440 ## Unix - Includes Mac OSX and Cygwin. |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
441 gs_binaries = horzcat (gs_binaries, {"gs", "gs.exe"}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
442 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
443 ## pc - Includes Win32 and mingw. |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
444 gs_binaries = horzcat (gs_binaries, {"gs.exe", "gswin32c.exe"}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
445 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
446 n = 0; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
447 while (n < numel (gs_binaries) && isempty (ghostscript_binary)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
448 n = n + 1; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
449 ghostscript_binary = file_in_path (EXEC_PATH, gs_binaries{n}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
450 endwhile |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
451 if (warn_on_no_ghostscript && isempty (ghostscript_binary)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
452 warning ("print:noghostscript", |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
453 "print.m: ghostscript not found in EXEC_PATH.") |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
454 warn_on_no_ghostscript = false; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
455 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
456 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
457 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
458 gs = ghostscript_binary; |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
459 |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
460 endfunction |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
461 |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
462 function bin = __find_binary__ (binary) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
463 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
464 persistent data = struct () |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
465 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
466 if (! isfield (data, binary)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
467 ## Reinitialize when `user_binaries' is present. |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
468 data.(binary).bin = ""; |
10862
337db4e1342d
Warn on absence of fig2dev/pstoedit only when needed.
Ben Abbott <bpabbott@mac.com>
parents:
10861
diff
changeset
|
469 data.(binary).warn_on_absence = false; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
470 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
471 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
472 if (isempty (data.(binary).bin)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
473 if (isunix ()) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
474 ## Unix - Includes Mac OSX and Cygwin. |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
475 binaries = strcat (binary, {"", ".exe"}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
476 else |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
477 ## pc - Includes Win32 and mingw. |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
478 binaries = strcat (binary, {".exe"}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
479 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
480 n = 0; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
481 while (n < numel (binaries) && isempty (data.(binary).bin)) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
482 n = n + 1; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
483 data.(binary).bin = file_in_path (EXEC_PATH, binaries{n}); |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
484 endwhile |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
485 if (isempty (data.(binary).bin) && data.(binary).warn_on_absence) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
486 warning (sprintf ("print:no%s", binary), |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
487 "print.m: '%s' not found in EXEC_PATH", binary) |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
488 data.(binary).warn_on_absence = false; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
489 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
490 endif |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
491 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
492 bin = data.(binary).bin; |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
493 |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
494 endfunction |
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
495 |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
496 function [papersize, paperposition] = gs_papersize (hfig, paperorientation) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
497 persistent papertypes papersizes |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10727
diff
changeset
|
498 |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
499 if (isempty (papertypes)) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
500 papertypes = {"usletter", "uslegal", "a0", "a1", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
501 "a2", "a3", "a4", "a5", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
502 "b0", "b1", "b2", "b3", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
503 "b4", "b5", "arch-a", "arch-b", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
504 "arch-c", "arch-d", "arch-e", "a", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
505 "b", "c", "d", "e", ... |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
506 "tabloid"}; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
507 papersizes = [ 8.5, 11.0; 8.5, 14.0; 33.1, 46.8; 23.4, 33.1; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
508 16.5, 23.4; 11.7, 16.5; 8.3, 11.7; 5.8, 8.3; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
509 39.4, 55.7; 27.8, 39.4; 19.7, 27.8; 13.9, 19.7; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
510 9.8, 13.9; 6.9, 9.8; 9.0, 12.0; 12.0, 18.0; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
511 18.0, 24.0; 24.0, 36.0; 36.0, 48.0; 8.5, 11.0; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
512 11.0, 17.0; 18.0, 24.0; 24.0, 36.0; 36.0, 48.0; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
513 11.0, 17.0] * 72; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
514 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
515 |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
516 papertype = get (hfig, "papertype"); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
517 paperunits = get (hfig, "paperunits"); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
518 paperposition = get (hfig, "paperposition"); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
519 if (strcmp (papertype, "<custom>")) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
520 papersize = get (hfig, "papersize"); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
521 papersize = convert2points (papersize , paperunits); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
522 else |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
523 papersize = papersizes (strcmp (papertypes, papertype), :); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
524 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
525 |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
526 if (strcmp (paperunits, "normalized")) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
527 paperposition = paperposition .* papersize([1,2,1,2]); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
528 else |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
529 paperposition = convert2points (paperposition, paperunits); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
530 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
531 |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
532 ## FIXME - This will be obsoleted by listeners for paper properties. |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10889
diff
changeset
|
533 ## Papersize is tall when portrait,and wide when landscape. |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
534 if ((papersize(1) > papersize(2) && strcmpi (paperorientation, "portrait")) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
535 || (papersize(1) < papersize(2) && strcmpi (paperorientation, "landscape"))) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
536 papersize = papersize ([2,1]); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
537 paperposition = paperposition([2,1,4,3]); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
538 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
539 |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
540 if ((! strcmp (papertype, "<custom>")) && (strcmp (paperorientation, "portrait"))) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
541 ## For portrait use the ghostscript name |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
542 papersize = papertype; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
543 papersize(papersize=="-") = ""; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
544 papersize = strrep (papersize, "us", ""); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
545 switch papersize |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
546 case "a" |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
547 papersize = "letter"; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
548 case {"b", "tabloid"} |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
549 papersize = "11x17"; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
550 case {"c", "d", "e"} |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
551 papersize = strcat ("arch", papersize); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
552 endswitch |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
553 if (strncmp (papersize, "arch", 4)) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
554 papersize(end) = upper (papersize(end)); |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
555 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
556 endif |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
557 |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
558 endfunction |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
559 |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
560 function value = convert2points (value, units) |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
561 switch units |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
562 case {"inches"} |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
563 value = value * 72; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
564 case {"centimeters"} |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
565 value = value * 72 / 25.4; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
566 case {"normalized"} |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
567 error ("print:customnormalized", |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
568 "print.m: papersize=='<custom>' and paperunits='normalized' may not be combined.") |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
569 endswitch |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
570 endfunction |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
571 |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
572 function device_list = gs_device_list (); |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
573 ## Graphics formats/languages, not priners. |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
574 device_list = {"bmp16"; "bmp16m"; "bmp256"; "bmp32b"; "bmpgray"; ... |
11022
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
575 "epswrite"; "jpeg"; "jpegcymk"; "jpeggray"; "pbm"; ... |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
576 "pbmraw"; "pcx16"; "pcx24b"; "pcx256"; "pcx2up"; ... |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
577 "pcxcmyk"; "pcxgray"; "pcxmono"; "pdfwrite"; "pgm"; ... |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
578 "pgmraw"; "pgnm"; "pgnmraw"; "png16"; "png16m"; ... |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
579 "png256"; "png48"; "pngalpha"; "pnggray"; "pngmono"; ... |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
580 "pnm"; "pnmraw"; "ppm"; "ppmraw"; "ps2write"; ... |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
581 "pswrite"; "tiff12nc"; "tiff24nc"; "tiff32nc"; ... |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
582 "tiffcrle"; "tiffg3"; "tiffg32d"; "tiffg4"; ... |
a5bee81bb69f
__print_parse_opts__.m: Recongize gs devices {eps/pdf/ps}write.
Ben Abbott <bpabbott@mac.com>
parents:
11009
diff
changeset
|
583 "tiffgray"; "tifflzw"; "tiffpack"; "tiffsep"}; |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
584 endfunction |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
585 |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
586 function aliases = gs_aliases (); |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
587 ## Aliases for other devices: "bmp", "png", "tiff", "tiffn", "pdf", |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
588 ## "ps", "ps2", "psc", "psc2" |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
589 ## |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
590 ## eps, epsc, eps2, epsc2 are not included here because those are |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
591 ## are generated by the backend. |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
592 aliases.bmp = "bmp32b"; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
593 aliases.pdf = "pdfwrite"; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
594 aliases.png = "png16m"; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
595 aliases.ps = "pswrite"; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
596 aliases.ps2 = "ps2write"; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
597 aliases.psc = "pswrite"; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
598 aliases.psc2 = "ps2write"; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
599 aliases.tiff = "tiff24nc"; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
600 aliases.tiffn = "tiff24nc"; |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
601 endfunction |
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10918
diff
changeset
|
602 |