use external script now.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4495 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-06-27 10:46:19 +00:00
parent 492182feae
commit 9724b8dd78

View File

@ -480,15 +480,14 @@ void InsetFormula::updatePreview() const
os << char('A' + (*it & 15)) << char('a' + (*it >> 4)); os << char('A' + (*it & 15)) << char('a' + (*it >> 4));
string base = os.str(); string base = os.str();
string dir = OnlyPath(lyx::tempName()); string dir = OnlyPath(lyx::tempName());
string file = dir + base + ".eps"; string file = dir + base + ".lyxpreview";
// everything is fine already // everything is fine already
if (loader_.filename() == file) if (loader_.filename() == file)
return; return;
// The real work starts. // the real work starts
string const texfile = dir + base + ".tex"; std::ofstream of(file.c_str());
std::ofstream of(texfile.c_str());
of << "\\batchmode" of << "\\batchmode"
<< "\\documentclass{article}" << "\\documentclass{article}"
<< "\\usepackage{amssymb}" << "\\usepackage{amssymb}"
@ -499,23 +498,6 @@ void InsetFormula::updatePreview() const
<< "\\end{document}\n"; << "\\end{document}\n";
of.close(); of.close();
string const cmd = // now we are done, start actual loading we will get called back via
// "latex " + base + ".tex ; " + " // InsetFormula::statusChanged() if this is finished
// "dvips -x 2500 -R -E -o " + base + ".eps " + base + ".dvi "; loader_.reset(file); }
// Herbert says this is faster
"pdflatex --interaction batchmode " + base + "; " +
"dvips -x 2000 -R -E -o " + base + ".eps " + base + ".dvi ";
//lyxerr << "calling: '" << "(cd " + dir + "; " + cmd + ")\n";
Systemcall sc;
sc.startscript(Systemcall::Wait, "(cd " + dir + "; " + cmd + ")");
// now we are done, start actual loading
loader_.reset(file);
//lyxerr << "file '" << file << "' registered for preview\n";
// clean up a bit
lyx::unlink(dir + base + ".tex");
lyx::unlink(dir + base + ".aux");
lyx::unlink(dir + base + ".dvi");
lyx::unlink(dir + base + ".log");
}