]> git.lyx.org Git - lyx.git/blob - src/LColor.h
multicol; small stuff
[lyx.git] / src / LColor.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *          Copyright 1998-2001 The LyX Team
8  *
9  *======================================================*/
10
11 #ifndef LCOLOR_H
12 #define LCOLOR_H
13
14 #include <map>
15
16 #include "LString.h"
17
18 /**
19   This is a stateless class.
20
21   It has one basic purposes:
22   To serve as a color-namespace container (the Color enum).
23
24
25   */
26 /**
27  * \class LColor
28  *
29  * A class holding color definitions and associated names for
30  * LaTeX, X11, the GUI, and LyX internally.
31  *
32  * A color can be one of the following kinds:
33  *
34  * - A real, predefined color, such as black, white, red or green.
35  * - A logical color, such as no color, inherit, math
36  */
37
38 class LColor // : public boost::noncopyable {
39 // made copyable for same reasons as LyXRC was made copyable. See there for
40 // explanation.
41 {
42 public:
43         /// Names of colors, including all logical colors
44         enum color {
45                 /// No particular color---clear or default
46                 none,
47                 /// The different text colors
48                 black,
49                 ///
50                 white,
51                 ///
52                 red,
53                 ///
54                 green,
55                 ///
56                 blue,
57                 ///
58                 cyan,
59                 ///
60                 magenta,
61                 ///
62                 yellow,
63
64                 // Needed interface colors
65
66                 /// Cursor color
67                 cursor,
68                 /// Background color
69                 background,
70                 /// Foreground color
71                 foreground,
72                 /// Background color of selected text
73                 selection,
74                 /// Text color in LaTeX mode
75                 latex,
76                 /// The color used for previews
77                 preview,
78
79                 /// Text color for notes
80                 note,
81                 /// Background color of notes
82                 notebg,
83
84
85                 /// Color for the depth bars in the margin
86                 depthbar,
87                 /// Color for marking foreign language words
88                 language,
89
90                 /// Text color for command insets
91                 command,
92                 /// Background color for command insets
93                 commandbg,
94                 /// Frame color for command insets
95                 commandframe,
96
97                 /// Special chars text color
98                 special,
99
100                 /// Graphics inset background color
101                 graphicsbg,
102                 /// Math inset text color
103                 math,
104                 /// Math inset background color
105                 mathbg,
106                 /// Macro math inset background color
107                 mathmacrobg,
108                 /// Math inset frame color
109                 mathframe,
110                 /// Math cursor color
111                 mathcursor,
112                 /// Math line color
113                 mathline,
114
115                 /// caption frame color
116                 captionframe,
117
118                 /// collapsable insets text
119                 collapsable,
120                 /// collapsable insets frame
121                 collapsableframe,
122
123                 /// Inset marker background color
124                 insetbg,
125                 /// Inset marker frame color
126                 insetframe,
127
128                 /// Error box text color
129                 error,
130                 /// EOL marker color
131                 eolmarker,
132                 /// Added space colour
133                 added_space,
134                 /// Appendix line color
135                 appendixline,
136                 /// changebar color
137                 changebar,
138                 /// strike-out color
139                 strikeout,
140                 /// added text color
141                 newtext,
142                 /// Top and bottom line color
143                 topline,
144                 /// Table line color
145                 tabularline,
146                 /// Table line color
147                 tabularonoffline,
148                 /// Bottom area color
149                 bottomarea,
150                 /// Page break color
151                 pagebreak,
152
153                 // FIXME: why are the next four separate ??
154                 /// Color used for top of boxes
155                 top,
156                 /// Color used for bottom of boxes
157                 bottom,
158                 /// Color used for left side of boxes
159                 left,
160                 /// Color used for right side of boxes
161                 right,
162                 /// Color used for bottom background
163                 buttonbg,
164
165                 // Logical attributes
166
167                 /// Color is inherited
168                 inherit,
169                 /// For ignoring updates of a color
170                 ignore
171         };
172
173         ///
174         LColor();
175         /// set the given LyX color to the color defined by the X11 name given
176         void setColor(LColor::color col, string const & x11name);
177         /// set the given LyX color to the color defined by the X11 name given
178         bool setColor(string const & lyxname, string const & x11name);
179
180         /// Get GUI name of color
181         string const getGUIName(LColor::color c) const;
182
183         /// Get X11 name of color
184         string const getX11Name(LColor::color c) const;
185
186         /// Get LaTeX name of color
187         string const getLaTeXName(LColor::color c) const;
188
189         /// Get LyX name of color
190         string const getLyXName(LColor::color c) const;
191
192         /// get the color from the GUI name
193         LColor::color getFromGUIName(string const & guiname) const;
194         /// get the color from the LyX name
195         LColor::color getFromLyXName(string const & lyxname) const;
196 private:
197         ///
198         struct information {
199                 /// the name as it appears in the GUI
200                 string guiname;
201                 /// the name used in LaTeX
202                 string latexname;
203                 /// the name for X11
204                 string x11name;
205                 /// the name for LyX
206                 string lyxname;
207         };
208
209         /// initialise a color entry
210         void fill(LColor::color col, string const & gui,
211                   string const & latex, string const & x11,
212                   string const & lyx);
213
214         ///
215         typedef std::map<LColor::color, information> InfoTab;
216         /// the table of color information
217         InfoTab infotab;
218 };
219
220 /// the current color definitions
221 extern LColor lcolor;
222 /// the system color definitions
223 extern LColor system_lcolor;
224
225 #endif