Mercurial > octave
annotate scripts/plot/util/private/__opengl_print__.m @ 27918:b442ec6dda5c
use centralized file for copyright info for individual contributors
* COPYRIGHT.md: New file.
* In most other files, use "Copyright (C) YYYY-YYYY The Octave Project
Developers" instead of tracking individual names in separate source
files. The motivation is to reduce the effort required to update the
notices each year.
Until now, the Octave source files contained copyright notices that
list individual contributors. I adopted these file-scope copyright
notices because that is what everyone was doing 30 years ago in the
days before distributed version control systems. But now, with many
contributors and modern version control systems, having these
file-scope copyright notices causes trouble when we update copyright
years or refactor code.
Over time, the file-scope copyright notices may become outdated as new
contributions are made or code is moved from one file to
another. Sometimes people contribute significant patches but do not
add a line claiming copyright. Other times, people add a copyright
notice for their contribution but then a later refactoring moves part
or all of their contribution to another file and the notice is not
moved with the code. As a practical matter, moving such notices is
difficult -- determining what parts are due to a particular
contributor requires a time-consuming search through the project
history. Even managing the yearly update of copyright years is
problematic. We have some contributors who are no longer
living. Should we update the copyright dates for their contributions
when we release new versions? Probably not, but we do still want to
claim copyright for the project as a whole.
To minimize the difficulty of maintaining the copyright notices, I
would like to change Octave's sources to use what is described here:
https://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html
in the section "Maintaining centralized copyright notices":
The centralized notice approach consolidates all copyright
notices in a single location, usually a top-level file.
This file should contain all of the copyright notices
provided project contributors, unless the contribution was
clearly insignificant. It may also credit -- without a copyright
notice -- anyone who helped with the project but did not
contribute code or other copyrighted material.
This approach captures less information about contributions
within individual files, recognizing that the DVCS is better
equipped to record those details. As we mentioned before, it
does have one disadvantage as compared to the file-scope
approach: if a single file is separated from the distribution,
the recipient won't see the contributors' copyright notices.
But this can be easily remedied by including a single
copyright notice in each file's header, pointing to the
top-level file:
Copyright YYYY-YYYY The Octave Project Developers
See the COPYRIGHT file at the top-level directory
of this distribution or at https://octave.org/COPYRIGHT.html.
followed by the usual GPL copyright statement.
For more background, see the discussion here:
https://lists.gnu.org/archive/html/octave-maintainers/2020-01/msg00009.html
Most files in the following directories have been skipped intentinally
in this changeset:
doc
libgui/qterminal
liboctave/external
m4
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 06 Jan 2020 15:38:17 -0500 |
parents | df8942d19b7b |
children | 1891570abac8 |
rev | line source |
---|---|
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27622
diff
changeset
|
1 ## Copyright (C) 2010-2019 The Octave Project Developers |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27622
diff
changeset
|
2 ## |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27622
diff
changeset
|
3 ## See the file COPYRIGHT.md in the top-level directory of this distribution |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27622
diff
changeset
|
4 ## or <https://octave.org/COPYRIGHT.html/>. |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27622
diff
changeset
|
5 ## |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
6 ## |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
7 ## This file is part of Octave. |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
8 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24221
diff
changeset
|
9 ## Octave is free software: you can redistribute it and/or modify it |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
10 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24221
diff
changeset
|
11 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
12 ## (at your option) any later version. |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
13 ## |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
14 ## 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
|
15 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## GNU General Public License for more details. |
10727
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 ## 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
|
20 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24221
diff
changeset
|
21 ## <https://www.gnu.org/licenses/>. |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
22 |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
23 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20778
diff
changeset
|
24 ## @deftypefn {} {} __opengl_print__ (@var{@dots{}}) |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
25 ## Undocumented internal function. |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
26 ## @end deftypefn |
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
27 |
19640
3b0b4d55002d
rename __fltk_print__.m to __opengl_print__.m
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
28 function opts = __opengl_print__ (opts) |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
29 |
11009 | 30 dos_shell = (ispc () && ! isunix ()); |
31 | |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
32 if (! isempty (opts.fig2dev_binary)) |
11009 | 33 ## fig2dev is prefered for conversion to emf |
10854
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
34 fig2dev_devices = {"pstex", "mf", "emf"}; |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
35 else |
d5a7db05d591
Add PS and PDF output for the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10834
diff
changeset
|
36 fig2dev_devices = {"pstex", "mf"}; |
10834
05ba991794d4
Improvements for fltk printing.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
37 endif |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
38 |
11009 | 39 gl2ps_device = {}; |
40 pipeline = {}; | |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11009
diff
changeset
|
41 switch (lower (opts.devopt)) |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
42 case {"eps", "eps2", "epsc", "epsc2"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
43 ## format GL2PS_EPS |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
44 gl2ps_device = {"eps"}; |
17176
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
17174
diff
changeset
|
45 ## FIXME: use epstool to tighten bbox and provide preview. |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
46 pipeline = {opts.epstool_cmd(opts, "-", opts.name)}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
47 case {"epslatex", "pslatex", "pdflatex", "epslatexstandalone", ... |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
48 "pslatexstandalone", "pdflatexstandalone"} |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
49 ## format GL2PS_TEX |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
50 n = find (opts.devopt == "l", 1); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
51 suffix = opts.devopt(1:n-1); |
20444
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
52 [ndir, name, ext] = fileparts (opts.name); |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
53 if (isempty (ext)) |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
54 ext = "tex"; |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
55 else |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
56 ext = ext(2:end); # remove leading '.' |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
57 endif |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
58 if (any (strcmpi (ext, {suffix, "tex"}))) |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
59 name = fullfile (ndir, name); |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
60 if (any (strcmpi (ext, {"eps", "ps", "pdf"}))) |
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
61 suffix = ext; # If user provides eps/ps/pdf suffix, use it. |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
62 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
63 else |
27069
0a62d9a6aa2d
Place Octave's warning and error IDs in to the "Octave" namespace (bug #56213).
Rik <rik@octave.org>
parents:
27068
diff
changeset
|
64 error ("Octave:print:invalid-suffix", |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
65 "invalid suffix '%s' for device '%s'.", |
20444
ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
Rik <rik@octave.org>
parents:
19853
diff
changeset
|
66 ext, lower (opts.devopt)); |
10861 | 67 endif |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
68 gl2ps_device = {sprintf("%snotxt", lower (suffix))}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
69 gl2ps_device{2} = "tex"; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
70 if (dos_shell) |
17176
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
17174
diff
changeset
|
71 ## FIXME: this will only work on MinGW with the MSYS shell |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
72 pipeline = {sprintf('cat > "%s-inc.%s"', name, suffix)}; |
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
73 pipeline{2} = sprintf ('cat > "%s.tex"', name); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
74 else |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
75 pipeline = {sprintf('cat > "%s-inc.%s"', name, suffix)}; |
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
76 pipeline{2} = sprintf ('cat > "%s.tex"', name); |
10913
dd6b90f44ae5
Unify gnuplot printing with the fltk backend.
Ben Abbott <bpabbott@mac.com>
parents:
10864
diff
changeset
|
77 endif |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
78 case "tikz" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
79 ## format GL2PS_PGF |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
80 gl2ps_device = {"pgf"}; |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
81 pipeline = {sprintf('cat > "%s"', opts.name)}; |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
82 case "svg" |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
83 ## format GL2PS_SVG |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
84 gl2ps_device = {"svg"}; |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
85 svgcmd = ""; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
86 if (opts.svgconvert) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
87 svgcmd = opts.svgconvert_cmd (opts, opts.ghostscript.device); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
88 endif |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
89 if (! isempty (svgcmd)) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
90 pipeline = {sprintf(svgcmd, "svg", opts.name)}; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
91 else |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
92 pipeline = {sprintf('cat > "%s"', opts.name)}; |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
93 endif |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
94 case fig2dev_devices |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
95 cmd_fig2dev = opts.fig2dev_cmd (opts, opts.devopt); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
96 if (strcmp (opts.devopt, "pstex")) |
26932
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
97 cmd_pstoedit = opts.pstoedit_cmd (opts, "fig", false); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
98 [~, ~, ext] = fileparts (opts.name); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
99 if (any (strcmpi (ext, {".ps", ".tex", "."}))) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
100 opts.name = opts.name(1:end-numel(ext)); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
101 endif |
20778
8513c84a13cb
Use parser string concatenation rather than strcat() for performance in m-files.
Rik <rik@octave.org>
parents:
20444
diff
changeset
|
102 opts.name = [opts.name ".ps"]; |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
103 cmd = sprintf ('%s | %s > "%s"', cmd_pstoedit, cmd_fig2dev, opts.name); |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
104 gl2ps_device = {"eps"}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
105 pipeline = {cmd}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
106 cmd_fig2dev = opts.fig2dev_cmd (opts, "pstex_t"); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
107 gl2ps_device{2} = "eps"; |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
108 pipeline{2} = sprintf ('%s | %s > "%s"', cmd_pstoedit, |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
109 cmd_fig2dev, strrep(opts.name, ".ps", ".tex")); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
110 else |
26932
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
111 ## Using svgconvert |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
112 tmp = tempname (); |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
113 opts.unlink = [opts.unlink tmp]; |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
114 cmd_pstoedit = sprintf (opts.pstoedit_cmd (opts, "fig"), ... |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
115 "pdf", tmp, tmp); |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
116 cmd = sprintf ('%s | %s > "%s"', cmd_pstoedit, cmd_fig2dev, opts.name); |
26932
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
117 gl2ps_device = {"svg"}; |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
118 pipeline = {cmd}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
119 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
120 case "aifm" |
26932
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
121 tmp = tempname (); |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
122 opts.unlink = [opts.unlink tmp]; |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
123 cmd = sprintf (opts.pstoedit_cmd (opts, "ps2ai"), "pdf", tmp, tmp); |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
124 gl2ps_device = {"svg"}; |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
125 pipeline = {sprintf("%s > %s", cmd, opts.name)}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
126 case {"dxf", "emf", "fig", "hpgl"} |
26932
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
127 tmp = tempname (); |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
128 opts.unlink = [opts.unlink tmp]; |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
129 cmd = sprintf (opts.pstoedit_cmd (opts), "pdf", tmp, tmp); |
aa9745a1114a
Feed fig2dev with PDF files converted from svg (bug #55906)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
26376
diff
changeset
|
130 gl2ps_device = {"svg"}; |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
131 pipeline = {sprintf('%s > "%s"', cmd, opts.name)}; |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
132 case opts.ghostscript.device |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
133 svgcmd = ""; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
134 if (opts.svgconvert) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
135 svgcmd = opts.svgconvert_cmd (opts, opts.ghostscript.device); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
136 endif |
27343
2c9795736894
print.m: Allow "-svgconvert" to be used for EPS output (bug #52764)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27069
diff
changeset
|
137 dosvg = ! isempty (svgcmd); |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
138 if (! dosvg) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
139 opts.ghostscript.source = "-"; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
140 else |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
141 tmp = tempname (); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
142 opts.ghostscript.source = tmp; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
143 opts.unlink = [opts.unlink tmp]; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
144 svgcmd = sprintf (svgcmd, "pdf", tmp); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
145 endif |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
146 |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
147 opts.ghostscript.output = opts.name; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
148 if (opts.send_to_printer) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
149 opts.unlink(strcmp (opts.unlink, opts.ghostscript.output)) = []; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
150 opts.ghostscript.output = "-"; |
11009 | 151 endif |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
152 |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
153 [cmd_gs, cmd_cleanup] = __ghostscript__ (opts.ghostscript); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
154 if (opts.send_to_printer || isempty (opts.name)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
155 cmd_lpr = opts.lpr_cmd (opts); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
156 cmd = sprintf ("%s | %s", cmd_gs, cmd_lpr); |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
157 elseif (dosvg) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
158 if (dos_shell) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
159 cmd = sprintf ("%s & %s", svgcmd, cmd_gs); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
160 else |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
161 cmd = sprintf ("%s ; %s", svgcmd, cmd_gs); |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
162 endif |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
163 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
164 cmd = sprintf ("%s", cmd_gs); |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
165 endif |
26027
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
166 |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
167 if (dosvg) |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
168 gl2ps_device = {"svg"}; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
169 else |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
170 gl2ps_device = {"eps"}; |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
171 endif |
98d7a111786a
Add SVG convertion option for printing to PDF and raster outputs (bug #52193)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25589
diff
changeset
|
172 |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
173 if (! isempty (cmd_cleanup)) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
174 if (dos_shell) |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
175 pipeline = {sprintf("%s & %s", cmd, cmd_cleanup)}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
176 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
177 pipeline = {sprintf("%s ; %s", cmd, cmd_cleanup)}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
178 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
179 else |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
180 pipeline = {cmd}; |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
181 endif |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
182 otherwise |
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
183 error (sprintf ("print:no%soutput", opts.devopt), |
27059
2bf6dcb1563c
Clean up error messages in print subsystem.
Rik <rik@octave.org>
parents:
26934
diff
changeset
|
184 "print: %s output is not available for OpenGL toolkits", |
17174
c3c1ebfaa7dc
maint: Use common indentation for switch statement.
Rik <rik@octave.org>
parents:
17146
diff
changeset
|
185 upper (opts.devopt)); |
10954
ee9d74048827
Consolidate gs code into print.m.
Ben Abbott <bpabbott@mac.com>
parents:
10913
diff
changeset
|
186 endswitch |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
187 |
11009 | 188 opts.pipeline = pipeline; |
189 | |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14552
diff
changeset
|
190 for n = 1:numel (pipeline) |
11009 | 191 if (opts.debug) |
19640
3b0b4d55002d
rename __fltk_print__.m to __opengl_print__.m
John W. Eaton <jwe@octave.org>
parents:
19596
diff
changeset
|
192 fprintf ("opengl-pipeline: '%s'\n", pipeline{n}); |
11009 | 193 endif |
19707
59ad278cfb98
__opengl_print__.m: Use OSMesa for offscreen rendering (Bug #33180)
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19697
diff
changeset
|
194 |
24687
8b935067a257
Allow printing without updating qt visible or invisible figures (bug #52940).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
195 if (strcmp (get (opts.figure, "visible"), "on") |
8b935067a257
Allow printing without updating qt visible or invisible figures (bug #52940).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24638
diff
changeset
|
196 || (strcmp (get (opts.figure, "__graphics_toolkit__"), "qt") |
24798
45470049a43f
Allow getframe and print to work without osmesa (bug #53186).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24687
diff
changeset
|
197 && (strcmp (get (opts.figure, "__gl_window__"), "on") |
24837
ae6679369a80
Rely on QOffscreenSurface functionality rather than its presence (bug #53278)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24798
diff
changeset
|
198 || __have_feature__ ("QT_OFFSCREEN")))) |
19707
59ad278cfb98
__opengl_print__.m: Use OSMesa for offscreen rendering (Bug #33180)
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19697
diff
changeset
|
199 ## Use toolkits "print_figure" method |
27622
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
200 if (ispc () && ! isunix ()) |
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
201 drawnow (gl2ps_device{n}, ['| "' pipeline{n} '"']); |
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
202 else |
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
203 drawnow (gl2ps_device{n}, ["| " pipeline{n}]); |
df8942d19b7b
Allow printing with Octave installed in path with parenthesis (bug #49718)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
27343
diff
changeset
|
204 endif |
19707
59ad278cfb98
__opengl_print__.m: Use OSMesa for offscreen rendering (Bug #33180)
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19697
diff
changeset
|
205 else |
25589
c21edcb90cbf
support for osmesa removed (bug #50479)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
206 error ("print: figure must be visible or qt toolkit must be used with __gl_window__ property 'on' or QT_OFFSCREEN feature available"); |
19707
59ad278cfb98
__opengl_print__.m: Use OSMesa for offscreen rendering (Bug #33180)
Andreas Weber <andy.weber.aw@gmail.com>
parents:
19697
diff
changeset
|
207 endif |
11009 | 208 endfor |
209 | |
12199
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
210 if (! isempty (strfind (opts.devopt, "standalone"))) |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
211 opts.latex_standalone (opts); |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
212 endif |
3fc07861449b
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
Ben Abbott <bpabbott@mac.com>
parents:
11589
diff
changeset
|
213 |
10727
570f30a48732
split printing between backends
Shai Ayal <shaiay@users.sourceforge.net>
parents:
diff
changeset
|
214 endfunction |