#include "Dimension.h"
-#include <boost/scoped_ptr.hpp>
+#include "support/unique_ptr.h"
+
namespace lyx {
/// An inset with an instant preview
class InsetPreview : public InsetText {
-
+
public:
///
- InsetPreview(Buffer *);
+ explicit InsetPreview(Buffer *);
///
~InsetPreview();
///
InsetPreview(InsetPreview const & other);
+ ///
+ InsetPreview & operator=(InsetPreview const & other);
/// \name Methods inherited from Inset class
//@{
Inset * clone() const { return new InsetPreview(*this); }
bool neverIndent() const { return true; }
-
+
+ bool inheritFont() const { return false; }
+
InsetCode lyxCode() const { return PREVIEW_CODE; }
-
- docstring name() const { return from_ascii("Preview"); }
-
+
+ docstring layoutName() const { return from_ascii("Preview"); }
+
bool descendable(BufferView const & /*bv*/) const { return true; }
- docstring contextMenu(BufferView const &, int, int) const
- { return from_ascii("context-preview"); }
+ std::string contextMenuName() const
+ { return "context-preview"; }
void metrics(MetricsInfo & mi, Dimension & dim) const;
void write(std::ostream & os) const;
void edit(Cursor & cur, bool front, EntryDirection entry_from);
+
+ bool canPaintChange(BufferView const &) const { return true; };
//@}
-
+
protected:
/// Retrieves the preview state. Returns true if preview
- /// is enabled and the preview image is availabled.
+ /// is enabled and the preview image is available.
bool previewState(BufferView * bv) const;
/// Recreates the preview if preview is enabled.
void reloadPreview(DocIterator const & pos) const;
void preparePreview(DocIterator const & pos) const;
///
- boost::scoped_ptr<RenderPreview> preview_;
- ///
- mutable bool use_preview_;
+ unique_ptr<RenderPreview> preview_;
-private:
- ///
- mutable Dimension dim_;
};