mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
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:
parent
6aa8d56bdd
commit
a153642391
@ -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
|
||||
|
||||
|
@ -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 + ")");
|
||||
|
Loading…
Reference in New Issue
Block a user