]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/ColorCache.cpp
simplify color cache code
[features.git] / src / frontends / qt4 / ColorCache.cpp
index bfccf7a6f60a9a8473055f042a1bb270ab5805aa..16c4497eab66ea07afa86bce84cb34be57b26724 100644 (file)
 
 namespace lyx {
 
-const QColor grey40(0x66, 0x66, 0x66);
-const QColor grey60(0x99, 0x99, 0x99);
-const QColor grey80(0xcc, 0xcc, 0xcc);
-const QColor grey90(0xe5, 0xe5, 0xe5);
-const QColor none = Qt::black;
-
-QColor const & ColorCache::get(ColorCode col) const
-{
-       lcolor_map::const_iterator cit = colormap.find(col);
-       if (cit != colormap.end())
-               return cit->second;
-
-       if (lcolor.getX11Name(col) == "grey40")
-               colormap[col] = grey40;
-       else if (lcolor.getX11Name(col) == "grey60")
-               colormap[col] = grey60;
-       else if (lcolor.getX11Name(col) == "grey80")
-               colormap[col] = grey80;
-       else if (lcolor.getX11Name(col) == "grey90")
-               colormap[col] = grey90;
-       else if (lcolor.getX11Name(col) == "none")
-               colormap[col] = none;
-       else
-               colormap[col] = QColor(lcolor.getX11Name(col).c_str());
-
-       return colormap[col];
-}
-
-
-void ColorCache::clear()
+void ColorCache::init()
 {
-       colormap.clear();
+       for (int col = 0; col <= Color_ignore; ++col)
+               lcolors_[col] = QColor(lcolor.getX11Name(ColorCode(col)).c_str());
 }