annotate src/objects-w32.c @ 209:41ff10fd062f r20-4b3

Import from CVS: tag r20-4b3
author cvs
date Mon, 13 Aug 2007 10:04:58 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1 /* win32-specific Lisp objects.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3 Copyright (C) 1995 Board of Trustees, University of Illinois.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
4 Copyright (C) 1995 Tinker Systems.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
5 Copyright (C) 1995, 1996 Ben Wing.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
6 Copyright (C) 1995 Sun Microsystems, Inc.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
7 Copyright (C) 1997 Jonathan Harris.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
8
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
9 This file is part of XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
10
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
11 XEmacs is free software; you can redistribute it and/or modify it
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
12 under the terms of the GNU General Public License as published by the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
13 Free Software Foundation; either version 2, or (at your option) any
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
14 later version.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
15
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
16 XEmacs is distributed in the hope that it will be useful, but WITHOUT
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
19 for more details.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
20
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
21 You should have received a copy of the GNU General Public License
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
22 along with XEmacs; see the file COPYING. If not, write to
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
23 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
24 Boston, MA 02111-1307, USA. */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
25
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
26 /* Synched up with: Not in FSF. */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
27
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
28 /* Authorship:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
29
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
30 Jamie Zawinski, Chuck Thompson, Ben Wing
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
31 Rewritten for win32 by Jonathan Harris, November 1997 for 20.4.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
32 */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
33
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
34
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
35 /* TODO: palette handling */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
36
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
37 #include <config.h>
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
38 #include "lisp.h"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
39
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
40 #include "console-w32.h"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
41 #include "objects-w32.h"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
42
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
43 #ifdef MULE
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
44 #include "mule-charset.h"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
45 #endif
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
46
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
47 #include "buffer.h"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
48 #include "device.h"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
49 #include "insdel.h"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
50
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
51 #include "windows.h"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
52
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
53 typedef struct colormap_t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
54 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
55 char *name;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
56 COLORREF colorref;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
57 } colormap_t;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
58
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
59 static colormap_t w32_X_color_map[] =
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
60 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
61 {"snow" , PALETTERGB (255,250,250)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
62 {"ghost white" , PALETTERGB (248,248,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
63 {"GhostWhite" , PALETTERGB (248,248,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
64 {"white smoke" , PALETTERGB (245,245,245)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
65 {"WhiteSmoke" , PALETTERGB (245,245,245)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
66 {"gainsboro" , PALETTERGB (220,220,220)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
67 {"floral white" , PALETTERGB (255,250,240)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
68 {"FloralWhite" , PALETTERGB (255,250,240)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
69 {"old lace" , PALETTERGB (253,245,230)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
70 {"OldLace" , PALETTERGB (253,245,230)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
71 {"linen" , PALETTERGB (250,240,230)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
72 {"antique white" , PALETTERGB (250,235,215)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
73 {"AntiqueWhite" , PALETTERGB (250,235,215)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
74 {"papaya whip" , PALETTERGB (255,239,213)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
75 {"PapayaWhip" , PALETTERGB (255,239,213)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
76 {"blanched almond" , PALETTERGB (255,235,205)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
77 {"BlanchedAlmond" , PALETTERGB (255,235,205)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
78 {"bisque" , PALETTERGB (255,228,196)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
79 {"peach puff" , PALETTERGB (255,218,185)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
80 {"PeachPuff" , PALETTERGB (255,218,185)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
81 {"navajo white" , PALETTERGB (255,222,173)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
82 {"NavajoWhite" , PALETTERGB (255,222,173)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
83 {"moccasin" , PALETTERGB (255,228,181)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
84 {"cornsilk" , PALETTERGB (255,248,220)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
85 {"ivory" , PALETTERGB (255,255,240)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
86 {"lemon chiffon" , PALETTERGB (255,250,205)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
87 {"LemonChiffon" , PALETTERGB (255,250,205)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
88 {"seashell" , PALETTERGB (255,245,238)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
89 {"honeydew" , PALETTERGB (240,255,240)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
90 {"mint cream" , PALETTERGB (245,255,250)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
91 {"MintCream" , PALETTERGB (245,255,250)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
92 {"azure" , PALETTERGB (240,255,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
93 {"alice blue" , PALETTERGB (240,248,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
94 {"AliceBlue" , PALETTERGB (240,248,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
95 {"lavender" , PALETTERGB (230,230,250)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
96 {"lavender blush" , PALETTERGB (255,240,245)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
97 {"LavenderBlush" , PALETTERGB (255,240,245)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
98 {"misty rose" , PALETTERGB (255,228,225)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
99 {"MistyRose" , PALETTERGB (255,228,225)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
100 {"white" , PALETTERGB (255,255,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
101 {"black" , PALETTERGB ( 0, 0, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
102 {"dark slate gray" , PALETTERGB ( 47, 79, 79)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
103 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
104 {"dark slate grey" , PALETTERGB ( 47, 79, 79)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
105 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
106 {"dim gray" , PALETTERGB (105,105,105)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
107 {"DimGray" , PALETTERGB (105,105,105)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
108 {"dim grey" , PALETTERGB (105,105,105)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
109 {"DimGrey" , PALETTERGB (105,105,105)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
110 {"slate gray" , PALETTERGB (112,128,144)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
111 {"SlateGray" , PALETTERGB (112,128,144)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
112 {"slate grey" , PALETTERGB (112,128,144)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
113 {"SlateGrey" , PALETTERGB (112,128,144)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
114 {"light slate gray" , PALETTERGB (119,136,153)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
115 {"LightSlateGray" , PALETTERGB (119,136,153)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
116 {"light slate grey" , PALETTERGB (119,136,153)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
117 {"LightSlateGrey" , PALETTERGB (119,136,153)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
118 {"gray" , PALETTERGB (190,190,190)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
119 {"grey" , PALETTERGB (190,190,190)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
120 {"light grey" , PALETTERGB (211,211,211)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
121 {"LightGrey" , PALETTERGB (211,211,211)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
122 {"light gray" , PALETTERGB (211,211,211)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
123 {"LightGray" , PALETTERGB (211,211,211)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
124 {"midnight blue" , PALETTERGB ( 25, 25,112)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
125 {"MidnightBlue" , PALETTERGB ( 25, 25,112)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
126 {"navy" , PALETTERGB ( 0, 0,128)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
127 {"navy blue" , PALETTERGB ( 0, 0,128)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
128 {"NavyBlue" , PALETTERGB ( 0, 0,128)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
129 {"cornflower blue" , PALETTERGB (100,149,237)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
130 {"CornflowerBlue" , PALETTERGB (100,149,237)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
131 {"dark slate blue" , PALETTERGB ( 72, 61,139)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
132 {"DarkSlateBlue" , PALETTERGB ( 72, 61,139)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
133 {"slate blue" , PALETTERGB (106, 90,205)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
134 {"SlateBlue" , PALETTERGB (106, 90,205)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
135 {"medium slate blue" , PALETTERGB (123,104,238)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
136 {"MediumSlateBlue" , PALETTERGB (123,104,238)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
137 {"light slate blue" , PALETTERGB (132,112,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
138 {"LightSlateBlue" , PALETTERGB (132,112,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
139 {"medium blue" , PALETTERGB ( 0, 0,205)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
140 {"MediumBlue" , PALETTERGB ( 0, 0,205)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
141 {"royal blue" , PALETTERGB ( 65,105,225)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
142 {"RoyalBlue" , PALETTERGB ( 65,105,225)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
143 {"blue" , PALETTERGB ( 0, 0,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
144 {"dodger blue" , PALETTERGB ( 30,144,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
145 {"DodgerBlue" , PALETTERGB ( 30,144,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
146 {"deep sky blue" , PALETTERGB ( 0,191,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
147 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
148 {"sky blue" , PALETTERGB (135,206,235)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
149 {"SkyBlue" , PALETTERGB (135,206,235)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
150 {"light sky blue" , PALETTERGB (135,206,250)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
151 {"LightSkyBlue" , PALETTERGB (135,206,250)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
152 {"steel blue" , PALETTERGB ( 70,130,180)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
153 {"SteelBlue" , PALETTERGB ( 70,130,180)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
154 {"light steel blue" , PALETTERGB (176,196,222)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
155 {"LightSteelBlue" , PALETTERGB (176,196,222)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
156 {"light blue" , PALETTERGB (173,216,230)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
157 {"LightBlue" , PALETTERGB (173,216,230)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
158 {"powder blue" , PALETTERGB (176,224,230)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
159 {"PowderBlue" , PALETTERGB (176,224,230)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
160 {"pale turquoise" , PALETTERGB (175,238,238)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
161 {"PaleTurquoise" , PALETTERGB (175,238,238)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
162 {"dark turquoise" , PALETTERGB ( 0,206,209)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
163 {"DarkTurquoise" , PALETTERGB ( 0,206,209)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
164 {"medium turquoise" , PALETTERGB ( 72,209,204)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
165 {"MediumTurquoise" , PALETTERGB ( 72,209,204)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
166 {"turquoise" , PALETTERGB ( 64,224,208)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
167 {"cyan" , PALETTERGB ( 0,255,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
168 {"light cyan" , PALETTERGB (224,255,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
169 {"LightCyan" , PALETTERGB (224,255,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
170 {"cadet blue" , PALETTERGB ( 95,158,160)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
171 {"CadetBlue" , PALETTERGB ( 95,158,160)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
172 {"medium aquamarine" , PALETTERGB (102,205,170)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
173 {"MediumAquamarine" , PALETTERGB (102,205,170)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
174 {"aquamarine" , PALETTERGB (127,255,212)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
175 {"dark green" , PALETTERGB ( 0,100, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
176 {"DarkGreen" , PALETTERGB ( 0,100, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
177 {"dark olive green" , PALETTERGB ( 85,107, 47)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
178 {"DarkOliveGreen" , PALETTERGB ( 85,107, 47)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
179 {"dark sea green" , PALETTERGB (143,188,143)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
180 {"DarkSeaGreen" , PALETTERGB (143,188,143)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
181 {"sea green" , PALETTERGB ( 46,139, 87)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
182 {"SeaGreen" , PALETTERGB ( 46,139, 87)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
183 {"medium sea green" , PALETTERGB ( 60,179,113)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
184 {"MediumSeaGreen" , PALETTERGB ( 60,179,113)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
185 {"light sea green" , PALETTERGB ( 32,178,170)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
186 {"LightSeaGreen" , PALETTERGB ( 32,178,170)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
187 {"pale green" , PALETTERGB (152,251,152)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
188 {"PaleGreen" , PALETTERGB (152,251,152)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
189 {"spring green" , PALETTERGB ( 0,255,127)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
190 {"SpringGreen" , PALETTERGB ( 0,255,127)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
191 {"lawn green" , PALETTERGB (124,252, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
192 {"LawnGreen" , PALETTERGB (124,252, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
193 {"green" , PALETTERGB ( 0,255, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
194 {"chartreuse" , PALETTERGB (127,255, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
195 {"medium spring green" , PALETTERGB ( 0,250,154)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
196 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
197 {"green yellow" , PALETTERGB (173,255, 47)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
198 {"GreenYellow" , PALETTERGB (173,255, 47)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
199 {"lime green" , PALETTERGB ( 50,205, 50)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
200 {"LimeGreen" , PALETTERGB ( 50,205, 50)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
201 {"yellow green" , PALETTERGB (154,205, 50)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
202 {"YellowGreen" , PALETTERGB (154,205, 50)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
203 {"forest green" , PALETTERGB ( 34,139, 34)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
204 {"ForestGreen" , PALETTERGB ( 34,139, 34)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
205 {"olive drab" , PALETTERGB (107,142, 35)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
206 {"OliveDrab" , PALETTERGB (107,142, 35)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
207 {"dark khaki" , PALETTERGB (189,183,107)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
208 {"DarkKhaki" , PALETTERGB (189,183,107)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
209 {"khaki" , PALETTERGB (240,230,140)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
210 {"pale goldenrod" , PALETTERGB (238,232,170)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
211 {"PaleGoldenrod" , PALETTERGB (238,232,170)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
212 {"light goldenrod yellow" , PALETTERGB (250,250,210)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
213 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
214 {"light yellow" , PALETTERGB (255,255,224)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
215 {"LightYellow" , PALETTERGB (255,255,224)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
216 {"yellow" , PALETTERGB (255,255, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
217 {"gold" , PALETTERGB (255,215, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
218 {"light goldenrod" , PALETTERGB (238,221,130)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
219 {"LightGoldenrod" , PALETTERGB (238,221,130)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
220 {"goldenrod" , PALETTERGB (218,165, 32)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
221 {"dark goldenrod" , PALETTERGB (184,134, 11)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
222 {"DarkGoldenrod" , PALETTERGB (184,134, 11)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
223 {"rosy brown" , PALETTERGB (188,143,143)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
224 {"RosyBrown" , PALETTERGB (188,143,143)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
225 {"indian red" , PALETTERGB (205, 92, 92)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
226 {"IndianRed" , PALETTERGB (205, 92, 92)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
227 {"saddle brown" , PALETTERGB (139, 69, 19)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
228 {"SaddleBrown" , PALETTERGB (139, 69, 19)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
229 {"sienna" , PALETTERGB (160, 82, 45)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
230 {"peru" , PALETTERGB (205,133, 63)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
231 {"burlywood" , PALETTERGB (222,184,135)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
232 {"beige" , PALETTERGB (245,245,220)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
233 {"wheat" , PALETTERGB (245,222,179)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
234 {"sandy brown" , PALETTERGB (244,164, 96)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
235 {"SandyBrown" , PALETTERGB (244,164, 96)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
236 {"tan" , PALETTERGB (210,180,140)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
237 {"chocolate" , PALETTERGB (210,105, 30)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
238 {"firebrick" , PALETTERGB (178, 34, 34)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
239 {"brown" , PALETTERGB (165, 42, 42)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
240 {"dark salmon" , PALETTERGB (233,150,122)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
241 {"DarkSalmon" , PALETTERGB (233,150,122)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
242 {"salmon" , PALETTERGB (250,128,114)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
243 {"light salmon" , PALETTERGB (255,160,122)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
244 {"LightSalmon" , PALETTERGB (255,160,122)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
245 {"orange" , PALETTERGB (255,165, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
246 {"dark orange" , PALETTERGB (255,140, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
247 {"DarkOrange" , PALETTERGB (255,140, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
248 {"coral" , PALETTERGB (255,127, 80)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
249 {"light coral" , PALETTERGB (240,128,128)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
250 {"LightCoral" , PALETTERGB (240,128,128)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
251 {"tomato" , PALETTERGB (255, 99, 71)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
252 {"orange red" , PALETTERGB (255, 69, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
253 {"OrangeRed" , PALETTERGB (255, 69, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
254 {"red" , PALETTERGB (255, 0, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
255 {"hot pink" , PALETTERGB (255,105,180)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
256 {"HotPink" , PALETTERGB (255,105,180)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
257 {"deep pink" , PALETTERGB (255, 20,147)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
258 {"DeepPink" , PALETTERGB (255, 20,147)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
259 {"pink" , PALETTERGB (255,192,203)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
260 {"light pink" , PALETTERGB (255,182,193)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
261 {"LightPink" , PALETTERGB (255,182,193)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
262 {"pale violet red" , PALETTERGB (219,112,147)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
263 {"PaleVioletRed" , PALETTERGB (219,112,147)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
264 {"maroon" , PALETTERGB (176, 48, 96)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
265 {"medium violet red" , PALETTERGB (199, 21,133)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
266 {"MediumVioletRed" , PALETTERGB (199, 21,133)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
267 {"violet red" , PALETTERGB (208, 32,144)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
268 {"VioletRed" , PALETTERGB (208, 32,144)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
269 {"magenta" , PALETTERGB (255, 0,255)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
270 {"violet" , PALETTERGB (238,130,238)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
271 {"plum" , PALETTERGB (221,160,221)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
272 {"orchid" , PALETTERGB (218,112,214)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
273 {"medium orchid" , PALETTERGB (186, 85,211)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
274 {"MediumOrchid" , PALETTERGB (186, 85,211)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
275 {"dark orchid" , PALETTERGB (153, 50,204)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
276 {"DarkOrchid" , PALETTERGB (153, 50,204)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
277 {"dark violet" , PALETTERGB (148, 0,211)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
278 {"DarkViolet" , PALETTERGB (148, 0,211)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
279 {"blue violet" , PALETTERGB (138, 43,226)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
280 {"BlueViolet" , PALETTERGB (138, 43,226)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
281 {"purple" , PALETTERGB (160, 32,240)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
282 {"medium purple" , PALETTERGB (147,112,219)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
283 {"MediumPurple" , PALETTERGB (147,112,219)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
284 {"thistle" , PALETTERGB (216,191,216)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
285 {"gray0" , PALETTERGB ( 0, 0, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
286 {"grey0" , PALETTERGB ( 0, 0, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
287 {"dark grey" , PALETTERGB (169,169,169)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
288 {"DarkGrey" , PALETTERGB (169,169,169)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
289 {"dark gray" , PALETTERGB (169,169,169)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
290 {"DarkGray" , PALETTERGB (169,169,169)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
291 {"dark blue" , PALETTERGB ( 0, 0,139)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
292 {"DarkBlue" , PALETTERGB ( 0, 0,139)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
293 {"dark cyan" , PALETTERGB ( 0,139,139)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
294 {"DarkCyan" , PALETTERGB ( 0,139,139)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
295 {"dark magenta" , PALETTERGB (139, 0,139)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
296 {"DarkMagenta" , PALETTERGB (139, 0,139)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
297 {"dark red" , PALETTERGB (139, 0, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
298 {"DarkRed" , PALETTERGB (139, 0, 0)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
299 {"light green" , PALETTERGB (144,238,144)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
300 {"LightGreen" , PALETTERGB (144,238,144)},
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
301 };
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
302
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
303 static COLORREF
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
304 w32_string_to_color(CONST char *name)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
305 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
306 int color, i;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
307
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
308 if (*name == '#')
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
309 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
310 /* w32 numeric names look like "#BBGGRR" */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
311 if (strlen(name)!=7)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
312 return (-1);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
313 for (i=1; i<7; i++)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
314 if (!isxdigit(name[i]))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
315 return(-1);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
316 if (sscanf(name+1, "%x", &color) == 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
317 return(0x02000000 | color); /* See PALETTERGB in docs */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
318 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
319 else
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
320 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
321 for(i=0; i<(sizeof(w32_X_color_map)/sizeof(colormap_t)); i++)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
322 if (!stricmp(name, w32_X_color_map[i].name))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
323 return (w32_X_color_map[i].colorref);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
324 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
325 return(-1);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
326 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
327
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
328 static int
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
329 w32_initialize_color_instance (struct Lisp_Color_Instance *c, Lisp_Object name,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
330 Lisp_Object device, Error_behavior errb)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
331 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
332 CONST char *extname;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
333 COLORREF color;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
334
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
335 GET_C_STRING_CTEXT_DATA_ALLOCA (name, extname);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
336 color = w32_string_to_color(extname);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
337 if (color != -1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
338 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
339 c->data = xnew (struct w32_color_instance_data);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
340 COLOR_INSTANCE_W32_COLOR (c) = color;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
341 COLOR_INSTANCE_W32_BRUSH (c) = CreateSolidBrush (color);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
342 return 1;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
343 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
344 maybe_signal_simple_error ("unrecognized color", name, Qcolor, errb);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
345 return(0);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
346 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
347
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
348 static void
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
349 w32_mark_color_instance (struct Lisp_Color_Instance *c,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
350 void (*markobj) (Lisp_Object))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
351 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
352 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
353
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
354 static void
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
355 w32_print_color_instance (struct Lisp_Color_Instance *c,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
356 Lisp_Object printcharfun,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
357 int escapeflag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
358 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
359 char buf[32];
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
360 COLORREF color = COLOR_INSTANCE_W32_COLOR (c);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
361 sprintf (buf, " %06ld=(%02X,%02X,%02X)", color & 0xffffff,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
362 GetRValue(color), GetGValue(color), GetBValue(color));
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
363 write_c_string (buf, printcharfun);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
364 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
365
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
366 static void
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
367 w32_finalize_color_instance (struct Lisp_Color_Instance *c)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
368 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
369 if (c->data)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
370 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
371 DeleteObject (COLOR_INSTANCE_W32_BRUSH (c));
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
372 xfree (c->data);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
373 c->data = 0;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
374 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
375 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
376
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
377 static int
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
378 w32_color_instance_equal (struct Lisp_Color_Instance *c1,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
379 struct Lisp_Color_Instance *c2,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
380 int depth)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
381 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
382 return (COLOR_INSTANCE_W32_COLOR(c1) == COLOR_INSTANCE_W32_COLOR(c2));
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
383 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
384
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
385 static unsigned long
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
386 w32_color_instance_hash (struct Lisp_Color_Instance *c, int depth)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
387 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
388 return LISP_HASH (COLOR_INSTANCE_W32_COLOR(c));
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
389 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
390
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
391 static Lisp_Object
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
392 w32_color_instance_rgb_components (struct Lisp_Color_Instance *c)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
393 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
394 COLORREF color = COLOR_INSTANCE_W32_COLOR (c);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
395 return (list3 (make_int (GetRValue(color)),
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
396 make_int (GetGValue(color)),
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
397 make_int (GetBValue(color))));
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
398 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
399
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
400 static int
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
401 w32_valid_color_name_p (struct device *d, Lisp_Object color)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
402 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
403 CONST char *extname;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
404
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
405 GET_C_STRING_CTEXT_DATA_ALLOCA (color, extname);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
406 return (w32_string_to_color(extname)!=-1);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
407 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
408
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
409
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
410
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
411 static void
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
412 w32_finalize_font_instance (struct Lisp_Font_Instance *f)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
413 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
414 if (f->data)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
415 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
416 DeleteObject(f->data);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
417 f->data=0;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
418 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
419 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
420
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
421 static int
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
422 w32_initialize_font_instance (struct Lisp_Font_Instance *f, Lisp_Object name,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
423 Lisp_Object device, Error_behavior errb)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
424 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
425 CONST char *extname;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
426 LOGFONT logfont;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
427 int fields;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
428 int pt;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
429 char fontname[LF_FACESIZE], weight[32], *style, points[8], effects[32], charset[32];
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
430
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
431 GET_C_STRING_CTEXT_DATA_ALLOCA (f->name, extname);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
432
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
433 /*
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
434 * w32 fonts look like:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
435 * fontname[:[weight ][style][:pointsize[:effects[:charset]]]]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
436 * The font name field shouldn't be empty.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
437 * XXX Windows will substitute a default (monospace) font if the font name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
438 * specifies a non-existent font. We don't catch this.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
439 * effects and charset are currently ignored.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
440 *
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
441 * ie:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
442 * Lucida Console:Regular:10
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
443 * minimal:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
444 * Courier New
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
445 * maximal:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
446 * Courier New:Bold Italic:10:underline strikeout:ansi
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
447 */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
448 fields = sscanf (extname, "%31[^:]:%31[^:]:%7[^:]:%31[^:]:%31s",
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
449 fontname, weight, points, effects, charset);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
450
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
451 if (fields<0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
452 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
453 maybe_signal_simple_error ("Invalid font", f->name, Qfont, errb);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
454 return (0);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
455 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
456
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
457 if (fields>0 && strlen(fontname))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
458 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
459 strncpy (logfont.lfFaceName, fontname, LF_FACESIZE);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
460 logfont.lfFaceName[LF_FACESIZE-1] = 0;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
461 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
462 else
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
463 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
464 maybe_signal_simple_error ("Must specify a font name", f->name, Qfont, errb);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
465 return (0);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
466 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
467
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
468 if (fields > 1 && strlen(weight))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
469 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
470 char *c;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
471 /* Maybe split weight into weight and style */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
472 if (c=strchr(weight, ' '))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
473 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
474 *c = '\0';
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
475 style = c+1;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
476 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
477 else
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
478 style = NULL;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
479
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
480 /* weight: Most-often used (maybe) first */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
481 if (stricmp (weight,"regular") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
482 logfont.lfWeight = FW_REGULAR;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
483 else if (stricmp (weight,"normal") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
484 logfont.lfWeight = FW_NORMAL;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
485 else if (stricmp (weight,"bold") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
486 logfont.lfWeight = FW_BOLD;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
487 else if (stricmp (weight,"medium") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
488 logfont.lfWeight = FW_MEDIUM;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
489 else if (stricmp (weight,"italic") == 0) /* Hack for early exit */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
490 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
491 logfont.lfWeight = FW_NORMAL;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
492 style=weight;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
493 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
494 /* the rest */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
495 else if (stricmp (weight,"black") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
496 logfont.lfWeight = FW_BLACK;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
497 else if (stricmp (weight,"heavy") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
498 logfont.lfWeight = FW_HEAVY;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
499 else if (stricmp (weight,"ultrabold") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
500 logfont.lfWeight = FW_ULTRABOLD;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
501 else if (stricmp (weight,"extrabold") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
502 logfont.lfWeight = FW_EXTRABOLD;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
503 else if (stricmp (weight,"demibold") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
504 logfont.lfWeight = FW_SEMIBOLD;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
505 else if (stricmp (weight,"semibold") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
506 logfont.lfWeight = FW_SEMIBOLD;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
507 else if (stricmp (weight,"light") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
508 logfont.lfWeight = FW_LIGHT;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
509 else if (stricmp (weight,"ultralight") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
510 logfont.lfWeight = FW_ULTRALIGHT;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
511 else if (stricmp (weight,"extralight") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
512 logfont.lfWeight = FW_EXTRALIGHT;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
513 else if (stricmp (weight,"thin") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
514 logfont.lfWeight = FW_THIN;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
515 else
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
516 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
517 logfont.lfWeight = FW_NORMAL;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
518 if (!style)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
519 style = weight; /* May have specified a style without a weight */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
520 else
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
521 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
522 maybe_signal_simple_error ("Invalid font weight", f->name, Qfont, errb);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
523 return (0); /* Invalid weight */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
524 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
525 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
526
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
527 if (style)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
528 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
529 /* XXX what about oblique? */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
530 if (stricmp (style,"italic") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
531 logfont.lfItalic = TRUE;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
532 else if (stricmp (style,"roman") == 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
533 logfont.lfItalic = FALSE;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
534 else
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
535 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
536 maybe_signal_simple_error ("Invalid font weight or style", f->name, Qfont, errb);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
537 return (0); /* Invalid weight or style */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
538 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
539 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
540 else
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
541 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
542 logfont.lfItalic = FALSE;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
543 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
544
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
545 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
546 else
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
547 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
548 logfont.lfWeight = FW_NORMAL;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
549 logfont.lfItalic = FALSE;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
550 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
551
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
552 /* XXX Should we reject strings that don't specify a size? */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
553 if (fields < 3 || !strlen(points) || (pt=atoi(points))==0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
554 pt = 10;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
555
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
556 /* Formula for pointsize->height from LOGFONT docs in MSVC5 Platform SDK */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
557 logfont.lfHeight = -MulDiv(pt, DEVICE_W32_LOGPIXELSY(XDEVICE (device)), 72);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
558 logfont.lfWidth = 0;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
559
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
560 /* Default to monospaced if the specified font name is not found */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
561 logfont.lfPitchAndFamily = FF_MODERN;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
562
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
563 /* XXX: FIXME? */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
564 logfont.lfUnderline = FALSE;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
565 logfont.lfStrikeOut = FALSE;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
566
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
567 /* XXX: FIXME: we ignore charset */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
568 logfont.lfCharSet = DEFAULT_CHARSET;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
569
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
570 /* Misc crud */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
571 logfont.lfEscapement = logfont.lfOrientation = 0;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
572 #if 1
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
573 logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
574 logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
575 logfont.lfQuality = DEFAULT_QUALITY;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
576 #else
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
577 logfont.lfOutPrecision = OUT_STROKE_PRECIS;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
578 logfont.lfClipPrecision = CLIP_STROKE_PRECIS;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
579 logfont.lfQuality = PROOF_QUALITY;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
580 #endif
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
581
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
582 if ((f->data = CreateFontIndirect(&logfont)) == NULL)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
583 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
584 maybe_signal_simple_error ("Couldn't create font", f->name, Qfont, errb);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
585 return 0;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
586 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
587
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
588 /* Have to apply Font to a GC to get its values.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
589 * We'll borrow the desktop window becuase its the only window that we
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
590 * know about that is guaranteed to exist when this gets called
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
591 */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
592 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
593 HWND hwnd;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
594 HDC hdc;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
595 HFONT holdfont;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
596 TEXTMETRIC metrics;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
597
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
598 hwnd = GetDesktopWindow();
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
599 assert(hdc = GetDC(hwnd)); /* XXX FIXME: can this temporarily fail? */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
600 holdfont = SelectObject(hdc, f->data);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
601 if (!holdfont)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
602 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
603 w32_finalize_font_instance (f);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
604 maybe_signal_simple_error ("Couldn't map font", f->name, Qfont, errb);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
605 return 0;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
606 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
607 GetTextMetrics(hdc, &metrics);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
608 SelectObject(hdc, holdfont);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
609 ReleaseDC(hwnd, hdc);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
610 f->width = metrics.tmAveCharWidth;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
611 f->height = metrics.tmHeight;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
612 f->ascent = metrics.tmAscent;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
613 f->descent = metrics.tmDescent;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
614 f->proportional_p = (metrics.tmPitchAndFamily & TMPF_FIXED_PITCH);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
615 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
616
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
617 return 1;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
618 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
619
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
620 static void
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
621 w32_mark_font_instance (struct Lisp_Font_Instance *f,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
622 void (*markobj) (Lisp_Object))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
623 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
624 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
625
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
626 static void
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
627 w32_print_font_instance (struct Lisp_Font_Instance *f,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
628 Lisp_Object printcharfun,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
629 int escapeflag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
630 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
631 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
632
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
633 static Lisp_Object
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
634 w32_list_fonts (Lisp_Object pattern, Lisp_Object device)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
635 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
636 /* XXX Implement me */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
637 return list1 (build_string ("Courier New:Regular:10"));
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
638 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
639
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
640
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
641
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
642 /************************************************************************/
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
643 /* initialization */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
644 /************************************************************************/
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
645
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
646 void
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
647 syms_of_objects_w32 (void)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
648 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
649 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
650
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
651 void
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
652 console_type_create_objects_w32 (void)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
653 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
654 /* object methods */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
655 CONSOLE_HAS_METHOD (w32, initialize_color_instance);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
656 /* CONSOLE_HAS_METHOD (w32, mark_color_instance); */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
657 CONSOLE_HAS_METHOD (w32, print_color_instance);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
658 CONSOLE_HAS_METHOD (w32, finalize_color_instance);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
659 CONSOLE_HAS_METHOD (w32, color_instance_equal);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
660 CONSOLE_HAS_METHOD (w32, color_instance_hash);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
661 CONSOLE_HAS_METHOD (w32, color_instance_rgb_components);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
662 CONSOLE_HAS_METHOD (w32, valid_color_name_p);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
663
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
664 CONSOLE_HAS_METHOD (w32, initialize_font_instance);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
665 /* CONSOLE_HAS_METHOD (w32, mark_font_instance); */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
666 CONSOLE_HAS_METHOD (w32, print_font_instance);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
667 CONSOLE_HAS_METHOD (w32, finalize_font_instance);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
668 /* CONSOLE_HAS_METHOD (w32, font_instance_truename); */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
669 CONSOLE_HAS_METHOD (w32, list_fonts);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
670 #ifdef MULE
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
671 CONSOLE_HAS_METHOD (w32, font_spec_matches_charset);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
672 CONSOLE_HAS_METHOD (w32, find_charset_font);
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
673 #endif
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
674 }
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
675
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
676 void
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
677 vars_of_objects_w32 (void)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
678 {
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
679 }