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(command, _("command-inset"), "command", "black", "command");
60 fill(commandbg, _("command-inset background"), "commandbg", "grey80", "commandbg");
61 fill(commandframe, _("inset frame"), "commandframe", "black", "commandframe");
62 fill(accent, _("accent"), "accent", "black", "accent");
63 fill(accentbg, _("accent background"), "accentbg", "offwhite", "accentbg");
64 fill(accentframe, _("accent frame"), "accentframe", "linen", "accentframe");
65 fill(minipageline, _("minipage line"), "minipageline", "violet", "minipageline");
66 fill(special, _("special char"), "special", "RoyalBlue", "special");
67 fill(math, _("math"), "math", "DarkBlue", "math");
68 fill(mathbg, _("math background"), "mathbg", "AntiqueWhite", "mathbg");
69 fill(mathframe, _("math frame"), "mathframe", "Magenta", "mathframe");
70 fill(mathcursor, _("math cursor"), "mathcursor", "black", "mathcursor");
71 fill(mathline, _("math line"), "mathline", "Blue", "mathline");
72 fill(footnote, _("footnote"), "footnote", "DarkRed", "footnote");
73 fill(footnotebg, _("footnote background"), "footnotebg", "grey40", "footnotebg");
74 fill(footnoteframe, _("footnote frame"), "footnoteframe", "IndianRed", "footnoteframe");
75 fill(ert, _("ert"), "ert", "DarkRed", "ert");
76 fill(inset, _("inset"), "inset", "black", "inset");
77 fill(insetbg, _("inset background"), "insetbg", "grey40", "insetbg");
78 fill(insetframe, _("inset frame"), "insetframe", "IndianRed", "insetframe");
79 fill(error, _("error"), "error", "Red", "error");
80 fill(eolmarker, _("end-of-line marker"), "eolmarker", "Brown", "eolmarker");
81 fill(appendixline, _("appendix line"), "appendixline", "Brown", "appendixline");
82 fill(vfillline, _("vfill line"), "vfillline", "Brown", "vfillline");
83 fill(topline, _("top/bottom line"), "topline", "Brown", "topline");
84 fill(tableline, _("table line"), "tableline", "black", "tableline");
85 fill(tabularline, _("tabular line"), "tabularline", "black",
87 fill(tabularonoffline, _("tabularonoff line"), "tabularonoffline",
88 "LightSteelBlue", "tabularonoffline");
89 fill(bottomarea, _("bottom area"), "bottomarea", "grey40", "bottomarea");
90 fill(pagebreak, _("page break"), "pagebreak", "RoyalBlue", "pagebreak");
91 fill(top, _("top of button"), "top", "grey80", "top");
92 fill(bottom, _("bottom of button"), "bottom", "grey40", "bottom");
93 fill(left, _("left of button"), "left", "grey80", "left");
94 fill(right, _("right of button"), "right", "grey40", "right");
95 fill(buttonbg, _("button background"), "buttonbg", "grey60", "buttonbg");
96 fill(inherit, _("inherit"), "inherit", "black", "inherit");
97 fill(ignore, _("ignore"), "ignore", "black", "ignore");
101 string LColor::getGUIName(LColor::color c) const
103 InfoTab::const_iterator ici = infotab.find(c);
104 if (ici != infotab.end())
105 return (*ici).second.guiname;
111 string LColor::getX11Name(LColor::color c) const
113 InfoTab::const_iterator ici = infotab.find(c);
114 if (ici != infotab.end())
115 return (*ici).second.x11name;
117 lyxerr << "LyX internal error: Missing color"
118 " entry in LColor.C for " << int(c) << '\n';
119 lyxerr << "Using black.\n";
124 string LColor::getLaTeXName(LColor::color c) const
126 InfoTab::const_iterator ici = infotab.find(c);
127 if (ici != infotab.end())
128 return (*ici).second.latexname;
133 string LColor::getLyXName(LColor::color c) const
135 InfoTab::const_iterator ici = infotab.find(c);
136 if (ici != infotab.end())
137 return (*ici).second.lyxname;
142 void LColor::setColor(LColor::color col, string const & x11name)
144 InfoTab::iterator iti = infotab.find(col);
145 if (iti != infotab.end()) {
146 (*iti).second.x11name = x11name;
149 lyxerr << "LyX internal error: color and such.\n";
154 LColor::color LColor::getFromGUIName(string const & guiname) const
156 InfoTab::const_iterator ici = infotab.begin();
157 for (; ici != infotab.end(); ++ici) {
158 if (!compare_no_case((*ici).second.guiname, guiname))
161 return LColor::ignore;
165 LColor::color LColor::getFromLyXName(string const & lyxname) const
167 InfoTab::const_iterator ici = infotab.begin();
168 for (; ici != infotab.end(); ++ici) {
169 if (!compare_no_case((*ici).second.lyxname, lyxname))
172 return LColor::ignore;
175 // The evil global LColor instance