X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fgraphics%2FPreviewLoader.h;h=ca22a9fa5c56706ef327ded5a5868e1ec837ba4d;hb=db58111360d68f76c5797069a7b80967447d1379;hp=8558a5fbcfd0e5e73c74c38d8d7e59f57a372485;hpb=0be0fcfd5907d448cd51addf83ed7032719a0692;p=lyx.git diff --git a/src/graphics/PreviewLoader.h b/src/graphics/PreviewLoader.h index 8558a5fbcf..ca22a9fa5c 100644 --- a/src/graphics/PreviewLoader.h +++ b/src/graphics/PreviewLoader.h @@ -8,7 +8,7 @@ * * Full author contact details are available in file CREDITS. * - * lyx::graphics::PreviewLoader collects latex snippets together. Then, on a + * graphics::PreviewLoader collects latex snippets together. Then, on a * startLoading() call, these are dumped to file and processed, converting * each snippet to a separate bitmap image file. Once a bitmap file is ready * to be loaded back into LyX, the PreviewLoader emits a signal to inform @@ -18,19 +18,22 @@ #ifndef PREVIEWLOADER_H #define PREVIEWLOADER_H -#include "LString.h" -#include -#include -#include +#include "support/signals.h" -class Buffer; +#include + +#include "ColorCode.h" namespace lyx { + +class Buffer; + namespace graphics { class PreviewImage; -class PreviewLoader : boost::noncopyable { +class PreviewLoader : public QObject { + Q_OBJECT public: /** We need buffer because we require the preamble to the * LaTeX file. @@ -42,7 +45,7 @@ public: /** Is there an image already associated with this snippet of LaTeX? * If so, returns a pointer to it, else returns 0. */ - PreviewImage const * preview(string const & latex_snippet) const; + PreviewImage const * preview(std::string const & latex_snippet) const; /// enum Status { @@ -57,26 +60,27 @@ public: }; /// How far have we got in loading the image? - Status status(string const & latex_snippet) const; + Status status(std::string const & latex_snippet) const; /// Add a snippet of LaTeX to the queue for processing. - void add(string const & latex_snippet) const; + void add(std::string const & latex_snippet) const; /// Remove this snippet of LaTeX from the PreviewLoader. - void remove(string const & latex_snippet) const; + void remove(std::string const & latex_snippet) const; /** We have accumulated several latex snippets with status "InQueue". * Initiate their transformation into bitmap images. */ - void startLoading() const; + void startLoading(bool wait = false) const; /** Connect and you'll be informed when the bitmap image file * has been created and is ready for loading through * lyx::graphics::PreviewImage::image(). */ - typedef boost::signal1::slot_type slot_type; + typedef signals2::signal sig; + typedef sig::slot_type slot; /// - boost::signals::connection connect(slot_type const &) const; + signals2::connection connect(slot const &) const; /** When PreviewImage has finished loading the image file into memory, * it tells the PreviewLoader to tell the outside world @@ -85,12 +89,26 @@ public: /// Which buffer owns this loader. Buffer const & buffer() const; + /// The background color used + static ColorCode backgroundColor() { return Color_background; } + /// The foreground color used + static ColorCode foregroundColor() { return Color_preview; } + + double displayPixelRatio() const ; + +public Q_SLOTS: + /// + void refreshPreviews(); private: + /// noncopyable + PreviewLoader(PreviewLoader const &); + void operator=(PreviewLoader const &); + /// Use the Pimpl idiom to hide the internals. class Impl; /// The pointer never changes although *pimpl_'s contents may. - boost::scoped_ptr const pimpl_; + Impl * const pimpl_; }; } // namespace graphics