#include "support/lassert.h"
#include "support/lstrings.h"
-#include "support/bind.h"
-
using namespace std;
using namespace lyx::support;
RenderPreview::RenderPreview(RenderPreview const & other,
Inset const * inset)
: RenderBase(other),
- boost::signals2::trackable(),
snippet_(other.snippet_),
parent_(inset)
{}
-RenderPreview::~RenderPreview()
-{
- if (ploader_connection_.connected())
- ploader_connection_.disconnect();
-}
-
-
RenderBase * RenderPreview::clone(Inset const * inset) const
{
return new RenderPreview(*this, inset);
return message;
}
-} // namespace anon
+} // namespace
graphics::PreviewImage const *
void RenderPreview::addPreview(docstring const & latex_snippet,
- Buffer const & buffer,
+ Buffer const & buffer,
bool ignore_lyxrc)
{
if (lyxrc.preview == LyXRC::PREVIEW_OFF && !ignore_lyxrc)
void RenderPreview::addPreview(docstring const & latex_snippet,
- graphics::PreviewLoader & ploader,
+ graphics::PreviewLoader & ploader,
bool ignore_lyxrc)
{
if (lyxrc.preview == LyXRC::PREVIEW_OFF && !ignore_lyxrc)
// If this is the first time of calling, connect to the
// PreviewLoader signal that'll inform us when the preview image
// is ready for loading.
- if (!ploader_connection_.connected()) {
- ploader_connection_ = ploader.connect(
- bind(&RenderPreview::imageReady, this, _1));
- }
+ if (!ploader_connection_.connected())
+ // This is a scoped connection.
+ ploader_connection_ =
+ ploader.connect([this](graphics::PreviewImage const & pi){
+ imageReady(pi);
+ });
ploader.add(snippet_);
}
}
-boost::signals2::connection
-RenderMonitoredPreview::connect(ChangedSig::slot_type const & slot)
+signals2::connection RenderMonitoredPreview::connect(slot const & slot)
{
return changed_.connect(slot);
}
{
if (!monitoring()) {
monitor_ = FileSystemWatcher::activeMonitor(filename_);
- monitor_->connect(changed_);
+ // Disconnected at the same time as this is destroyed.
+ monitor_->connect([this](bool /* exists */){ changed_(); });
}
}