X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Frender_graphic.C;h=31d4605b117778504a61b4afb6e48a546a2712fc;hb=5603df4a5b7e511b31026c9a4f8f55b2b10fde57;hp=72639def888fc6cd809a3552e895cb2c1c3f9e2e;hpb=29e3a03b63e2821889f9124d4d977c8cb9119d1d;p=lyx.git diff --git a/src/insets/render_graphic.C b/src/insets/render_graphic.C index 72639def88..31d4605b11 100644 --- a/src/insets/render_graphic.C +++ b/src/insets/render_graphic.C @@ -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 + 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 RenderGraphic::clone() const +auto_ptr RenderGraphic::clone(InsetBase const * inset) const { - return auto_ptr(new RenderGraphic(*this)); + return auto_ptr(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)