]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/ColorCache.h
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / ColorCache.h
index 0404a8a81f58dfd6fcb8c667934f216acc6bb668..88db6bb565879a7991bb6e59ce1bc29c27927589 100644 (file)
 #ifndef COLORCACHE_H
 #define COLORCACHE_H
 
-#include "LColor.h"
+#include "Color.h"
 
 #include <QColor>
 
-#include <map>
-
 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_color, QColor> lcolor_map;
-
-       mutable lcolor_map colormap;
+       ///
+       void init();
+       ///
+       QColor lcolors_[Color_ignore + 1];
+       ///
+       bool initialized_;
 };
 
 ///
-QColor const rgb2qcolor(lyx::RGBColor const &);
+QColor const rgb2qcolor(RGBColor const &);
+
+} // namespace lyx
+
 #endif // COLORCACHE_H