X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FColorCache.h;h=88db6bb565879a7991bb6e59ce1bc29c27927589;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=df1c595382118b886ec8d71039b88546ef022a8b;hpb=8670d821c4531d2d4a29cf220a567cb73eddd1ba;p=lyx.git diff --git a/src/frontends/qt4/ColorCache.h b/src/frontends/qt4/ColorCache.h index df1c595382..88db6bb565 100644 --- a/src/frontends/qt4/ColorCache.h +++ b/src/frontends/qt4/ColorCache.h @@ -12,41 +12,40 @@ #ifndef COLORCACHE_H #define COLORCACHE_H -#include "LColor.h" +#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 - QColor const & get(LColor_color color) const; + QColor get(Color color) const; /// 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_; }; -/// singleton instance -extern ColorCache lcolorcache; - /// -QColor const rgb2qcolor(lyx::RGBColor const &); +QColor const rgb2qcolor(RGBColor const &); + +} // namespace lyx + #endif // COLORCACHE_H