]> git.lyx.org Git - features.git/commitdiff
first shot at preview is working
authorAndré Pönitz <poenitz@gmx.net>
Tue, 25 Jun 2002 18:57:41 +0000 (18:57 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 25 Jun 2002 18:57:41 +0000 (18:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4483 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formula.C
src/mathed/preview.C

index 4e8a018387b8c16cdcd8ff0903cf1a2ab3116c4b..8d745d9e98f2a69617abf6ff42de8fb8bfb60d61 100644 (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
 
index d16d5466131bf677b251ccc58ed9e05501ab4802..bfb4caabef9f6eb9a5a55984de9b82479cfd97fd 100644 (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 + ")");