]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/lcolorcache.C
Added initial qt4 work by Abdelrazak Younes
[lyx.git] / src / frontends / qt4 / 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 "LColor.h"
16
17 LColorCache lcolorcache;
18
19
20 LColorCache::LColorCache()
21 {
22 }
23
24
25 QColor const & LColorCache::get(LColor_color col) const
26 {
27         lcolor_map::const_iterator cit = colormap.find(col);
28         if (cit != colormap.end())
29                 return cit->second;
30
31         if (lcolor.getX11Name(col) == "grey40")
32                 colormap[col] = Qt::lightGray;
33         else if (lcolor.getX11Name(col) == "grey60")
34                 colormap[col] = Qt::gray;
35         else if (lcolor.getX11Name(col) == "grey80")
36                 colormap[col] = Qt::darkGray;
37         else if (lcolor.getX11Name(col) == "grey90")
38                 colormap[col] = Qt::darkGray;
39         else
40                 colormap[col] = QColor(lcolor.getX11Name(col).c_str());
41
42         return colormap[col];
43 }
44
45
46 void LColorCache::clear()
47 {
48         colormap.clear();
49 }