]> git.lyx.org Git - features.git/blob - src/frontends/qt2/lcolorcache.C
update ignore, and make sure to dist the lyx2lyx_version.py.in template file
[features.git] / src / frontends / qt2 / lcolorcache.C
1 /**
2  * \file lcolorcache.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "lcolorcache.h"
14
15 #include "Color.h"
16 #include "LColor.h"
17
18 LColorCache lcolorcache;
19
20
21 LColorCache::LColorCache()
22 {
23 }
24
25
26 QColor const & LColorCache::get(LColor_color col) const
27 {
28         lcolor_map::const_iterator cit = colormap.find(col);
29         if (cit != colormap.end())
30                 return cit->second;
31
32         QColor const qcol(lcolor.getX11Name(col).c_str());
33         colormap[col] = qcol;
34         return colormap[col];
35 }
36
37
38 void LColorCache::clear()
39 {
40         colormap.clear();
41 }
42
43
44 QColor const rgb2qcolor(lyx::RGBColor const & rgb)
45 {
46         return QColor(rgb.r, rgb.g, rgb.b);
47 }