]> git.lyx.org Git - lyx.git/blobdiff - src/insets/render_graphic.C
convert graphics for .tex export, fixes bug 1231
[lyx.git] / src / insets / render_graphic.C
index 72639def888fc6cd809a3552e895cb2c1c3f9e2e..31d4605b117778504a61b4afb6e48a546a2712fc 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "gettext.h"
 #include "LColor.h"
+#include "lyx_main.h"
 #include "lyxrc.h"
 #include "metricsinfo.h"
 
@@ -26,6 +27,8 @@
 
 #include "support/filetools.h"
 
+#include <boost/bind.hpp>
+
 namespace graphics = lyx::graphics;
 
 using lyx::support::AbsolutePath;
@@ -35,22 +38,27 @@ using std::string;
 using std::auto_ptr;
 
 
-RenderGraphic::RenderGraphic()
-       : checksum_(0)
-{}
+RenderGraphic::RenderGraphic(InsetBase const * inset)
+{
+       loader_.connect(boost::bind(&LyX::updateInset,
+                                   boost::cref(LyX::cref()), inset));
+}
 
 
-RenderGraphic::RenderGraphic(RenderGraphic const & other)
+RenderGraphic::RenderGraphic(RenderGraphic const & other,
+                            InsetBase const * inset)
        : RenderBase(other),
          loader_(other.loader_),
-         params_(other.params_),
-         checksum_(0)
-{}
+         params_(other.params_)
+{
+       loader_.connect(boost::bind(&LyX::updateInset,
+                                   boost::cref(LyX::cref()), inset));
+}
 
 
-auto_ptr<RenderBase> RenderGraphic::clone() const
+auto_ptr<RenderBase> RenderGraphic::clone(InsetBase const * inset) const
 {
-       return auto_ptr<RenderBase>(new RenderGraphic(*this));
+       return auto_ptr<RenderBase>(new RenderGraphic(*this, inset));
 }
 
 
@@ -65,22 +73,6 @@ void RenderGraphic::update(graphics::Params const & params)
 }
 
 
-bool RenderGraphic::hasFileChanged() const
-{
-       unsigned long const new_checksum = loader_.checksum();
-       bool const file_has_changed = checksum_ != new_checksum;
-       if (file_has_changed)
-               checksum_ = new_checksum;
-       return file_has_changed;
-}
-
-
-boost::signals::connection RenderGraphic::connect(slot_type const & slot) const
-{
-       return loader_.connect(slot);
-}
-
-
 namespace {
 
 bool displayGraphic(graphics::Params const & params)
@@ -88,7 +80,7 @@ bool displayGraphic(graphics::Params const & params)
        return params.display != graphics::NoDisplay &&
                lyxrc.display_graphics != graphics::NoDisplay;
 }
-       
+
 
 string const statusMessage(graphics::Params const & params,
                           graphics::ImageStatus status)