#include "PreviewLoader.h"
#include "support/FileName.h"
+#include "support/lyxlib.h"
-#include "support/bind.h"
using namespace std;
using namespace lyx::support;
namespace lyx {
namespace graphics {
-class PreviewImage::Impl : public boost::signals2::trackable {
+class PreviewImage::Impl {
public:
///
Impl(PreviewImage & p, PreviewLoader & l,
///
~Impl();
///
- Image const * image();
+ Image const * image() const;
///
void statusChanged();
if (!image)
return dim;
- dim.asc = int(pimpl_->ascent_frac_ * double(image->height()) + 0.5);
+ dim.asc = support::iround(pimpl_->ascent_frac_ * double(image->height()));
dim.des = image->height() - dim.asc;
dim.wid = image->width();
return dim;
}
-PreviewImage::Impl::Impl(PreviewImage & p, PreviewLoader & l,
- string const & s,
- FileName const & bf,
- double af)
+PreviewImage::Impl::Impl(PreviewImage & p, PreviewLoader & l, string const & s,
+ FileName const & bf, double af)
: parent_(p), ploader_(l), iloader_(l.buffer().fileName(), bf),
snippet_(s), ascent_frac_(af)
{
iloader_.setDisplayPixelRatio(l.displayPixelRatio());
- iloader_.connect(bind(&Impl::statusChanged, this));
+ // This connection is destroyed at the same time as this.
+ iloader_.connect([this](){ statusChanged(); });
}
}
-Image const * PreviewImage::Impl::image()
+Image const * PreviewImage::Impl::image() const
{
if (iloader_.status() == WaitingToLoad)
iloader_.startLoading();