]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/PreviewImage.cpp
Fix bug #8258 (Zoom of editor doesn't zoom instant preview)
[lyx.git] / src / graphics / PreviewImage.cpp
index ba51f85ce4b41386ff4f15a47f4c7e7784dd146c..5eecfcc48a8f1a7add5a059b1726c9414e48ae10 100644 (file)
 #include <config.h>
 
 #include "PreviewImage.h"
+
+#include "Dimension.h"
 #include "GraphicsImage.h"
 #include "GraphicsLoader.h"
 #include "PreviewLoader.h"
 
 #include "support/FileName.h"
-#include "support/lyxlib.h"
-
-#include <boost/bind.hpp>
 
-using std::string;
+#include "support/bind.h"
 
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
-
-using support::FileName;
-
 namespace graphics {
 
 class PreviewImage::Impl : public boost::signals::trackable {
@@ -74,6 +72,12 @@ string const & PreviewImage::snippet() const
 }
 
 
+support::FileName const & PreviewImage::filename() const
+{
+       return pimpl_->iloader_.filename();
+}
+
+
 Dimension PreviewImage::dim() const
 {
        Dimension dim;
@@ -101,7 +105,8 @@ PreviewImage::Impl::Impl(PreviewImage & p, PreviewLoader & l,
        : parent_(p), ploader_(l), iloader_(bf),
          snippet_(s), ascent_frac_(af)
 {
-       iloader_.connect(boost::bind(&Impl::statusChanged, this));
+       iloader_.setDisplayPixelRatio(l.displayPixelRatio());
+       iloader_.connect(bind(&Impl::statusChanged, this));
 }
 
 
@@ -137,7 +142,10 @@ void PreviewImage::Impl::statusChanged()
        case ErrorUnknown:
                //iloader_.filename().removeFile();
                ploader_.remove(snippet_);
-               break;
+               // FIXME: We need to return here, because PreviewLoader::remove
+               // removes the preview image from the cache, which deletes this
+               // object, so we should not try to do anything here.
+               return;
 
        case Ready:
                iloader_.filename().removeFile();