4 * Copyright 2002 the LyX Team
5 * Read the file COPYING
7 * \author Angus Leeming <leeming@lyx.org>
9 * grfx::Previews is a singleton class that stores the grfx::PreviewLoader
10 * for each buffer requiring one.
21 #include <boost/utility.hpp>
22 #include <boost/scoped_ptr.hpp>
30 class Previews : boost::noncopyable {
32 /// a wrapper for lyxrc.preview
33 static bool activated();
35 /// This is a singleton class. Get the instance.
36 static Previews & get();
38 /** Returns the PreviewLoader for this buffer.
39 * Used by individual insets to update their own preview.
40 * We assert that (buffer != 0) but do not pass a Buffer &
41 * so that insets do not need to #include buffer.h
43 PreviewLoader & loader(Buffer const * buffer);
45 /** Called from the Buffer d-tor.
46 * If (buffer == 0), does nothing.
48 void removeLoader(Buffer const * buffer);
50 /** For a particular buffer, initiate the generation of previews
51 * for each and every snippetof LaTeX that's of interest with
52 * a single forked process.
53 * If (buffer == 0), does nothing.
55 void generateBufferPreviews(Buffer const & buffer);
58 /** Make the c-tor, d-tor private so we can control how many objects
65 /// Use the Pimpl idiom to hide the internals.
67 /// The pointer never changes although *pimpl_'s contents may.
68 boost::scoped_ptr<Impl> const pimpl_;