4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS
11 * grfx::Previews is a singleton class that stores the grfx::PreviewLoader
12 * for each buffer requiring one.
23 #include <boost/utility.hpp>
24 #include <boost/scoped_ptr.hpp>
32 class Previews : boost::noncopyable {
34 /// a wrapper for lyxrc.preview
35 static bool activated();
37 /// This is a singleton class. Get the instance.
38 static Previews & get();
40 /** Returns the PreviewLoader for this buffer.
41 * Used by individual insets to update their own preview.
42 * We assert that (buffer != 0) but do not pass a Buffer &
43 * so that insets do not need to #include buffer.h
45 PreviewLoader & loader(Buffer const * buffer) const;
47 /** Called from the Buffer d-tor.
48 * If (buffer == 0), does nothing.
50 void removeLoader(Buffer const * buffer) const;
52 /** For a particular buffer, initiate the generation of previews
53 * for each and every snippetof LaTeX that's of interest with
54 * a single forked process.
55 * If (buffer == 0), does nothing.
57 void generateBufferPreviews(Buffer const & buffer) const;
60 /** Make the c-tor, d-tor private so we can control how many objects
67 /// Use the Pimpl idiom to hide the internals.
69 /// The pointer never changes although *pimpl_'s contents may.
70 boost::scoped_ptr<Impl> const pimpl_;