]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/PreviewedInset.h
Store an InsetBase & in MailInset.
[lyx.git] / src / graphics / PreviewedInset.h
index 4ab1ecda9a11d5723e2e3103057997dfd18ff994..5e400908603bbf54b0d0daee8f643fe9ea1bdff5 100644 (file)
@@ -1,10 +1,12 @@
 // -*- C++ -*-
 /**
  *  \file PreviewedInset.h
- *  Copyright 2002 the LyX Team
- *  Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * \author Angus Leeming <leeming@lyx.org>
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS
  *
  *  grfx::PreviewedInset is an abstract base class that can help insets to
  *  generate previews. The daughter class must instantiate three small
 #ifndef PREVIEWEDINSET_H
 #define PREVIEWEDINSET_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
-
 #include "LString.h"
 #include <boost/signals/trackable.hpp>
 #include <boost/signals/connection.hpp>
@@ -37,16 +35,23 @@ public:
 
        ///
        PreviewedInset(Inset & inset) : inset_(inset), pimage_(0) {}
+       ///
+       virtual ~PreviewedInset() {}
 
        /** Find the PreviewLoader, add a LaTeX snippet to it and
         *  start the loading process.
         */
-       void generatePreview() const;
+       void generatePreview();
 
        /** Add a LaTeX snippet to the PreviewLoader but do not start the
         *  loading process.
         */
-       void addPreview(PreviewLoader & ploader) const;
+       void addPreview(PreviewLoader & ploader);
+
+       /** Remove a snippet from the cache of previews.
+        *  Useful if previewing the contents of a file that has changed.
+        */
+       void removePreview();
 
        /// The preview has been generated and is ready to use.
        bool previewReady() const;
@@ -57,6 +62,8 @@ public:
 protected:
        /// Allow the daughter classes to cast up to the parent inset.
        Inset * inset() const { return &inset_; }
+       ///
+       BufferView * view() const;
 
 private:
        /** This method is connected to the grfx::PreviewLoader::imageReady
@@ -66,17 +73,18 @@ private:
 
        /// Does the owning inset want a preview?
        virtual bool previewWanted() const = 0;
-       ///
-       virtual BufferView * view() const = 0;
        /// a wrapper to Inset::latex
        virtual string const latexString() const = 0;
 
        ///
        Inset & inset_;
-       /// We don't own this
+       ///
+       string snippet_;
+
+       /// We don't own this. Cached for efficiency reasons.
        mutable PreviewImage const * pimage_;
        ///
-       mutable boost::signals::connection connection_;
+       boost::signals::connection connection_;
 };
 
 } // namespace grfx