]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetPreview.h
Attempt to reflect tabular width in workarea
[lyx.git] / src / insets / InsetPreview.h
index b221d50b6031293247a944a11f43c19aa9a88d6f..f0808d7246733fdc54352eb7b25ce6f51d3af46e 100644 (file)
@@ -1,95 +1,97 @@
-// -*- C++ -*-\r
-/**\r
- * \file InsetPreview.h\r
- * This file is part of LyX, the document processor.\r
- * Licence details can be found in the file COPYING.\r
- *\r
- * \author Vincent van Ravesteijn\r
- *\r
- * Full author contact details are available in file CREDITS.\r
- */\r
-\r
-#ifndef INSETPREVIEW_H\r
-#define INSETPREVIEW_H\r
-\r
-#include "InsetText.h"\r
-\r
-#include "Dimension.h"\r
-\r
-#include <boost/scoped_ptr.hpp>\r
-\r
-namespace lyx {\r
-\r
-class RenderPreview;\r
-\r
-namespace graphics {\r
-       class PreviewLoader;\r
-}\r
-\r
-/// An inset with an instant preview\r
-class InsetPreview : public InsetText {\r
-       \r
-public:\r
-       ///\r
-       InsetPreview(Buffer *);\r
-       ///\r
-       ~InsetPreview();\r
-       ///\r
-       InsetPreview(InsetPreview const & other);\r
-\r
-       /// \name Methods inherited from Inset class\r
-       //@{\r
-       Inset * clone() const { return new InsetPreview(*this); }\r
-\r
-       bool neverIndent() const { return true; }\r
-       \r
-       InsetCode lyxCode() const { return PREVIEW_CODE; }\r
-       \r
-       docstring name() const { return from_ascii("Preview"); }\r
-       \r
-       bool descendable(BufferView const & /*bv*/) const { return true; }\r
-\r
-       docstring contextMenu(BufferView const &, int, int) const\r
-               { return from_ascii("context-preview"); }\r
-\r
-       void metrics(MetricsInfo & mi, Dimension & dim) const;\r
-\r
-       Inset * editXY(Cursor & cur, int x, int y);\r
-\r
-       void draw(PainterInfo & pi, int x, int y) const;\r
-\r
-       void addPreview(DocIterator const & inset_pos,\r
-               graphics::PreviewLoader & ploader) const;\r
-\r
-       bool notifyCursorLeaves(Cursor const & old, Cursor & cur);\r
-\r
-       void write(std::ostream & os) const;\r
-\r
-       void edit(Cursor & cur, bool front, EntryDirection entry_from);\r
-       //@}\r
-       \r
-protected:\r
-       /// Retrieves the preview state. Returns true if preview\r
-       /// is enabled and the preview image is availabled.\r
-       bool previewState(BufferView * bv) const;\r
-       /// Recreates the preview if preview is enabled.\r
-       void reloadPreview(DocIterator const & pos) const;\r
-       /// Prepare the preview if preview is enabled.\r
-       void preparePreview(DocIterator const & pos) const;\r
-\r
-       ///\r
-       boost::scoped_ptr<RenderPreview> preview_;\r
-       ///\r
-       mutable bool use_preview_;\r
-\r
-private:\r
-       ///\r
-       mutable Dimension dim_;\r
-};\r
-\r
-\r
-} // namespace lyx\r
-\r
-\r
-#endif\r
-\r
+// -*- C++ -*-
+/**
+ * \file InsetPreview.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Vincent van Ravesteijn
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef INSETPREVIEW_H
+#define INSETPREVIEW_H
+
+#include "InsetText.h"
+
+#include "Dimension.h"
+
+#include "support/unique_ptr.h"
+
+
+namespace lyx {
+
+class RenderPreview;
+
+namespace graphics {
+       class PreviewLoader;
+}
+
+/// An inset with an instant preview
+class InsetPreview : public InsetText {
+
+public:
+       ///
+       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 layoutName() const { return from_ascii("Preview"); }
+
+       bool descendable(BufferView const & /*bv*/) const { return true; }
+
+       std::string contextMenuName() const
+               { return "context-preview"; }
+
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
+
+       Inset * editXY(Cursor & cur, int x, int y);
+
+       void draw(PainterInfo & pi, int x, int y) const;
+
+       void addPreview(DocIterator const & inset_pos,
+               graphics::PreviewLoader & ploader) const;
+
+       bool notifyCursorLeaves(Cursor const & old, Cursor & cur);
+
+       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.
+       bool previewState(BufferView * bv) const;
+       /// Recreates the preview if preview is enabled.
+       void reloadPreview(DocIterator const & pos) const;
+       /// Prepare the preview if preview is enabled.
+       void preparePreview(DocIterator const & pos) const;
+
+       ///
+       unique_ptr<RenderPreview> preview_;
+
+};
+
+
+} // namespace lyx
+
+
+#endif
+