comparison src/objects-msw.c @ 213:78f53ef88e17 r20-4b5

Import from CVS: tag r20-4b5
author cvs
date Mon, 13 Aug 2007 10:06:47 +0200
parents
children d44af0c54775
comparison
equal deleted inserted replaced
212:d8688acf4c5b 213:78f53ef88e17
1 /* mswindows-specific Lisp objects.
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
3 Copyright (C) 1995 Board of Trustees, University of Illinois.
4 Copyright (C) 1995 Tinker Systems.
5 Copyright (C) 1995, 1996 Ben Wing.
6 Copyright (C) 1995 Sun Microsystems, Inc.
7 Copyright (C) 1997 Jonathan Harris.
8
9 This file is part of XEmacs.
10
11 XEmacs is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2, or (at your option) any
14 later version.
15
16 XEmacs is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with XEmacs; see the file COPYING. If not, write to
23 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. */
25
26 /* Synched up with: Not in FSF. */
27
28 /* Authorship:
29
30 Jamie Zawinski, Chuck Thompson, Ben Wing
31 Rewritten for mswindows by Jonathan Harris, November 1997 for 20.4.
32 */
33
34
35 /* TODO: palette handling */
36
37 #include <config.h>
38 #include "lisp.h"
39
40 #include "console-msw.h"
41 #include "objects-msw.h"
42
43 #ifdef MULE
44 #include "mule-charset.h"
45 #endif
46
47 #include "buffer.h"
48 #include "device.h"
49 #include "insdel.h"
50
51 #include "windows.h"
52
53 typedef struct colormap_t
54 {
55 char *name;
56 COLORREF colorref;
57 } colormap_t;
58
59 static CONST colormap_t mswindows_X_color_map[] =
60 {
61 {"Black" , PALETTERGB ( 0, 0, 0)},
62 {"Gray0" , PALETTERGB ( 0, 0, 0)},
63 {"Grey0" , PALETTERGB ( 0, 0, 0)},
64 {"Transparent" , PALETTERGB ( 0, 0, 1)},
65 {"NavyBlue" , PALETTERGB ( 0, 0,128)},
66 {"navy" , PALETTERGB ( 0, 0,128)},
67 {"blue4" , PALETTERGB ( 0, 0,139)},
68 {"MediumBlue" , PALETTERGB ( 0, 0,205)},
69 {"blue3" , PALETTERGB ( 0, 0,205)},
70 {"blue2" , PALETTERGB ( 0, 0,238)},
71 {"Blue" , PALETTERGB ( 0, 0,255)},
72 {"blue1" , PALETTERGB ( 0, 0,255)},
73 {"DarkGreen" , PALETTERGB ( 0, 86, 45)},
74 {"DeepSkyBlue4" , PALETTERGB ( 0,104,139)},
75 {"turquoise4" , PALETTERGB ( 0,134,139)},
76 {"green4" , PALETTERGB ( 0,139, 0)},
77 {"SpringGreen4" , PALETTERGB ( 0,139, 69)},
78 {"cyan4" , PALETTERGB ( 0,139,139)},
79 {"MediumAquamarine" , PALETTERGB ( 0,147,143)},
80 {"DeepSkyBlue3" , PALETTERGB ( 0,154,205)},
81 {"DarkTurquoise" , PALETTERGB ( 0,166,166)},
82 {"LimeGreen" , PALETTERGB ( 0,175, 20)},
83 {"DeepSkyBlue2" , PALETTERGB ( 0,178,238)},
84 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)},
85 {"DeepSkyBlue1" , PALETTERGB ( 0,191,255)},
86 {"turquoise3" , PALETTERGB ( 0,197,205)},
87 {"green3" , PALETTERGB ( 0,205, 0)},
88 {"SpringGreen3" , PALETTERGB ( 0,205,102)},
89 {"cyan3" , PALETTERGB ( 0,205,205)},
90 {"MediumTurquoise" , PALETTERGB ( 0,210,210)},
91 {"turquoise2" , PALETTERGB ( 0,229,238)},
92 {"green2" , PALETTERGB ( 0,238, 0)},
93 {"SpringGreen2" , PALETTERGB ( 0,238,118)},
94 {"cyan2" , PALETTERGB ( 0,238,238)},
95 {"turquoise1" , PALETTERGB ( 0,245,255)},
96 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)},
97 {"Green" , PALETTERGB ( 0,255, 0)},
98 {"green1" , PALETTERGB ( 0,255, 0)},
99 {"SpringGreen" , PALETTERGB ( 0,255,127)},
100 {"SpringGreen1" , PALETTERGB ( 0,255,127)},
101 {"Cyan" , PALETTERGB ( 0,255,255)},
102 {"cyan1" , PALETTERGB ( 0,255,255)},
103 {"Gray1" , PALETTERGB ( 3, 3, 3)},
104 {"Grey1" , PALETTERGB ( 3, 3, 3)},
105 {"Gray2" , PALETTERGB ( 5, 5, 5)},
106 {"Grey2" , PALETTERGB ( 5, 5, 5)},
107 {"Gray3" , PALETTERGB ( 8, 8, 8)},
108 {"Grey3" , PALETTERGB ( 8, 8, 8)},
109 {"Gray4" , PALETTERGB ( 10, 10, 10)},
110 {"Grey4" , PALETTERGB ( 10, 10, 10)},
111 {"Gray5" , PALETTERGB ( 13, 13, 13)},
112 {"Grey5" , PALETTERGB ( 13, 13, 13)},
113 {"Gray6" , PALETTERGB ( 15, 15, 15)},
114 {"Grey6" , PALETTERGB ( 15, 15, 15)},
115 {"DodgerBlue4" , PALETTERGB ( 16, 78,139)},
116 {"Gray7" , PALETTERGB ( 18, 18, 18)},
117 {"Grey7" , PALETTERGB ( 18, 18, 18)},
118 {"Gray8" , PALETTERGB ( 20, 20, 20)},
119 {"Grey8" , PALETTERGB ( 20, 20, 20)},
120 {"Gray9" , PALETTERGB ( 23, 23, 23)},
121 {"Grey9" , PALETTERGB ( 23, 23, 23)},
122 {"DodgerBlue3" , PALETTERGB ( 24,116,205)},
123 {"MidnightBlue" , PALETTERGB ( 25, 25,112)},
124 {"Turquoise" , PALETTERGB ( 25,204,223)},
125 {"Gray10" , PALETTERGB ( 26, 26, 26)},
126 {"Grey10" , PALETTERGB ( 26, 26, 26)},
127 {"Gray11" , PALETTERGB ( 28, 28, 28)},
128 {"Grey11" , PALETTERGB ( 28, 28, 28)},
129 {"DodgerBlue2" , PALETTERGB ( 28,134,238)},
130 {"DodgerBlue" , PALETTERGB ( 30,144,255)},
131 {"DodgerBlue1" , PALETTERGB ( 30,144,255)},
132 {"Gray12" , PALETTERGB ( 31, 31, 31)},
133 {"Grey12" , PALETTERGB ( 31, 31, 31)},
134 {"LightSeaGreen" , PALETTERGB ( 32,178,170)},
135 {"Gray13" , PALETTERGB ( 33, 33, 33)},
136 {"Grey13" , PALETTERGB ( 33, 33, 33)},
137 {"Indigo2" , PALETTERGB ( 33,136,104)},
138 {"CornflowerBlue" , PALETTERGB ( 34, 34,152)},
139 {"ForestGreen" , PALETTERGB ( 34,139, 34)},
140 {"Gray14" , PALETTERGB ( 36, 36, 36)},
141 {"Grey14" , PALETTERGB ( 36, 36, 36)},
142 {"Gray15" , PALETTERGB ( 38, 38, 38)},
143 {"Grey15" , PALETTERGB ( 38, 38, 38)},
144 {"RoyalBlue4" , PALETTERGB ( 39, 64,139)},
145 {"Gray16" , PALETTERGB ( 41, 41, 41)},
146 {"Grey16" , PALETTERGB ( 41, 41, 41)},
147 {"Gray17" , PALETTERGB ( 43, 43, 43)},
148 {"Grey17" , PALETTERGB ( 43, 43, 43)},
149 {"Gray18" , PALETTERGB ( 46, 46, 46)},
150 {"Grey18" , PALETTERGB ( 46, 46, 46)},
151 {"SeaGreen" , PALETTERGB ( 46,139, 87)},
152 {"SeaGreen4" , PALETTERGB ( 46,139, 87)},
153 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)},
154 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)},
155 {"Gray19" , PALETTERGB ( 48, 48, 48)},
156 {"Grey19" , PALETTERGB ( 48, 48, 48)},
157 {"MediumForestGreen" , PALETTERGB ( 50,129, 75)},
158 {"Aquamarine" , PALETTERGB ( 50,191,193)},
159 {"YellowGreen" , PALETTERGB ( 50,216, 56)},
160 {"Gray20" , PALETTERGB ( 51, 51, 51)},
161 {"Grey20" , PALETTERGB ( 51, 51, 51)},
162 {"MediumSeaGreen" , PALETTERGB ( 52,119,102)},
163 {"Gray21" , PALETTERGB ( 54, 54, 54)},
164 {"Grey21" , PALETTERGB ( 54, 54, 54)},
165 {"SteelBlue4" , PALETTERGB ( 54,100,139)},
166 {"Gray22" , PALETTERGB ( 56, 56, 56)},
167 {"Grey22" , PALETTERGB ( 56, 56, 56)},
168 {"DarkSlateBlue" , PALETTERGB ( 56, 75,102)},
169 {"RoyalBlue3" , PALETTERGB ( 58, 95,205)},
170 {"Gray23" , PALETTERGB ( 59, 59, 59)},
171 {"Grey23" , PALETTERGB ( 59, 59, 59)},
172 {"Gray24" , PALETTERGB ( 61, 61, 61)},
173 {"Grey24" , PALETTERGB ( 61, 61, 61)},
174 {"Gray25" , PALETTERGB ( 64, 64, 64)},
175 {"Grey25" , PALETTERGB ( 64, 64, 64)},
176 {"RoyalBlue" , PALETTERGB ( 65,105,225)},
177 {"Gray26" , PALETTERGB ( 66, 66, 66)},
178 {"Grey26" , PALETTERGB ( 66, 66, 66)},
179 {"RoyalBlue2" , PALETTERGB ( 67,110,238)},
180 {"SeaGreen3" , PALETTERGB ( 67,205,128)},
181 {"Gray27" , PALETTERGB ( 69, 69, 69)},
182 {"Grey27" , PALETTERGB ( 69, 69, 69)},
183 {"chartreuse4" , PALETTERGB ( 69,139, 0)},
184 {"aquamarine4" , PALETTERGB ( 69,139,116)},
185 {"SteelBlue" , PALETTERGB ( 70,130,180)},
186 {"SlateBlue4" , PALETTERGB ( 71, 60,139)},
187 {"Gray28" , PALETTERGB ( 71, 71, 71)},
188 {"Grey28" , PALETTERGB ( 71, 71, 71)},
189 {"RoyalBlue1" , PALETTERGB ( 72,118,255)},
190 {"Gray29" , PALETTERGB ( 74, 74, 74)},
191 {"Grey29" , PALETTERGB ( 74, 74, 74)},
192 {"SkyBlue4" , PALETTERGB ( 74,112,139)},
193 {"Indigo" , PALETTERGB ( 75, 0,130)},
194 {"Gray30" , PALETTERGB ( 77, 77, 77)},
195 {"Grey30" , PALETTERGB ( 77, 77, 77)},
196 {"SeaGreen2" , PALETTERGB ( 78,238,148)},
197 {"Gray31" , PALETTERGB ( 79, 79, 79)},
198 {"Grey31" , PALETTERGB ( 79, 79, 79)},
199 {"SteelBlue3" , PALETTERGB ( 79,148,205)},
200 {"Gray32" , PALETTERGB ( 82, 82, 82)},
201 {"Grey32" , PALETTERGB ( 82, 82, 82)},
202 {"DarkSlateGray4" , PALETTERGB ( 82,139,139)},
203 {"CadetBlue4" , PALETTERGB ( 83,134,139)},
204 {"DimGray" , PALETTERGB ( 84, 84, 84)},
205 {"DimGrey" , PALETTERGB ( 84, 84, 84)},
206 {"Gray33" , PALETTERGB ( 84, 84, 84)},
207 {"Grey33" , PALETTERGB ( 84, 84, 84)},
208 {"PaleGreen4" , PALETTERGB ( 84,139, 84)},
209 {"SeaGreen1" , PALETTERGB ( 84,255,159)},
210 {"purple4" , PALETTERGB ( 85, 26,139)},
211 {"DarkOliveGreen" , PALETTERGB ( 85, 86, 47)},
212 {"Gray34" , PALETTERGB ( 87, 87, 87)},
213 {"Grey34" , PALETTERGB ( 87, 87, 87)},
214 {"Gray35" , PALETTERGB ( 89, 89, 89)},
215 {"Grey35" , PALETTERGB ( 89, 89, 89)},
216 {"Gray36" , PALETTERGB ( 92, 92, 92)},
217 {"Grey36" , PALETTERGB ( 92, 92, 92)},
218 {"SteelBlue2" , PALETTERGB ( 92,172,238)},
219 {"MediumPurple4" , PALETTERGB ( 93, 71,139)},
220 {"Gray37" , PALETTERGB ( 94, 94, 94)},
221 {"Grey37" , PALETTERGB ( 94, 94, 94)},
222 {"CadetBlue" , PALETTERGB ( 95,146,158)},
223 {"LightSkyBlue4" , PALETTERGB ( 96,123,139)},
224 {"Gray38" , PALETTERGB ( 97, 97, 97)},
225 {"Grey38" , PALETTERGB ( 97, 97, 97)},
226 {"Gray39" , PALETTERGB ( 99, 99, 99)},
227 {"Grey39" , PALETTERGB ( 99, 99, 99)},
228 {"SteelBlue1" , PALETTERGB ( 99,184,255)},
229 {"Gray40" , PALETTERGB (102,102,102)},
230 {"Grey40" , PALETTERGB (102,102,102)},
231 {"PaleTurquoise4" , PALETTERGB (102,139,139)},
232 {"chartreuse3" , PALETTERGB (102,205, 0)},
233 {"aquamarine3" , PALETTERGB (102,205,170)},
234 {"DarkOrchid4" , PALETTERGB (104, 34,139)},
235 {"LightBlue4" , PALETTERGB (104,131,139)},
236 {"SlateBlue3" , PALETTERGB (105, 89,205)},
237 {"Gray41" , PALETTERGB (105,105,105)},
238 {"Grey41" , PALETTERGB (105,105,105)},
239 {"OliveDrab4" , PALETTERGB (105,139, 34)},
240 {"DarkSeaGreen4" , PALETTERGB (105,139,105)},
241 {"SlateBlue" , PALETTERGB (106, 90,205)},
242 {"MediumSlateBlue" , PALETTERGB (106,106,141)},
243 {"IndianRed" , PALETTERGB (107, 57, 57)},
244 {"Gray42" , PALETTERGB (107,107,107)},
245 {"Grey42" , PALETTERGB (107,107,107)},
246 {"OliveDrab" , PALETTERGB (107,142, 35)},
247 {"SlateGray4" , PALETTERGB (108,123,139)},
248 {"SkyBlue3" , PALETTERGB (108,166,205)},
249 {"Gray43" , PALETTERGB (110,110,110)},
250 {"Grey43" , PALETTERGB (110,110,110)},
251 {"LightSteelBlue4" , PALETTERGB (110,123,139)},
252 {"DarkOliveGreen4" , PALETTERGB (110,139, 61)},
253 {"Gray44" , PALETTERGB (112,112,112)},
254 {"Grey44" , PALETTERGB (112,112,112)},
255 {"SlateGray" , PALETTERGB (112,128,144)},
256 {"SlateGrey" , PALETTERGB (112,128,144)},
257 {"SkyBlue" , PALETTERGB (114,159,255)},
258 {"Gray45" , PALETTERGB (115,115,115)},
259 {"Grey45" , PALETTERGB (115,115,115)},
260 {"PaleGreen" , PALETTERGB (115,222,120)},
261 {"Gray46" , PALETTERGB (117,117,117)},
262 {"Grey46" , PALETTERGB (117,117,117)},
263 {"chartreuse2" , PALETTERGB (118,238, 0)},
264 {"aquamarine2" , PALETTERGB (118,238,198)},
265 {"LightSlateGray" , PALETTERGB (119,136,153)},
266 {"LightSlateGrey" , PALETTERGB (119,136,153)},
267 {"Gray47" , PALETTERGB (120,120,120)},
268 {"Grey47" , PALETTERGB (120,120,120)},
269 {"DarkSlateGray3" , PALETTERGB (121,205,205)},
270 {"MediumOrchid4" , PALETTERGB (122, 55,139)},
271 {"SlateBlue2" , PALETTERGB (122,103,238)},
272 {"Gray48" , PALETTERGB (122,122,122)},
273 {"Grey48" , PALETTERGB (122,122,122)},
274 {"LightCyan4" , PALETTERGB (122,139,139)},
275 {"CadetBlue3" , PALETTERGB (122,197,205)},
276 {"LightSteelBlue" , PALETTERGB (124,152,211)},
277 {"PaleGreen3" , PALETTERGB (124,205,124)},
278 {"LawnGreen" , PALETTERGB (124,252, 0)},
279 {"purple3" , PALETTERGB (125, 38,205)},
280 {"Gray49" , PALETTERGB (125,125,125)},
281 {"Grey49" , PALETTERGB (125,125,125)},
282 {"Gray" , PALETTERGB (126,126,126)},
283 {"Grey" , PALETTERGB (126,126,126)},
284 {"SkyBlue2" , PALETTERGB (126,192,238)},
285 {"Gray50" , PALETTERGB (127,127,127)},
286 {"Grey50" , PALETTERGB (127,127,127)},
287 {"chartreuse" , PALETTERGB (127,255, 0)},
288 {"chartreuse1" , PALETTERGB (127,255, 0)},
289 {"aquamarine1" , PALETTERGB (127,255,212)},
290 {"Gray51" , PALETTERGB (130,130,130)},
291 {"Grey51" , PALETTERGB (130,130,130)},
292 {"SlateBlue1" , PALETTERGB (131,111,255)},
293 {"honeydew4" , PALETTERGB (131,139,131)},
294 {"azure4" , PALETTERGB (131,139,139)},
295 {"LightSlateBlue" , PALETTERGB (132,112,255)},
296 {"Gray52" , PALETTERGB (133,133,133)},
297 {"Grey52" , PALETTERGB (133,133,133)},
298 {"Gray53" , PALETTERGB (135,135,135)},
299 {"Grey53" , PALETTERGB (135,135,135)},
300 {"LightSkyBlue" , PALETTERGB (135,206,250)},
301 {"SkyBlue1" , PALETTERGB (135,206,255)},
302 {"MediumPurple3" , PALETTERGB (137,104,205)},
303 {"BlueViolet" , PALETTERGB (138, 43,226)},
304 {"Gray54" , PALETTERGB (138,138,138)},
305 {"Grey54" , PALETTERGB (138,138,138)},
306 {"red4" , PALETTERGB (139, 0, 0)},
307 {"magenta4" , PALETTERGB (139, 0,139)},
308 {"DeepPink4" , PALETTERGB (139, 10, 80)},
309 {"firebrick4" , PALETTERGB (139, 26, 26)},
310 {"maroon4" , PALETTERGB (139, 28, 98)},
311 {"DarkOrchid" , PALETTERGB (139, 32,139)},
312 {"VioletRed4" , PALETTERGB (139, 34, 82)},
313 {"brown4" , PALETTERGB (139, 35, 35)},
314 {"OrangeRed4" , PALETTERGB (139, 37, 0)},
315 {"tomato4" , PALETTERGB (139, 54, 38)},
316 {"IndianRed4" , PALETTERGB (139, 58, 58)},
317 {"HotPink4" , PALETTERGB (139, 58, 98)},
318 {"coral4" , PALETTERGB (139, 62, 47)},
319 {"DarkOrange4" , PALETTERGB (139, 69, 0)},
320 {"SaddleBrown" , PALETTERGB (139, 69, 19)},
321 {"chocolate4" , PALETTERGB (139, 69, 19)},
322 {"sienna4" , PALETTERGB (139, 71, 38)},
323 {"PaleVioletRed4" , PALETTERGB (139, 71, 93)},
324 {"orchid4" , PALETTERGB (139, 71,137)},
325 {"salmon4" , PALETTERGB (139, 76, 57)},
326 {"LightSalmon4" , PALETTERGB (139, 87, 66)},
327 {"orange4" , PALETTERGB (139, 90, 0)},
328 {"tan4" , PALETTERGB (139, 90, 43)},
329 {"LightPink4" , PALETTERGB (139, 95,101)},
330 {"pink4" , PALETTERGB (139, 99,108)},
331 {"DarkGoldenrod4" , PALETTERGB (139,101, 8)},
332 {"plum4" , PALETTERGB (139,102,139)},
333 {"goldenrod4" , PALETTERGB (139,105, 20)},
334 {"RosyBrown4" , PALETTERGB (139,105,105)},
335 {"burlywood4" , PALETTERGB (139,115, 85)},
336 {"gold4" , PALETTERGB (139,117, 0)},
337 {"PeachPuff4" , PALETTERGB (139,119,101)},
338 {"NavajoWhite4" , PALETTERGB (139,121, 94)},
339 {"thistle4" , PALETTERGB (139,123,139)},
340 {"bisque4" , PALETTERGB (139,125,107)},
341 {"MistyRose4" , PALETTERGB (139,125,123)},
342 {"wheat4" , PALETTERGB (139,126,102)},
343 {"LightGoldenrod4" , PALETTERGB (139,129, 76)},
344 {"AntiqueWhite4" , PALETTERGB (139,131,120)},
345 {"LavenderBlush4" , PALETTERGB (139,131,134)},
346 {"khaki4" , PALETTERGB (139,134, 78)},
347 {"seashell4" , PALETTERGB (139,134,130)},
348 {"cornsilk4" , PALETTERGB (139,136,120)},
349 {"LemonChiffon4" , PALETTERGB (139,137,112)},
350 {"snow4" , PALETTERGB (139,137,137)},
351 {"yellow4" , PALETTERGB (139,139, 0)},
352 {"LightYellow4" , PALETTERGB (139,139,122)},
353 {"ivory4" , PALETTERGB (139,139,131)},
354 {"Gray55" , PALETTERGB (140,140,140)},
355 {"Grey55" , PALETTERGB (140,140,140)},
356 {"LightSkyBlue3" , PALETTERGB (141,182,205)},
357 {"DarkSlateGray2" , PALETTERGB (141,238,238)},
358 {"Firebrick" , PALETTERGB (142, 35, 35)},
359 {"CadetBlue2" , PALETTERGB (142,229,238)},
360 {"Maroon" , PALETTERGB (143, 0, 82)},
361 {"Gray56" , PALETTERGB (143,143,143)},
362 {"Grey56" , PALETTERGB (143,143,143)},
363 {"DarkSeaGreen" , PALETTERGB (143,188,143)},
364 {"PaleGreen2" , PALETTERGB (144,238,144)},
365 {"purple2" , PALETTERGB (145, 44,238)},
366 {"Gray57" , PALETTERGB (145,145,145)},
367 {"Grey57" , PALETTERGB (145,145,145)},
368 {"MediumPurple" , PALETTERGB (147,112,219)},
369 {"DarkViolet" , PALETTERGB (148, 0,211)},
370 {"Gray58" , PALETTERGB (148,148,148)},
371 {"Grey58" , PALETTERGB (148,148,148)},
372 {"Sienna" , PALETTERGB (150, 82, 45)},
373 {"Gray59" , PALETTERGB (150,150,150)},
374 {"Grey59" , PALETTERGB (150,150,150)},
375 {"PaleTurquoise3" , PALETTERGB (150,205,205)},
376 {"DarkSlateGray1" , PALETTERGB (151,255,255)},
377 {"CadetBlue1" , PALETTERGB (152,245,255)},
378 {"Gray60" , PALETTERGB (153,153,153)},
379 {"Grey60" , PALETTERGB (153,153,153)},
380 {"DarkOrchid3" , PALETTERGB (154, 50,205)},
381 {"LightBlue3" , PALETTERGB (154,192,205)},
382 {"OliveDrab3" , PALETTERGB (154,205, 50)},
383 {"PaleGreen1" , PALETTERGB (154,255,154)},
384 {"purple1" , PALETTERGB (155, 48,255)},
385 {"DarkSeaGreen3" , PALETTERGB (155,205,155)},
386 {"Violet" , PALETTERGB (156, 62,206)},
387 {"Gray61" , PALETTERGB (156,156,156)},
388 {"Grey61" , PALETTERGB (156,156,156)},
389 {"Gray62" , PALETTERGB (158,158,158)},
390 {"Grey62" , PALETTERGB (158,158,158)},
391 {"MediumPurple2" , PALETTERGB (159,121,238)},
392 {"SlateGray3" , PALETTERGB (159,182,205)},
393 {"purple" , PALETTERGB (160, 32,240)},
394 {"Gray63" , PALETTERGB (161,161,161)},
395 {"Grey63" , PALETTERGB (161,161,161)},
396 {"LightSteelBlue3" , PALETTERGB (162,181,205)},
397 {"DarkOliveGreen3" , PALETTERGB (162,205, 90)},
398 {"Gray64" , PALETTERGB (163,163,163)},
399 {"Grey64" , PALETTERGB (163,163,163)},
400 {"LightSkyBlue2" , PALETTERGB (164,211,238)},
401 {"Brown" , PALETTERGB (165, 42, 42)},
402 {"Gray65" , PALETTERGB (166,166,166)},
403 {"Grey65" , PALETTERGB (166,166,166)},
404 {"Gray66" , PALETTERGB (168,168,168)},
405 {"Grey66" , PALETTERGB (168,168,168)},
406 {"LightGray" , PALETTERGB (168,168,168)},
407 {"LightGrey" , PALETTERGB (168,168,168)},
408 {"MediumPurple1" , PALETTERGB (171,130,255)},
409 {"Gray67" , PALETTERGB (171,171,171)},
410 {"Grey67" , PALETTERGB (171,171,171)},
411 {"Gray68" , PALETTERGB (173,173,173)},
412 {"Grey68" , PALETTERGB (173,173,173)},
413 {"LightBlue" , PALETTERGB (173,216,230)},
414 {"GreenYellow" , PALETTERGB (173,255, 47)},
415 {"PaleTurquoise2" , PALETTERGB (174,238,238)},
416 {"PaleTurquoise" , PALETTERGB (175,238,238)},
417 {"Gray69" , PALETTERGB (176,176,176)},
418 {"Grey69" , PALETTERGB (176,176,176)},
419 {"PowderBlue" , PALETTERGB (176,224,230)},
420 {"LightSkyBlue1" , PALETTERGB (176,226,255)},
421 {"DarkOrchid2" , PALETTERGB (178, 58,238)},
422 {"LightBlue2" , PALETTERGB (178,223,238)},
423 {"Khaki" , PALETTERGB (179,179,126)},
424 {"Gray70" , PALETTERGB (179,179,179)},
425 {"Grey70" , PALETTERGB (179,179,179)},
426 {"OliveDrab2" , PALETTERGB (179,238, 58)},
427 {"MediumOrchid3" , PALETTERGB (180, 82,205)},
428 {"LightCyan3" , PALETTERGB (180,205,205)},
429 {"DarkSeaGreen2" , PALETTERGB (180,238,180)},
430 {"Gray71" , PALETTERGB (181,181,181)},
431 {"Grey71" , PALETTERGB (181,181,181)},
432 {"DarkGoldenrod" , PALETTERGB (184,134, 11)},
433 {"Gray72" , PALETTERGB (184,184,184)},
434 {"Grey72" , PALETTERGB (184,184,184)},
435 {"SlateGray2" , PALETTERGB (185,211,238)},
436 {"MediumOrchid" , PALETTERGB (186, 85,211)},
437 {"Gray73" , PALETTERGB (186,186,186)},
438 {"Grey73" , PALETTERGB (186,186,186)},
439 {"PaleTurquoise1" , PALETTERGB (187,255,255)},
440 {"RosyBrown" , PALETTERGB (188,143,143)},
441 {"LightSteelBlue2" , PALETTERGB (188,210,238)},
442 {"DarkOliveGreen2" , PALETTERGB (188,238,104)},
443 {"DarkKhaki" , PALETTERGB (189,183,107)},
444 {"Gray74" , PALETTERGB (189,189,189)},
445 {"Grey74" , PALETTERGB (189,189,189)},
446 {"DarkOrchid1" , PALETTERGB (191, 62,255)},
447 {"Gray75" , PALETTERGB (191,191,191)},
448 {"Grey75" , PALETTERGB (191,191,191)},
449 {"LightBlue1" , PALETTERGB (191,239,255)},
450 {"OliveDrab1" , PALETTERGB (192,255, 62)},
451 {"honeydew3" , PALETTERGB (193,205,193)},
452 {"azure3" , PALETTERGB (193,205,205)},
453 {"DarkSeaGreen1" , PALETTERGB (193,255,193)},
454 {"Gray76" , PALETTERGB (194,194,194)},
455 {"Grey76" , PALETTERGB (194,194,194)},
456 {"Gray77" , PALETTERGB (196,196,196)},
457 {"Grey77" , PALETTERGB (196,196,196)},
458 {"Plum" , PALETTERGB (197, 72,155)},
459 {"SlateGray1" , PALETTERGB (198,226,255)},
460 {"MediumVioletRed" , PALETTERGB (199, 21,133)},
461 {"Gray78" , PALETTERGB (199,199,199)},
462 {"Grey78" , PALETTERGB (199,199,199)},
463 {"Gray79" , PALETTERGB (201,201,201)},
464 {"Grey79" , PALETTERGB (201,201,201)},
465 {"LightSteelBlue1" , PALETTERGB (202,225,255)},
466 {"DarkOliveGreen1" , PALETTERGB (202,255,112)},
467 {"Gray80" , PALETTERGB (204,204,204)},
468 {"Grey80" , PALETTERGB (204,204,204)},
469 {"red3" , PALETTERGB (205, 0, 0)},
470 {"magenta3" , PALETTERGB (205, 0,205)},
471 {"DeepPink3" , PALETTERGB (205, 16,118)},
472 {"firebrick3" , PALETTERGB (205, 38, 38)},
473 {"maroon3" , PALETTERGB (205, 41,144)},
474 {"VioletRed3" , PALETTERGB (205, 50,120)},
475 {"brown3" , PALETTERGB (205, 51, 51)},
476 {"OrangeRed3" , PALETTERGB (205, 55, 0)},
477 {"tomato3" , PALETTERGB (205, 79, 57)},
478 {"IndianRed3" , PALETTERGB (205, 85, 85)},
479 {"coral3" , PALETTERGB (205, 91, 69)},
480 {"HotPink3" , PALETTERGB (205, 96,144)},
481 {"DarkOrange3" , PALETTERGB (205,102, 0)},
482 {"chocolate3" , PALETTERGB (205,102, 29)},
483 {"sienna3" , PALETTERGB (205,104, 57)},
484 {"PaleVioletRed3" , PALETTERGB (205,104,137)},
485 {"orchid3" , PALETTERGB (205,105,201)},
486 {"salmon3" , PALETTERGB (205,112, 84)},
487 {"LightSalmon3" , PALETTERGB (205,129, 98)},
488 {"orange3" , PALETTERGB (205,133, 0)},
489 {"peru" , PALETTERGB (205,133, 63)},
490 {"tan3" , PALETTERGB (205,133, 63)},
491 {"LightPink3" , PALETTERGB (205,140,149)},
492 {"pink3" , PALETTERGB (205,145,158)},
493 {"DarkGoldenrod3" , PALETTERGB (205,149, 12)},
494 {"plum3" , PALETTERGB (205,150,205)},
495 {"goldenrod3" , PALETTERGB (205,155, 29)},
496 {"RosyBrown3" , PALETTERGB (205,155,155)},
497 {"burlywood3" , PALETTERGB (205,170,125)},
498 {"gold3" , PALETTERGB (205,173, 0)},
499 {"PeachPuff3" , PALETTERGB (205,175,149)},
500 {"NavajoWhite3" , PALETTERGB (205,179,139)},
501 {"thistle3" , PALETTERGB (205,181,205)},
502 {"bisque3" , PALETTERGB (205,183,158)},
503 {"MistyRose3" , PALETTERGB (205,183,181)},
504 {"wheat3" , PALETTERGB (205,186,150)},
505 {"LightGoldenrod3" , PALETTERGB (205,190,112)},
506 {"AntiqueWhite3" , PALETTERGB (205,192,176)},
507 {"LavenderBlush3" , PALETTERGB (205,193,197)},
508 {"seashell3" , PALETTERGB (205,197,191)},
509 {"khaki3" , PALETTERGB (205,198,115)},
510 {"cornsilk3" , PALETTERGB (205,200,177)},
511 {"LemonChiffon3" , PALETTERGB (205,201,165)},
512 {"snow3" , PALETTERGB (205,201,201)},
513 {"yellow3" , PALETTERGB (205,205, 0)},
514 {"LightYellow3" , PALETTERGB (205,205,180)},
515 {"ivory3" , PALETTERGB (205,205,193)},
516 {"Gray81" , PALETTERGB (207,207,207)},
517 {"Grey81" , PALETTERGB (207,207,207)},
518 {"VioletRed" , PALETTERGB (208, 32,144)},
519 {"MediumOrchid2" , PALETTERGB (209, 95,238)},
520 {"MediumGoldenrod" , PALETTERGB (209,193,102)},
521 {"Gray82" , PALETTERGB (209,209,209)},
522 {"Grey82" , PALETTERGB (209,209,209)},
523 {"LightCyan2" , PALETTERGB (209,238,238)},
524 {"chocolate" , PALETTERGB (210,105, 30)},
525 {"tan" , PALETTERGB (210,180,140)},
526 {"Gray83" , PALETTERGB (212,212,212)},
527 {"Grey83" , PALETTERGB (212,212,212)},
528 {"Gray84" , PALETTERGB (214,214,214)},
529 {"Grey84" , PALETTERGB (214,214,214)},
530 {"Thistle" , PALETTERGB (216,191,216)},
531 {"Gray85" , PALETTERGB (217,217,217)},
532 {"Grey85" , PALETTERGB (217,217,217)},
533 {"orchid" , PALETTERGB (218,112,214)},
534 {"goldenrod" , PALETTERGB (218,165, 32)},
535 {"Gold" , PALETTERGB (218,170, 0)},
536 {"PaleVioletRed" , PALETTERGB (219,112,147)},
537 {"Gray86" , PALETTERGB (219,219,219)},
538 {"Grey86" , PALETTERGB (219,219,219)},
539 {"Crimson" , PALETTERGB (220, 20, 60)},
540 {"gainsboro" , PALETTERGB (220,220,220)},
541 {"burlywood" , PALETTERGB (222,184,135)},
542 {"Gray87" , PALETTERGB (222,222,222)},
543 {"Grey87" , PALETTERGB (222,222,222)},
544 {"MediumOrchid1" , PALETTERGB (224,102,255)},
545 {"Gray88" , PALETTERGB (224,224,224)},
546 {"Grey88" , PALETTERGB (224,224,224)},
547 {"honeydew2" , PALETTERGB (224,238,224)},
548 {"azure2" , PALETTERGB (224,238,238)},
549 {"LightCyan" , PALETTERGB (224,255,255)},
550 {"LightCyan1" , PALETTERGB (224,255,255)},
551 {"Gray89" , PALETTERGB (227,227,227)},
552 {"Grey89" , PALETTERGB (227,227,227)},
553 {"Gray90" , PALETTERGB (229,229,229)},
554 {"Grey90" , PALETTERGB (229,229,229)},
555 {"lavender" , PALETTERGB (230,230,250)},
556 {"Gray91" , PALETTERGB (232,232,232)},
557 {"Grey91" , PALETTERGB (232,232,232)},
558 {"DarkSalmon" , PALETTERGB (233,150,122)},
559 {"Salmon" , PALETTERGB (233,150,122)},
560 {"Gray92" , PALETTERGB (235,235,235)},
561 {"Grey92" , PALETTERGB (235,235,235)},
562 {"Gray93" , PALETTERGB (237,237,237)},
563 {"Grey93" , PALETTERGB (237,237,237)},
564 {"red2" , PALETTERGB (238, 0, 0)},
565 {"magenta2" , PALETTERGB (238, 0,238)},
566 {"DeepPink2" , PALETTERGB (238, 18,137)},
567 {"firebrick2" , PALETTERGB (238, 44, 44)},
568 {"maroon2" , PALETTERGB (238, 48,167)},
569 {"VioletRed2" , PALETTERGB (238, 58,140)},
570 {"brown2" , PALETTERGB (238, 59, 59)},
571 {"OrangeRed2" , PALETTERGB (238, 64, 0)},
572 {"tomato2" , PALETTERGB (238, 92, 66)},
573 {"IndianRed2" , PALETTERGB (238, 99, 99)},
574 {"coral2" , PALETTERGB (238,106, 80)},
575 {"HotPink2" , PALETTERGB (238,106,167)},
576 {"DarkOrange2" , PALETTERGB (238,118, 0)},
577 {"chocolate2" , PALETTERGB (238,118, 33)},
578 {"sienna2" , PALETTERGB (238,121, 66)},
579 {"PaleVioletRed2" , PALETTERGB (238,121,159)},
580 {"orchid2" , PALETTERGB (238,122,233)},
581 {"salmon2" , PALETTERGB (238,130, 98)},
582 {"LightSalmon2" , PALETTERGB (238,149,114)},
583 {"orange2" , PALETTERGB (238,154, 0)},
584 {"tan2" , PALETTERGB (238,154, 73)},
585 {"LightPink2" , PALETTERGB (238,162,173)},
586 {"pink2" , PALETTERGB (238,169,184)},
587 {"DarkGoldenrod2" , PALETTERGB (238,173, 14)},
588 {"plum2" , PALETTERGB (238,174,238)},
589 {"goldenrod2" , PALETTERGB (238,180, 34)},
590 {"RosyBrown2" , PALETTERGB (238,180,180)},
591 {"burlywood2" , PALETTERGB (238,197,145)},
592 {"gold2" , PALETTERGB (238,201, 0)},
593 {"PeachPuff2" , PALETTERGB (238,203,173)},
594 {"NavajoWhite2" , PALETTERGB (238,207,161)},
595 {"thistle2" , PALETTERGB (238,210,238)},
596 {"bisque2" , PALETTERGB (238,213,183)},
597 {"MistyRose2" , PALETTERGB (238,213,210)},
598 {"wheat2" , PALETTERGB (238,216,174)},
599 {"LightGoldenrod2" , PALETTERGB (238,220,130)},
600 {"LightGoldenrod" , PALETTERGB (238,221,130)},
601 {"AntiqueWhite2" , PALETTERGB (238,223,204)},
602 {"LavenderBlush2" , PALETTERGB (238,224,229)},
603 {"seashell2" , PALETTERGB (238,229,222)},
604 {"khaki2" , PALETTERGB (238,230,133)},
605 {"PaleGoldenrod" , PALETTERGB (238,232,170)},
606 {"cornsilk2" , PALETTERGB (238,232,205)},
607 {"LemonChiffon2" , PALETTERGB (238,233,191)},
608 {"snow2" , PALETTERGB (238,233,233)},
609 {"yellow2" , PALETTERGB (238,238, 0)},
610 {"LightYellow2" , PALETTERGB (238,238,209)},
611 {"ivory2" , PALETTERGB (238,238,224)},
612 {"LightCoral" , PALETTERGB (240,128,128)},
613 {"Gray94" , PALETTERGB (240,240,240)},
614 {"Grey94" , PALETTERGB (240,240,240)},
615 {"AliceBlue" , PALETTERGB (240,248,255)},
616 {"honeydew" , PALETTERGB (240,255,240)},
617 {"honeydew1" , PALETTERGB (240,255,240)},
618 {"azure" , PALETTERGB (240,255,255)},
619 {"azure1" , PALETTERGB (240,255,255)},
620 {"Gray95" , PALETTERGB (242,242,242)},
621 {"Grey95" , PALETTERGB (242,242,242)},
622 {"SandyBrown" , PALETTERGB (244,164, 96)},
623 {"Wheat" , PALETTERGB (245,222,179)},
624 {"beige" , PALETTERGB (245,245,220)},
625 {"Gray96" , PALETTERGB (245,245,245)},
626 {"Grey96" , PALETTERGB (245,245,245)},
627 {"WhiteSmoke" , PALETTERGB (245,245,245)},
628 {"MintCream" , PALETTERGB (245,255,250)},
629 {"Gray97" , PALETTERGB (247,247,247)},
630 {"Grey97" , PALETTERGB (247,247,247)},
631 {"GhostWhite" , PALETTERGB (248,248,255)},
632 {"AntiqueWhite" , PALETTERGB (250,235,215)},
633 {"linen" , PALETTERGB (250,240,230)},
634 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)},
635 {"Gray98" , PALETTERGB (250,250,250)},
636 {"Grey98" , PALETTERGB (250,250,250)},
637 {"Gray99" , PALETTERGB (252,252,252)},
638 {"Grey99" , PALETTERGB (252,252,252)},
639 {"OldLace" , PALETTERGB (253,245,230)},
640 {"Red" , PALETTERGB (255, 0, 0)},
641 {"red1" , PALETTERGB (255, 0, 0)},
642 {"Magenta" , PALETTERGB (255, 0,255)},
643 {"magenta1" , PALETTERGB (255, 0,255)},
644 {"DeepPink" , PALETTERGB (255, 20,147)},
645 {"DeepPink1" , PALETTERGB (255, 20,147)},
646 {"firebrick1" , PALETTERGB (255, 48, 48)},
647 {"maroon1" , PALETTERGB (255, 52,179)},
648 {"VioletRed1" , PALETTERGB (255, 62,150)},
649 {"brown1" , PALETTERGB (255, 64, 64)},
650 {"OrangeRed" , PALETTERGB (255, 69, 0)},
651 {"OrangeRed1" , PALETTERGB (255, 69, 0)},
652 {"tomato" , PALETTERGB (255, 99, 71)},
653 {"tomato1" , PALETTERGB (255, 99, 71)},
654 {"HotPink" , PALETTERGB (255,105,180)},
655 {"IndianRed1" , PALETTERGB (255,106,106)},
656 {"HotPink1" , PALETTERGB (255,110,180)},
657 {"Coral" , PALETTERGB (255,114, 86)},
658 {"coral1" , PALETTERGB (255,114, 86)},
659 {"DarkOrange1" , PALETTERGB (255,127, 0)},
660 {"chocolate1" , PALETTERGB (255,127, 36)},
661 {"sienna1" , PALETTERGB (255,130, 71)},
662 {"PaleVioletRed1" , PALETTERGB (255,130,171)},
663 {"orchid1" , PALETTERGB (255,131,250)},
664 {"Orange" , PALETTERGB (255,135, 0)},
665 {"DarkOrange" , PALETTERGB (255,140, 0)},
666 {"salmon1" , PALETTERGB (255,140,105)},
667 {"LightSalmon" , PALETTERGB (255,160,122)},
668 {"LightSalmon1" , PALETTERGB (255,160,122)},
669 {"orange1" , PALETTERGB (255,165, 0)},
670 {"tan1" , PALETTERGB (255,165, 79)},
671 {"LightPink1" , PALETTERGB (255,174,185)},
672 {"Pink" , PALETTERGB (255,181,197)},
673 {"pink1" , PALETTERGB (255,181,197)},
674 {"LightPink" , PALETTERGB (255,182,193)},
675 {"DarkGoldenrod1" , PALETTERGB (255,185, 15)},
676 {"plum1" , PALETTERGB (255,187,255)},
677 {"goldenrod1" , PALETTERGB (255,193, 37)},
678 {"RosyBrown1" , PALETTERGB (255,193,193)},
679 {"burlywood1" , PALETTERGB (255,211,155)},
680 {"gold1" , PALETTERGB (255,215, 0)},
681 {"PeachPuff" , PALETTERGB (255,218,185)},
682 {"PeachPuff1" , PALETTERGB (255,218,185)},
683 {"NavajoWhite" , PALETTERGB (255,222,173)},
684 {"NavajoWhite1" , PALETTERGB (255,222,173)},
685 {"thistle1" , PALETTERGB (255,225,255)},
686 {"moccasin" , PALETTERGB (255,228,181)},
687 {"bisque" , PALETTERGB (255,228,196)},
688 {"bisque1" , PALETTERGB (255,228,196)},
689 {"MistyRose" , PALETTERGB (255,228,225)},
690 {"MistyRose1" , PALETTERGB (255,228,225)},
691 {"wheat1" , PALETTERGB (255,231,186)},
692 {"BlanchedAlmond" , PALETTERGB (255,235,205)},
693 {"LightGoldenrod1" , PALETTERGB (255,236,139)},
694 {"PapayaWhip" , PALETTERGB (255,239,213)},
695 {"AntiqueWhite1" , PALETTERGB (255,239,219)},
696 {"LavenderBlush" , PALETTERGB (255,240,245)},
697 {"LavenderBlush1" , PALETTERGB (255,240,245)},
698 {"seashell" , PALETTERGB (255,245,238)},
699 {"seashell1" , PALETTERGB (255,245,238)},
700 {"khaki1" , PALETTERGB (255,246,143)},
701 {"cornsilk" , PALETTERGB (255,248,220)},
702 {"cornsilk1" , PALETTERGB (255,248,220)},
703 {"LemonChiffon" , PALETTERGB (255,250,205)},
704 {"LemonChiffon1" , PALETTERGB (255,250,205)},
705 {"FloralWhite" , PALETTERGB (255,250,240)},
706 {"snow" , PALETTERGB (255,250,250)},
707 {"snow1" , PALETTERGB (255,250,250)},
708 {"Yellow" , PALETTERGB (255,255, 0)},
709 {"yellow1" , PALETTERGB (255,255, 0)},
710 {"LightYellow" , PALETTERGB (255,255,224)},
711 {"LightYellow1" , PALETTERGB (255,255,224)},
712 {"ivory" , PALETTERGB (255,255,240)},
713 {"ivory1" , PALETTERGB (255,255,240)},
714 {"Gray100" , PALETTERGB (255,255,255)},
715 {"Grey100" , PALETTERGB (255,255,255)},
716 {"White" , PALETTERGB (255,255,255)}
717 };
718
719 static COLORREF
720 mswindows_string_to_color(CONST char *name)
721 {
722 int color, i;
723
724 if (*name == '#')
725 {
726 /* mswindows numeric names look like "#BBGGRR" */
727 if (strlen(name)!=7)
728 return (-1);
729 for (i=1; i<7; i++)
730 if (!isxdigit(name[i]))
731 return(-1);
732 if (sscanf(name+1, "%x", &color) == 1)
733 return(0x02000000 | color); /* See PALETTERGB in docs */
734 }
735 else
736 {
737 for(i=0; i<(sizeof(mswindows_X_color_map)/sizeof(colormap_t)); i++)
738 if (!stricmp(name, mswindows_X_color_map[i].name))
739 return (mswindows_X_color_map[i].colorref);
740 }
741 return(-1);
742 }
743
744 static int
745 mswindows_initialize_color_instance (struct Lisp_Color_Instance *c, Lisp_Object name,
746 Lisp_Object device, Error_behavior errb)
747 {
748 CONST char *extname;
749 COLORREF color;
750
751 GET_C_STRING_CTEXT_DATA_ALLOCA (name, extname);
752 color = mswindows_string_to_color(extname);
753 if (color != -1)
754 {
755 c->data = xnew (struct mswindows_color_instance_data);
756 COLOR_INSTANCE_MSWINDOWS_COLOR (c) = color;
757 COLOR_INSTANCE_MSWINDOWS_BRUSH (c) = CreateSolidBrush (color);
758 return 1;
759 }
760 maybe_signal_simple_error ("unrecognized color", name, Qcolor, errb);
761 return(0);
762 }
763
764 static void
765 mswindows_mark_color_instance (struct Lisp_Color_Instance *c,
766 void (*markobj) (Lisp_Object))
767 {
768 }
769
770 static void
771 mswindows_print_color_instance (struct Lisp_Color_Instance *c,
772 Lisp_Object printcharfun,
773 int escapeflag)
774 {
775 char buf[32];
776 COLORREF color = COLOR_INSTANCE_MSWINDOWS_COLOR (c);
777 sprintf (buf, " %06ld=(%02X,%02X,%02X)", color & 0xffffff,
778 GetRValue(color), GetGValue(color), GetBValue(color));
779 write_c_string (buf, printcharfun);
780 }
781
782 static void
783 mswindows_finalize_color_instance (struct Lisp_Color_Instance *c)
784 {
785 if (c->data)
786 {
787 DeleteObject (COLOR_INSTANCE_MSWINDOWS_BRUSH (c));
788 xfree (c->data);
789 c->data = 0;
790 }
791 }
792
793 static int
794 mswindows_color_instance_equal (struct Lisp_Color_Instance *c1,
795 struct Lisp_Color_Instance *c2,
796 int depth)
797 {
798 return (COLOR_INSTANCE_MSWINDOWS_COLOR(c1) == COLOR_INSTANCE_MSWINDOWS_COLOR(c2));
799 }
800
801 static unsigned long
802 mswindows_color_instance_hash (struct Lisp_Color_Instance *c, int depth)
803 {
804 return LISP_HASH (COLOR_INSTANCE_MSWINDOWS_COLOR(c));
805 }
806
807 static Lisp_Object
808 mswindows_color_instance_rgb_components (struct Lisp_Color_Instance *c)
809 {
810 COLORREF color = COLOR_INSTANCE_MSWINDOWS_COLOR (c);
811 return (list3 (make_int (GetRValue(color)),
812 make_int (GetGValue(color)),
813 make_int (GetBValue(color))));
814 }
815
816 static int
817 mswindows_valid_color_name_p (struct device *d, Lisp_Object color)
818 {
819 CONST char *extname;
820
821 GET_C_STRING_CTEXT_DATA_ALLOCA (color, extname);
822 return (mswindows_string_to_color(extname)!=-1);
823 }
824
825
826
827 static void
828 mswindows_finalize_font_instance (struct Lisp_Font_Instance *f)
829 {
830 if (f->data)
831 {
832 DeleteObject(f->data);
833 f->data=0;
834 }
835 }
836
837 static int
838 mswindows_initialize_font_instance (struct Lisp_Font_Instance *f, Lisp_Object name,
839 Lisp_Object device, Error_behavior errb)
840 {
841 CONST char *extname;
842 LOGFONT logfont;
843 int fields;
844 int pt;
845 char fontname[LF_FACESIZE], weight[32], *style, points[8], effects[32], charset[32];
846
847 GET_C_STRING_CTEXT_DATA_ALLOCA (f->name, extname);
848
849 /*
850 * mswindows fonts look like:
851 * fontname[:[weight ][style][:pointsize[:effects[:charset]]]]
852 * The font name field shouldn't be empty.
853 * XXX Windows will substitute a default (monospace) font if the font name
854 * specifies a non-existent font. We don't catch this.
855 * effects and charset are currently ignored.
856 *
857 * ie:
858 * Lucida Console:Regular:10
859 * minimal:
860 * Courier New
861 * maximal:
862 * Courier New:Bold Italic:10:underline strikeout:ansi
863 */
864 fields = sscanf (extname, "%31[^:]:%31[^:]:%7[^:]:%31[^:]:%31s",
865 fontname, weight, points, effects, charset);
866
867 if (fields<0)
868 {
869 maybe_signal_simple_error ("Invalid font", f->name, Qfont, errb);
870 return (0);
871 }
872
873 if (fields>0 && strlen(fontname))
874 {
875 strncpy (logfont.lfFaceName, fontname, LF_FACESIZE);
876 logfont.lfFaceName[LF_FACESIZE-1] = 0;
877 }
878 else
879 {
880 maybe_signal_simple_error ("Must specify a font name", f->name, Qfont, errb);
881 return (0);
882 }
883
884 if (fields > 1 && strlen(weight))
885 {
886 char *c;
887 /* Maybe split weight into weight and style */
888 if (c=strchr(weight, ' '))
889 {
890 *c = '\0';
891 style = c+1;
892 }
893 else
894 style = NULL;
895
896 /* weight: Most-often used (maybe) first */
897 if (stricmp (weight,"regular") == 0)
898 logfont.lfWeight = FW_REGULAR;
899 else if (stricmp (weight,"normal") == 0)
900 logfont.lfWeight = FW_NORMAL;
901 else if (stricmp (weight,"bold") == 0)
902 logfont.lfWeight = FW_BOLD;
903 else if (stricmp (weight,"medium") == 0)
904 logfont.lfWeight = FW_MEDIUM;
905 else if (stricmp (weight,"italic") == 0) /* Hack for early exit */
906 {
907 logfont.lfWeight = FW_NORMAL;
908 style=weight;
909 }
910 /* the rest */
911 else if (stricmp (weight,"black") == 0)
912 logfont.lfWeight = FW_BLACK;
913 else if (stricmp (weight,"heavy") == 0)
914 logfont.lfWeight = FW_HEAVY;
915 else if (stricmp (weight,"ultrabold") == 0)
916 logfont.lfWeight = FW_ULTRABOLD;
917 else if (stricmp (weight,"extrabold") == 0)
918 logfont.lfWeight = FW_EXTRABOLD;
919 else if (stricmp (weight,"demibold") == 0)
920 logfont.lfWeight = FW_SEMIBOLD;
921 else if (stricmp (weight,"semibold") == 0)
922 logfont.lfWeight = FW_SEMIBOLD;
923 else if (stricmp (weight,"light") == 0)
924 logfont.lfWeight = FW_LIGHT;
925 else if (stricmp (weight,"ultralight") == 0)
926 logfont.lfWeight = FW_ULTRALIGHT;
927 else if (stricmp (weight,"extralight") == 0)
928 logfont.lfWeight = FW_EXTRALIGHT;
929 else if (stricmp (weight,"thin") == 0)
930 logfont.lfWeight = FW_THIN;
931 else
932 {
933 logfont.lfWeight = FW_NORMAL;
934 if (!style)
935 style = weight; /* May have specified a style without a weight */
936 else
937 {
938 maybe_signal_simple_error ("Invalid font weight", f->name, Qfont, errb);
939 return (0); /* Invalid weight */
940 }
941 }
942
943 if (style)
944 {
945 /* XXX what about oblique? */
946 if (stricmp (style,"italic") == 0)
947 logfont.lfItalic = TRUE;
948 else if (stricmp (style,"roman") == 0)
949 logfont.lfItalic = FALSE;
950 else
951 {
952 maybe_signal_simple_error ("Invalid font weight or style", f->name, Qfont, errb);
953 return (0); /* Invalid weight or style */
954 }
955 }
956 else
957 {
958 logfont.lfItalic = FALSE;
959 }
960
961 }
962 else
963 {
964 logfont.lfWeight = FW_NORMAL;
965 logfont.lfItalic = FALSE;
966 }
967
968 /* XXX Should we reject strings that don't specify a size? */
969 if (fields < 3 || !strlen(points) || (pt=atoi(points))==0)
970 pt = 10;
971
972 /* Formula for pointsize->height from LOGFONT docs in MSVC5 Platform SDK */
973 logfont.lfHeight = -MulDiv(pt, DEVICE_MSWINDOWS_LOGPIXELSY(XDEVICE (device)), 72);
974 logfont.lfWidth = 0;
975
976 /* Default to monospaced if the specified font name is not found */
977 logfont.lfPitchAndFamily = FF_MODERN;
978
979 /* XXX: FIXME? */
980 logfont.lfUnderline = FALSE;
981 logfont.lfStrikeOut = FALSE;
982
983 /* XXX: FIXME: we ignore charset */
984 logfont.lfCharSet = DEFAULT_CHARSET;
985
986 /* Misc crud */
987 logfont.lfEscapement = logfont.lfOrientation = 0;
988 #if 1
989 logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
990 logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
991 logfont.lfQuality = DEFAULT_QUALITY;
992 #else
993 logfont.lfOutPrecision = OUT_STROKE_PRECIS;
994 logfont.lfClipPrecision = CLIP_STROKE_PRECIS;
995 logfont.lfQuality = PROOF_QUALITY;
996 #endif
997
998 if ((f->data = CreateFontIndirect(&logfont)) == NULL)
999 {
1000 maybe_signal_simple_error ("Couldn't create font", f->name, Qfont, errb);
1001 return 0;
1002 }
1003
1004 /* Have to apply Font to a GC to get its values.
1005 * We'll borrow the desktop window becuase its the only window that we
1006 * know about that is guaranteed to exist when this gets called
1007 */
1008 {
1009 HWND hwnd;
1010 HDC hdc;
1011 HFONT holdfont;
1012 TEXTMETRIC metrics;
1013
1014 hwnd = GetDesktopWindow();
1015 assert(hdc = GetDC(hwnd)); /* XXX FIXME: can this temporarily fail? */
1016 holdfont = SelectObject(hdc, f->data);
1017 if (!holdfont)
1018 {
1019 mswindows_finalize_font_instance (f);
1020 maybe_signal_simple_error ("Couldn't map font", f->name, Qfont, errb);
1021 return 0;
1022 }
1023 GetTextMetrics(hdc, &metrics);
1024 SelectObject(hdc, holdfont);
1025 ReleaseDC(hwnd, hdc);
1026 f->width = metrics.tmAveCharWidth;
1027 f->height = metrics.tmHeight;
1028 f->ascent = metrics.tmAscent;
1029 f->descent = metrics.tmDescent;
1030 f->proportional_p = (metrics.tmPitchAndFamily & TMPF_FIXED_PITCH);
1031 }
1032
1033 return 1;
1034 }
1035
1036 static void
1037 mswindows_mark_font_instance (struct Lisp_Font_Instance *f,
1038 void (*markobj) (Lisp_Object))
1039 {
1040 }
1041
1042 static void
1043 mswindows_print_font_instance (struct Lisp_Font_Instance *f,
1044 Lisp_Object printcharfun,
1045 int escapeflag)
1046 {
1047 }
1048
1049 static Lisp_Object
1050 mswindows_list_fonts (Lisp_Object pattern, Lisp_Object device)
1051 {
1052 /* XXX Implement me */
1053 return list1 (build_string ("Courier New:Regular:10"));
1054 }
1055
1056
1057
1058 /************************************************************************/
1059 /* initialization */
1060 /************************************************************************/
1061
1062 void
1063 syms_of_objects_mswindows (void)
1064 {
1065 }
1066
1067 void
1068 console_type_create_objects_mswindows (void)
1069 {
1070 /* object methods */
1071 CONSOLE_HAS_METHOD (mswindows, initialize_color_instance);
1072 /* CONSOLE_HAS_METHOD (mswindows, mark_color_instance); */
1073 CONSOLE_HAS_METHOD (mswindows, print_color_instance);
1074 CONSOLE_HAS_METHOD (mswindows, finalize_color_instance);
1075 CONSOLE_HAS_METHOD (mswindows, color_instance_equal);
1076 CONSOLE_HAS_METHOD (mswindows, color_instance_hash);
1077 CONSOLE_HAS_METHOD (mswindows, color_instance_rgb_components);
1078 CONSOLE_HAS_METHOD (mswindows, valid_color_name_p);
1079
1080 CONSOLE_HAS_METHOD (mswindows, initialize_font_instance);
1081 /* CONSOLE_HAS_METHOD (mswindows, mark_font_instance); */
1082 CONSOLE_HAS_METHOD (mswindows, print_font_instance);
1083 CONSOLE_HAS_METHOD (mswindows, finalize_font_instance);
1084 /* CONSOLE_HAS_METHOD (mswindows, font_instance_truename); */
1085 CONSOLE_HAS_METHOD (mswindows, list_fonts);
1086 #ifdef MULE
1087 CONSOLE_HAS_METHOD (mswindows, font_spec_matches_charset);
1088 CONSOLE_HAS_METHOD (mswindows, find_charset_font);
1089 #endif
1090 }
1091
1092 void
1093 vars_of_objects_mswindows (void)
1094 {
1095 }