2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1998-2000 The LyX Team
9 *======================================================*/
14 #pragma implementation
21 #include "support/LAssert.h"
23 #include "support/lstrings.h"
26 void LColor::fill(LColor::color col, string const & gui,
27 string const & latex, string const & x11,
41 // LColor::color, gui, latex, x11, lyx
42 fill(none, _("none"), "none", "black", "none");
43 fill(black, _("black"), "black", "black", "black");
44 fill(white, _("white"), "white", "white", "white");
45 fill(red, _("red"), "red", "red", "red");
46 fill(green, _("green"), "green", "green", "green");
47 fill(blue, _("blue"), "blue", "blue", "blue");
48 fill(cyan, _("cyan"), "cyan", "cyan", "cyan");
49 fill(magenta, _("magenta"), "magenta", "magenta", "magenta");
50 fill(yellow, _("yellow"), "yellow", "yellow", "yellow");
51 fill(background, _("background"), "background", "linen", "background");
52 fill(foreground, _("foreground"), "foreground", "black", "foreground");
53 fill(selection, _("selection"), "selection", "LightBlue", "selection");
54 fill(latex, _("latex"), "latex", "DarkRed", "latex");
55 fill(floats, _("floats"), "floats", "red", "floats");
56 fill(note, _("note"), "note", "black", "note");
57 fill(notebg, _("note background"), "notebg", "yellow", "notebg");
58 fill(noteframe, _("note frame"), "noteframe", "black", "noteframe");
59 fill(depthbar, _("depth bar"), "depthbar", "IndianRed", "depthbar");
60 fill(command, _("command-inset"), "command", "black", "command");
61 fill(commandbg, _("command-inset background"), "commandbg", "grey80", "commandbg");
62 fill(commandframe, _("inset frame"), "commandframe", "black", "commandframe");
63 fill(accent, _("accent"), "accent", "black", "accent");
64 fill(accentbg, _("accent background"), "accentbg", "offwhite", "accentbg");
65 fill(accentframe, _("accent frame"), "accentframe", "linen", "accentframe");
66 fill(minipageline, _("minipage line"), "minipageline", "violet", "minipageline");
67 fill(special, _("special char"), "special", "RoyalBlue", "special");
68 fill(math, _("math"), "math", "DarkBlue", "math");
69 fill(mathbg, _("math background"), "mathbg", "AntiqueWhite", "mathbg");
70 fill(mathframe, _("math frame"), "mathframe", "Magenta", "mathframe");
71 fill(mathcursor, _("math cursor"), "mathcursor", "black", "mathcursor");
72 fill(mathline, _("math line"), "mathline", "Blue", "mathline");
73 fill(footnote, _("footnote"), "footnote", "DarkRed", "footnote");
74 fill(footnotebg, _("footnote background"), "footnotebg", "grey40", "footnotebg");
75 fill(footnoteframe, _("footnote frame"), "footnoteframe", "IndianRed", "footnoteframe");
76 fill(ert, _("ert"), "ert", "DarkRed", "ert");
77 fill(inset, _("inset"), "inset", "black", "inset");
78 fill(insetbg, _("inset background"), "insetbg", "grey40", "insetbg");
79 fill(insetframe, _("inset frame"), "insetframe", "IndianRed", "insetframe");
80 fill(error, _("error"), "error", "Red", "error");
81 fill(eolmarker, _("end-of-line marker"), "eolmarker", "Brown", "eolmarker");
82 fill(appendixline, _("appendix line"), "appendixline", "Brown", "appendixline");
83 fill(vfillline, _("vfill line"), "vfillline", "Brown", "vfillline");
84 fill(topline, _("top/bottom line"), "topline", "Brown", "topline");
85 fill(tableline, _("table line"), "tableline", "black", "tableline");
86 fill(tabularline, _("tabular line"), "tabularline", "black",
88 fill(tabularonoffline, _("tabularonoff line"), "tabularonoffline",
89 "LightSteelBlue", "tabularonoffline");
90 fill(bottomarea, _("bottom area"), "bottomarea", "grey40", "bottomarea");
91 fill(pagebreak, _("page break"), "pagebreak", "RoyalBlue", "pagebreak");
92 fill(top, _("top of button"), "top", "grey80", "top");
93 fill(bottom, _("bottom of button"), "bottom", "grey40", "bottom");
94 fill(left, _("left of button"), "left", "grey80", "left");
95 fill(right, _("right of button"), "right", "grey40", "right");
96 fill(buttonbg, _("button background"), "buttonbg", "grey60", "buttonbg");
97 fill(inherit, _("inherit"), "inherit", "black", "inherit");
98 fill(ignore, _("ignore"), "ignore", "black", "ignore");
102 string LColor::getGUIName(LColor::color c) const
104 InfoTab::const_iterator ici = infotab.find(c);
105 if (ici != infotab.end())
106 return (*ici).second.guiname;
112 string LColor::getX11Name(LColor::color c) const
114 InfoTab::const_iterator ici = infotab.find(c);
115 if (ici != infotab.end())
116 return (*ici).second.x11name;
118 lyxerr << "LyX internal error: Missing color"
119 " entry in LColor.C for " << int(c) << '\n';
120 lyxerr << "Using black.\n";
125 string LColor::getLaTeXName(LColor::color c) const
127 InfoTab::const_iterator ici = infotab.find(c);
128 if (ici != infotab.end())
129 return (*ici).second.latexname;
134 string LColor::getLyXName(LColor::color c) const
136 InfoTab::const_iterator ici = infotab.find(c);
137 if (ici != infotab.end())
138 return (*ici).second.lyxname;
143 void LColor::setColor(LColor::color col, string const & x11name)
145 InfoTab::iterator iti = infotab.find(col);
146 if (iti != infotab.end()) {
147 (*iti).second.x11name = x11name;
150 lyxerr << "LyX internal error: color and such.\n";
155 LColor::color LColor::getFromGUIName(string const & guiname) const
157 InfoTab::const_iterator ici = infotab.begin();
158 for (; ici != infotab.end(); ++ici) {
159 if (!compare_no_case((*ici).second.guiname, guiname))
162 return LColor::ignore;
166 LColor::color LColor::getFromLyXName(string const & lyxname) const
169 InfoTab::const_iterator ici = infotab.begin();
170 for (; ici != infotab.end(); ++ici) {
171 if (!compare_no_case((*ici).second.lyxname, lyxname))
174 return LColor::inherit;
177 // The evil global LColor instance