2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1998-2000 The LyX Team
9 *======================================================*/
16 #pragma implementation
23 #include "support/LAssert.h"
25 #include "support/lstrings.h"
28 void LColor::fill(LColor::color col, string const & gui,
29 string const & latex, string const & x11,
43 // LColor::color, gui, latex, x11, lyx
44 fill(none, _("none"), "none", "black", "none");
45 fill(black, _("black"), "black", "black", "black");
46 fill(white, _("white"), "white", "white", "white");
47 fill(red, _("red"), "red", "red", "red");
48 fill(green, _("green"), "green", "green", "green");
49 fill(blue, _("blue"), "blue", "blue", "blue");
50 fill(cyan, _("cyan"), "cyan", "cyan", "cyan");
51 fill(magenta, _("magenta"), "magenta", "magenta", "magenta");
52 fill(yellow, _("yellow"), "yellow", "yellow", "yellow");
53 fill(background, _("background"), "background", "linen", "background");
54 fill(foreground, _("foreground"), "foreground", "black", "foreground");
55 fill(selection, _("selection"), "selection", "LightBlue", "selection");
56 fill(latex, _("latex"), "latex", "DarkRed", "latex");
57 fill(floats, _("floats"), "floats", "red", "floats");
58 fill(note, _("note"), "note", "black", "note");
59 fill(notebg, _("note background"), "notebg", "yellow", "notebg");
60 fill(noteframe, _("note frame"), "noteframe", "black", "noteframe");
61 fill(command, _("command-inset"), "command", "black", "command");
62 fill(commandbg, _("command-inset background"), "commandbg", "grey50", "commandbg");
63 fill(commandframe, _("inset frame"), "commandframe", "black", "commandframe");
64 fill(accent, _("accent"), "accent", "black", "accent");
65 fill(accentbg, _("accent background"), "accentbg", "offwhite", "accentbg");
66 fill(accentframe, _("accent frame"), "accentframe", "linen", "accentframe");
67 fill(minipageline, _("minipage line"), "minipageline", "violet", "minipageline");
68 fill(special, _("special char"), "special", "RoyalBlue", "special");
69 fill(math, _("math"), "math", "DarkBlue", "math");
70 fill(mathbg, _("math background"), "mathbg", "AntiqueWhite", "mathbg");
71 fill(mathframe, _("math frame"), "mathframe", "Magenta", "mathframe");
72 fill(mathcursor, _("math cursor"), "mathcursor", "black", "mathcursor");
73 fill(mathline, _("math line"), "mathline", "Blue", "mathline");
74 fill(footnote, _("footnote"), "footnote", "DarkRed", "footnote");
75 fill(footnotebg, _("footnote background"), "footnotebg", "grey40", "footnotebg");
76 fill(footnoteframe, _("footnote frame"), "footnoteframe", "IndianRed", "footnoteframe");
77 fill(ert, _("ert"), "ert", "DarkRed", "ert");
78 fill(inset, _("inset"), "inset", "black", "inset");
79 fill(insetbg, _("inset background"), "insetbg", "grey40", "insetbg");
80 fill(insetframe, _("inset frame"), "insetframe", "IndianRed", "insetframe");
81 fill(error, _("error"), "error", "Red", "error");
82 fill(eolmarker, _("end-of-line marker"), "eolmarker", "Brown", "eolmarker");
83 fill(appendixline, _("appendix line"), "appendixline", "Brown", "appendixline");
84 fill(vfillline, _("vfill line"), "vfillline", "Brown", "vfillline");
85 fill(topline, _("top/bottom line"), "topline", "Brown", "topline");
86 fill(tableline, _("table line"), "tableline", "black", "tableline");
87 fill(bottomarea, _("bottom area"), "bottomarea", "grey40", "bottomarea");
88 fill(pagebreak, _("page break"), "pagebreak", "RoyalBlue", "pagebreak");
89 fill(top, _("top of button"), "top", "grey80", "top");
90 fill(bottom, _("bottom of button"), "bottom", "grey40", "bottom");
91 fill(left, _("left of button"), "left", "grey80", "left");
92 fill(right, _("right of button"), "right", "grey40", "right");
93 fill(buttonbg, _("button background"), "buttonbg", "grey60", "buttonbg");
94 fill(inherit, _("inherit"), "inherit", "black", "inherit");
95 fill(ignore, _("ignore"), "ignore", "black", "ignore");
99 string LColor::getGUIName(LColor::color c) const
101 InfoTab::const_iterator ici = infotab.find(c);
102 if (ici != infotab.end())
103 return (*ici).second.guiname;
109 string LColor::getX11Name(LColor::color c) const
111 InfoTab::const_iterator ici = infotab.find(c);
112 if (ici != infotab.end())
113 return (*ici).second.x11name;
115 lyxerr << "LyX internal error: Missing color"
116 " entry in LColor.C for " << int(c) << '\n';
117 lyxerr << "Using black.\n";
122 string LColor::getLaTeXName(LColor::color c) const
124 InfoTab::const_iterator ici = infotab.find(c);
125 if (ici != infotab.end())
126 return (*ici).second.latexname;
131 string LColor::getLyXName(LColor::color c) const
133 InfoTab::const_iterator ici = infotab.find(c);
134 if (ici != infotab.end())
135 return (*ici).second.lyxname;
140 void LColor::setColor(LColor::color col, string const & x11name)
142 InfoTab::iterator iti = infotab.find(col);
143 if (iti != infotab.end()) {
144 (*iti).second.x11name = x11name;
147 lyxerr << "LyX internal error: color and such.\n";
152 LColor::color LColor::getFromGUIName(string const & guiname) const
154 InfoTab::const_iterator ici = infotab.begin();
155 for (; ici != infotab.end(); ++ici) {
156 if (!compare_no_case((*ici).second.guiname, guiname))
159 return LColor::ignore;
163 LColor::color LColor::getFromLyXName(string const & lyxname) const
165 InfoTab::const_iterator ici = infotab.begin();
166 for (; ici != infotab.end(); ++ici) {
167 if (!compare_no_case((*ici).second.lyxname, lyxname))
170 return LColor::ignore;
173 // The evil global LColor instance