From a1536423916360273c42dd07058ae2a917141eef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 25 Jun 2002 18:57:41 +0000 Subject: [PATCH] first shot at preview is working git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4483 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/formula.C | 5 ++--- src/mathed/preview.C | 9 +++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 4e8a018387..8d745d9e98 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -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 diff --git a/src/mathed/preview.C b/src/mathed/preview.C index d16d546613..bfb4caabef 100644 --- a/src/mathed/preview.C +++ b/src/mathed/preview.C @@ -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 + ")"); -- 2.39.2