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