first shot at preview is working

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4483 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-06-25 18:57:41 +00:00
parent 6aa8d56bdd
commit a153642391
2 changed files with 7 additions and 7 deletions

View File

@ -192,10 +192,9 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
ostringstream os;
WriteStream wi(os, false, false);
par_->write(wi);
if (preview(os.str(), preview_) && preview_.get()) {
if (preview(os.str(), preview_)) {
cerr << "image could be drawn\n";
// LyX crashes if we try that. Why? Andre'
//pi.pain.image(x, y, w, h, *(preview_->image()));
pi.pain.image(x + 40, y, 50, 50, *(preview_->image()));
}
#endif

View File

@ -5,6 +5,8 @@
#include "graphics/GraphicsTypes.h"
#include "graphics/GraphicsImage.h"
#include "graphics/GraphicsCache.h"
#include "graphics/GraphicsImage.h"
#include "graphics/GraphicsParams.h"
#include "graphics/GraphicsCacheItem.h"
#include "Lsstream.h"
@ -30,7 +32,7 @@ bool preview(string const & str, grfx::GraphicPtr & graphic)
{
string base = canonical_name(str);
string dir = "/tmp/lyx/";
string file = dir + base + ".ps";
string file = dir + base + ".eps";
cerr << "writing '" << str << "' to '" << file << "'\n";
// get the cache
@ -45,9 +47,8 @@ bool preview(string const & str, grfx::GraphicPtr & graphic)
// is it already loaded?
if (gr->status() == grfx::Loaded) {
cerr << "file '" << file << "' ready for display\n";
cerr << "im: " << graphic.get() << " " << gr.get() << "\n";
graphic = gr;
return true;
return graphic->image()->setPixmap(grfx::GParams());
}
// otherwise we have to wait again
@ -67,7 +68,7 @@ bool preview(string const & str, grfx::GraphicPtr & graphic)
of.close();
string const cmd =
"latex " + base + ".tex ; dvips -o " + base + ".ps " + base + ".dvi ";
"latex " + base + ".tex ; dvips -E -o " + base + ".eps " + base + ".dvi ";
//cerr << "calling: '" << "(cd " + dir + "; " + cmd + ")\n";
Systemcall sc;
sc.startscript(Systemcall::Wait, "(cd " + dir + "; " + cmd + ")");