]> git.lyx.org Git - lyx.git/blob - src/graphics/Previews.h
merge {mathed,insets,graphics}/Makefile.am into src/Makefile.am
[lyx.git] / src / graphics / Previews.h
1 // -*- C++ -*-
2 /**
3  * \file Previews.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  *
11  * lyx::graphics::Previews is a singleton class that stores the
12  * lyx::graphics::PreviewLoader for each buffer requiring one.
13  */
14
15 #ifndef PREVIEWS_H
16 #define PREVIEWS_H
17
18 #include <boost/utility.hpp>
19 #include <boost/scoped_ptr.hpp>
20
21 namespace lyx {
22
23 class Buffer;
24 class LyXRC_PreviewStatus;
25
26 namespace graphics {
27
28 class PreviewLoader;
29
30 class Previews : boost::noncopyable {
31 public:
32         /// a wrapper for lyxrc.preview
33         static LyXRC_PreviewStatus status();
34
35         /// This is a singleton class. Get the instance.
36         static Previews & get();
37
38         /** Returns the PreviewLoader for this buffer.
39          *  Used by individual insets to update their own preview.
40          */
41         PreviewLoader & loader(Buffer const & buffer) const;
42
43         /// Called from the Buffer d-tor.
44         void removeLoader(Buffer const & buffer) const;
45
46         /** For a particular buffer, initiate the generation of previews
47          *  for each and every snippet of LaTeX that's of interest with
48          *  a single forked process.
49          */
50         void generateBufferPreviews(Buffer const & buffer) const;
51
52 private:
53         /** Make the c-tor, d-tor private so we can control how many objects
54          *  are instantiated.
55          */
56         Previews();
57         ~Previews();
58
59         /// Use the Pimpl idiom to hide the internals.
60         class Impl;
61         /// The pointer never changes although *pimpl_'s contents may.
62         boost::scoped_ptr<Impl> const pimpl_;
63 };
64
65 } // namespace graphics
66 } // namespace lyx
67
68 #endif // PREVIEWS_H