mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
adjust xfig conversion to newer xfig as suggested by Jean-Pierre at
http://www.lyx.org/trac/ticket/3016#comment:6 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36972 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
77a8eb9288
commit
94160f97c0
@ -2588,7 +2588,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
if (!tex_name.empty())
|
||||
filename = tex_name;
|
||||
}
|
||||
bool xfig = false;
|
||||
bool external = false;
|
||||
string outname;
|
||||
if (makeAbsPath(filename, path).exists()) {
|
||||
string const abstexname =
|
||||
@ -2600,20 +2600,53 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
fix_relative_filename(filename);
|
||||
string const lyxname =
|
||||
changeExtension(filename, ".lyx");
|
||||
if (t.cs() == "input" && FileName(absfigname).exists()) {
|
||||
bool xfig = false;
|
||||
external = FileName(absfigname).exists();
|
||||
if (t.cs() == "input") {
|
||||
string const ext = getExtension(abstexname);
|
||||
|
||||
// Combined PS/LaTeX:
|
||||
// x.eps, x.pstex_t (old xfig)
|
||||
// x.pstex, x.pstex_t (new xfig, e.g. 3.2.5)
|
||||
FileName const absepsname(
|
||||
changeExtension(abstexname, ".eps"));
|
||||
FileName const abspstexname(
|
||||
changeExtension(abstexname, ".pstex"));
|
||||
bool const xfigeps =
|
||||
(absepsname.exists() ||
|
||||
abspstexname.exists()) &&
|
||||
ext == "pstex_t";
|
||||
|
||||
// Combined PDF/LaTeX:
|
||||
// x.pdf, x.pdftex_t (old xfig)
|
||||
// x.pdf, x.pdf_t (new xfig, e.g. 3.2.5)
|
||||
FileName const abspdfname(
|
||||
changeExtension(abstexname, ".pdf"));
|
||||
string const ext = getExtension(abstexname);
|
||||
bool const xfigpdf =
|
||||
abspdfname.exists() && ext == "pdftex_t";
|
||||
bool const xfigeps =
|
||||
absepsname.exists() && ext == "pstex_t";
|
||||
xfig = xfigpdf || xfigeps;
|
||||
abspdfname.exists() &&
|
||||
(ext == "pdftex_t" || ext == "pdf_t");
|
||||
|
||||
// Combined PS/PDF/LaTeX:
|
||||
// x_pspdftex.eps, x_pspdftex.pdf, x.pspdftex
|
||||
string const absbase2(
|
||||
removeExtension(abstexname) + "_pspdftex");
|
||||
FileName const abseps2name(
|
||||
addExtension(absbase2, ".eps"));
|
||||
FileName const abspdf2name(
|
||||
addExtension(absbase2, ".pdf"));
|
||||
bool const xfigboth =
|
||||
abspdf2name.exists() &&
|
||||
abseps2name.exists() && ext == "pspdftex";
|
||||
|
||||
xfig = xfigpdf || xfigeps || xfigboth;
|
||||
external = external && xfig;
|
||||
}
|
||||
if (xfig) {
|
||||
if (external) {
|
||||
outname = changeExtension(filename, ".fig");
|
||||
} else if (xfig) {
|
||||
// Don't try to convert, the result
|
||||
// would be full of ERT.
|
||||
outname = filename;
|
||||
} else if (t.cs() != "verbatiminput" &&
|
||||
tex2lyx(abstexname, FileName(abslyxname),
|
||||
p.getEncoding())) {
|
||||
@ -2626,7 +2659,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
<< filename << "'." << endl;
|
||||
outname = filename;
|
||||
}
|
||||
if (xfig) {
|
||||
if (external) {
|
||||
begin_inset(os, "External\n");
|
||||
os << "\ttemplate XFig\n"
|
||||
<< "\tfilename " << outname << '\n';
|
||||
|
Loading…
Reference in New Issue
Block a user