X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FColorCache.h;h=e1ad6aed5eaea665ca46ec07f6d2bb0b977cc111;hb=72f91cb394e180419cd3ab85f710b8ad538208f9;hp=7ab530830b81fd806e2d4470f0a8dd62533fefe9;hpb=30649ec3b679ac55430e5315601bf06df76ea597;p=lyx.git diff --git a/src/frontends/qt4/ColorCache.h b/src/frontends/qt4/ColorCache.h index 7ab530830b..e1ad6aed5e 100644 --- a/src/frontends/qt4/ColorCache.h +++ b/src/frontends/qt4/ColorCache.h @@ -12,42 +12,53 @@ #ifndef COLORCACHE_H #define COLORCACHE_H -#include "LColor.h" - -#include +#include "Color.h" #include - +#include namespace lyx { -struct RGBColor; -} - -// FIXME: use a fixed-size array not a map ? +struct RGBColor; /** - * Cache from LColor to QColor. + * Cache from Color to QColor. */ -class ColorCache { +class ColorCache +{ public: - ColorCache(); + /// + ColorCache() : initialized_(false) {} + + /// get the given color (depends on LyXRC::use_system_color) + QColor get(Color const & color) const; /// get the given color - QColor const & get(LColor_color color) const; + QColor get(Color const & color, bool use_system_colors) const; + + /// is this color replaced when LyXRC::use_system_color is true? + bool isSystem(ColorCode color) const; + + /// change the undelying palette + void setPalette(QPalette const pal) { pal_ = pal; clear(); } /// clear all colors - void clear(); + void clear() { initialized_ = false; } private: - typedef std::map lcolor_map; - - mutable lcolor_map colormap; + /// + void init(); + /// + QColor lcolors_[Color_ignore + 1]; + /// + bool initialized_; + /// + QPalette pal_; }; -/// singleton instance -extern ColorCache lcolorcache; - /// -QColor const rgb2qcolor(lyx::RGBColor const &); +QColor const rgb2qcolor(RGBColor const &); + +} // namespace lyx + #endif // COLORCACHE_H