1 /*------------------------------------------------------------\
2 | |
3 | This file is part of the Alliance CAD System Copyright |
4 | (C) Laboratoire LIP6 - D�partement ASIM Universite P&M Curie|
5 | |
6 | Home page : http://www-asim.lip6.fr/alliance/ |
7 | E-mail : mailto:alliance-users@asim.lip6.fr |
8 | |
9 | This progam is free software; you can redistribute it |
10 | and/or modify it under the terms of the GNU General Public |
11 | License as published by the Free Software Foundation; |
12 | either version 2 of the License, or (at your option) any |
13 | later version. |
14 | |
15 | Alliance VLSI CAD System is distributed in the hope that |
16 | it will be useful, but WITHOUT ANY WARRANTY; |
17 | without even the implied warranty of MERCHANTABILITY or |
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
19 | Public License for more details. |
20 | |
21 | You should have received a copy of the GNU General Public |
22 | License along with the GNU C Library; see the file COPYING. |
23 | If not, write to the Free Software Foundation, Inc., |
24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
25 | |
26 \------------------------------------------------------------*/
27
28 /*------------------------------------------------------------\
29 | |
30 | Tool : GRAAL |
31 | |
32 | File : Colors.c |
33 | |
34 | Author : Jacomme Ludovic |
35 | |
36 | Date : 28.03.95 |
37 | |
38 \------------------------------------------------------------*/
39
40 /*------------------------------------------------------------\
41 | |
42 | Include Files |
43 | |
44 \------------------------------------------------------------*/
45
46 # include <stdio.h>
47 # include <Xm/Xm.h>
48
49 # include "mut.h"
50 # include "mph.h"
51 # include "rds.h"
52 # include "rpr.h"
53 # include "rds.h"
54 # include "GSB.h"
55 # include "GMX.h"
56 # include "GMX_color.h"
57
58 /*------------------------------------------------------------\
59 | |
60 | Constants |
61 | |
62 \------------------------------------------------------------*/
63 /*------------------------------------------------------------\
64 | |
65 | Types |
66 | |
67 \------------------------------------------------------------*/
68 /*------------------------------------------------------------\
69 | |
70 | Variables |
71 | |
72 \------------------------------------------------------------*/
73
74 GC GraalLayerFillGC [ RDS_ALL_LAYER ];
75 GC GraalLayerDrawGC [ RDS_ALL_LAYER ];
76 GC GraalLayerAcceptGC [ RDS_ALL_LAYER ];
77 GC GraalLayerEquiGC [ RDS_ALL_LAYER ];
78 GC GraalLayerDrucGC [ RDS_ALL_LAYER ];
79 GC GraalAcceptDrawGC;
80 GC GraalDrucDrawGC;
81 GC GraalEquiDrawGC;
82 GC GraalBackgroundGC;
83 GC GraalGridGC;
84 GC GraalSmallTextGC;
85 GC GraalMediumTextGC;
86 GC GraalLargeTextGC;
87 GC GraalXorGCInvert;
88 GC GraalXorGCXor;
89 GC GraalXorGC;
90
91 XFontStruct *GraalLargeTextFont;
92 XFontStruct *GraalMediumTextFont;
93 XFontStruct *GraalSmallTextFont;
94
95 Colormap GraalColorMap;
96
97 /*------------------------------------------------------------\
98 | |
99 | Layer Color Define |
100 | |
101 \------------------------------------------------------------*/
102
103 static char GraalLayerPatternDefine[ RDS_ALL_LAYER ] =
104
105 {
106 0, /* RDS_NWELL */
107 0, /* RDS_PWELL */
108 0, /* RDS_NIMP */
109 0, /* RDS_PIMP */
110 0, /* RDS_ACTIV */
111 1, /* RDS_NDIF */
112 1, /* RDS_PDIF */
113 1, /* RDS_NTIE */
114 1, /* RDS_PTIE */
115 3, /* RDS_POLY */
116 2, /* RDS_GATE */
117 3, /* RDS_VPOLY */
118 12, /* RDS_TPOLY */
119 2, /* RDS_POLY2 */
120 5, /* RDS_CONT */
121 3, /* RDS_TPOLY2 */
122 5, /* RDS_TCONT */
123 5, /* RDS_CONT2 */
124 4, /* RDS_ALU1 */
125 4, /* RDS_VALU1 */
126 12, /* RDS_TALU1 */
127 5, /* RDS_VIA1 */
128 5, /* RDS_TVIA1 */
129 6, /* RDS_ALU2 */
130 6, /* RDS_VALU2 */
131 12, /* RDS_TALU2 */
132 5, /* RDS_VIA2 */
133 5, /* RDS_TVIA2 */
134 8, /* RDS_ALU3 */
135 8, /* RDS_VALU3 */
136 12, /* RDS_TALU3 */
137 5, /* RDS_VIA3 */
138 5, /* RDS_TVIA3 */
139 9, /* RDS_ALU4 */
140 9, /* RDS_VALU4 */
141 14, /* RDS_TALU4 */
142 5, /* RDS_VIA4 */
143 5, /* RDS_TVIA4 */
144 10, /* RDS_ALU5 */
145 10, /* RDS_VALU5 */
146 12, /* RDS_TALU5 */
147 13, /* RDS_VIA5 */
148 5, /* RDS_TVIA5 */
149 11, /* RDS_ALU6 */
150 11, /* RDS_VALU6 */
151 12, /* RDS_TALU6 */
152 5, /* RDS_VIA6 */
153 5, /* RDS_TVIA6 */
154 8, /* RDS_ALU7 */
155 8, /* RDS_VALU7 */
156 12, /* RDS_TALU7 */
157 5, /* RDS_VIA7 */
158 5, /* RDS_TVIA7 */
159 9, /* RDS_ALU8 */
160 9, /* RDS_VALU8 */
161 12, /* RDS_TALU8 */
162 5, /* RDS_VIA8 */
163 5, /* RDS_TVIA8 */
164 10, /* RDS_ALU9 */
165 7, /* RDS_CPAS */
166 7, /* RDS_REF */
167 4, /* RDS_USER0 */
168 0, /* RDS_USER1 */
169 0, /* RDS_USER2 */
170 0, /* RDS_USER3 */
171 0, /* RDS_USER4 */
172 0, /* RDS_USER5 */
173 0, /* RDS_USER6 */
174 0, /* RDS_USER7 */
175 0, /* RDS_USER8 */
176 0, /* RDS_USER9 */
177 0 /* RDS_ABOX */
178 };
179
180
181 static char GraalPatternBits[ GRAAL_MAX_PATTERN ][ GRAAL_PATTERN_SQUARE ] =
182
183 { /* FOR SUBST 0 */
184 {
185 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xf7, 0xff, 0xff,
186 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
187 0xf7, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
188 }
189 , /* FOR DIF & TIE 1 */
190 {
191 0x77, 0x77, 0xbb, 0xbb, 0xdd, 0xdd, 0xee, 0xee, 0x77, 0x77, 0xbb, 0xbb,
192 0xdd, 0xdd, 0xee, 0xee, 0x77, 0x77, 0xbb, 0xbb, 0xdd, 0xdd, 0xee, 0xee,
193 0x77, 0x77, 0xbb, 0xbb, 0xdd, 0xdd, 0xee, 0xee
194 }
195 , /* FOR GATE 2 */
196 {
197 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55,
198 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55,
199 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55
200 }
201 , /* FOR POLY 3 */
202 {
203 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
204 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
205 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa
206 }
207 , /* FOR ALU1 4 */
208 {
209 0x88, 0x88, 0x44, 0x44, 0x22, 0x22, 0x11, 0x11, 0x88, 0x88, 0x44, 0x44,
210 0x22, 0x22, 0x11, 0x11, 0x88, 0x88, 0x44, 0x44, 0x22, 0x22, 0x11, 0x11,
211 0x88, 0x88, 0x44, 0x44, 0x22, 0x22, 0x11, 0x11
212 }
213 , /* FOR CONT 5 */
214 {
215 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff,
216 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff,
217 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff
218 }
219 , /* FOR ALU2 6 */
220 {
221 0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00,
222 0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00,
223 0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00
224 }
225 , /* FOR REF 7 */
226 {
227 0xaa, 0xaa, 0x11, 0x11, 0xaa, 0xaa, 0x44, 0x44, 0xaa, 0xaa, 0x11, 0x11,
228 0xaa, 0xaa, 0x44, 0x44, 0xaa, 0xaa, 0x11, 0x11, 0xaa, 0xaa, 0x44, 0x44,
229 0xaa, 0xaa, 0x11, 0x11, 0xaa, 0xaa, 0x44, 0x44
230 }
231 , /* FOR ALU3 8 */
232 {
233 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11,
234 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11,
235 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11
236 }
237 , /* FOR ALU4 9 */
238 {
239 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22,
240 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22,
241 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22
242 }
243 , /* FOR ALU5 10 */
244 {
245 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88,
246 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88,
247 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88
248 }
249 , /* FOR ALU6 11 */
250 {
251 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44,
252 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44,
253 0x11, 0x11, 0x44, 0x44, 0x11, 0x11, 0x44, 0x44
254 }
255 , /* FOR TPOLY, TALU1 12 */
256 {
257 0x00, 0x00, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22,
258 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
259 0x00, 0x00, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00
260 }
261 , /* FOR VIA 13 */
262 {
263 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa,
264 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa,
265 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa
266 }
267 , /* FOR TALUx 14 */
268 {
269 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
270 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00,
271 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00
272 }
273 , /* FOR USER 15 */
274 {
275 0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00,
276 0x11, 0x11, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00,
277 0x44, 0x44, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00
278 }
279 ,
280 {
281 0xee, 0xee, 0x77, 0x77, 0xbb, 0xbb, 0xdd, 0xdd, 0xee, 0xee, 0x77, 0x77,
282 0xbb, 0xbb, 0xdd, 0xdd, 0xee, 0xee, 0x77, 0x77, 0xbb, 0xbb, 0xdd, 0xdd,
283 0xee, 0xee, 0x77, 0x77, 0xbb, 0xbb, 0xdd, 0xdd
284 }
285 ,
286 {
287 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
288 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
289 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa
290 }
291 ,
292 {
293 0xdd, 0xdd, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0xd5, 0xd5, 0xaa, 0xaa,
294 0x55, 0x55, 0xaa, 0xaa, 0xdd, 0xdd, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
295 0xdd, 0xd5, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa
296 }
297 ,
298 {
299 0x77, 0x77, 0xaa, 0xaa, 0xd5, 0xd5, 0xaa, 0xaa, 0x77, 0x77, 0xaa, 0xaa,
300 0xdd, 0x5d, 0xaa, 0xaa, 0x77, 0x77, 0xaa, 0xaa, 0xd5, 0xd5, 0xaa, 0xaa,
301 0x77, 0x77, 0xaa, 0xaa, 0x5d, 0xdd, 0xaa, 0xaa
302 }
303 ,
304 {
305 0x55, 0x55, 0xbb, 0xbb, 0x55, 0x55, 0xfe, 0xfe, 0x55, 0x55, 0xbb, 0xbb,
306 0x55, 0x55, 0xee, 0xef, 0x55, 0x55, 0xbb, 0xbb, 0x55, 0x55, 0xfe, 0xfe,
307 0x55, 0x55, 0xbb, 0xbb, 0x55, 0x55, 0xef, 0xef
308 }
309 ,
310 {
311 0xff, 0xff, 0xaa, 0xaa, 0x77, 0x77, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa,
312 0x77, 0x7f, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, 0x77, 0x77, 0xaa, 0xaa,
313 0xff, 0xff, 0xaa, 0xaa, 0x7f, 0x7f, 0xaa, 0xaa
314 }
315 ,
316 {
317 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa,
318 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa,
319 0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff, 0xaa, 0xaa
320 }
321 ,
322 {
323 0x55, 0x55, 0xff, 0xff, 0xdd, 0xdd, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff,
324 0x5d, 0xdd, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0xdd, 0xdd, 0xff, 0xff,
325 0x55, 0x55, 0xff, 0xff, 0x5d, 0x5d, 0xff, 0xff
326 }
327 ,
328 {
329 0xee, 0xee, 0xff, 0xff, 0xbb, 0xba, 0xff, 0xff, 0xee, 0xee, 0xff, 0xff,
330 0xab, 0xbb, 0xff, 0xff, 0xee, 0xee, 0xff, 0xff, 0xbb, 0xba, 0xff, 0xff,
331 0xee, 0xee, 0xff, 0xff, 0xbb, 0xab, 0xff, 0xff
332 }
333 ,
334 {
335 0xff, 0xff, 0xee, 0xee, 0xff, 0xff, 0xfb, 0xfb, 0xff, 0xff, 0xee, 0xee,
336 0xff, 0xff, 0xbf, 0xbb, 0xff, 0xff, 0xee, 0xee, 0xff, 0xff, 0xfb, 0xfb,
337 0xff, 0xff, 0xee, 0xee, 0xff, 0xff, 0xbf, 0xbf
338 }
339 ,
340 {
341 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbb, 0xbb, 0xff, 0xff, 0xff, 0xff,
342 0xff, 0xff, 0xfb, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbb, 0xbb,
343 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xfb
344 }
345 ,
346 {
347 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
348 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88,
349 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08
350 }
351 ,
352 {
353 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0xff, 0xff, 0xff, 0xff,
354 0xff, 0xff, 0xf7, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x77, 0x77,
355 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xf7
356 }
357 ,
358 {
359 0x10, 0x10, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00,
360 0x44, 0x44, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00,
361 0x01, 0x01, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00
362 }
363 ,
364 {
365 0x00, 0x00, 0x11, 0x51, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x15, 0x15,
366 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x51, 0x11, 0x00, 0x00, 0x44, 0x44,
367 0x00, 0x00, 0x15, 0x15, 0x00, 0x00, 0x44, 0x44
368 }
369 ,
370 {
371 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x8a, 0x88, 0x00, 0x00, 0xaa, 0xaa,
372 0x00, 0x00, 0x88, 0x88, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x8a, 0x8a,
373 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x88, 0x88
374 }
375 ,
376 {
377 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00,
378 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00,
379 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00
380 }
381 ,
382 {
383 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x00, 0x00,
384 0x55, 0x55, 0x80, 0x80, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x88, 0x88,
385 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x88, 0x80
386 }
387 ,
388 {
389 0x22, 0x22, 0x55, 0x55, 0x80, 0x80, 0x55, 0x55, 0x22, 0x22, 0x55, 0x55,
390 0x88, 0x08, 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x80, 0x80, 0x55, 0x55,
391 0x22, 0x22, 0x55, 0x55, 0x08, 0x08, 0x55, 0x55
392 }
393 ,
394 {
395 0x88, 0x88, 0x55, 0x55, 0x22, 0xa2, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55,
396 0x2a, 0x2a, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0xa2, 0x22, 0x55, 0x55,
397 0x88, 0x88, 0x55, 0x55, 0x2a, 0x2a, 0x55, 0x55
398 }
399 ,
400 {
401 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x54, 0x54, 0xaa, 0xaa, 0x55, 0x55,
402 0xaa, 0xaa, 0x44, 0x44, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x44, 0x54,
403 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x44, 0x44
404 }
405 };
406
407 static Pixmap GraalPattern[ GRAAL_MAX_PATTERN ];
408
409 static char *GraalColorName[ 7 ] =
410
411 {
412 GRAAL_BLACK_COLOR,
413 GRAAL_WHITE_COLOR,
414 GRAAL_TEXT_COLOR ,
415 GRAAL_ACCEPT_COLOR,
416 GRAAL_EQUI_COLOR,
417 GRAAL_DRUC_COLOR,
418 GRAAL_CURSOR_COLOR
419 };
420
421 static int GraalColor[ GRAAL_MAX_COLOR ];
422
423 /*------------------------------------------------------------\
424 | |
425 | Functions |
426 | |
427 \------------------------------------------------------------*/
428 /*------------------------------------------------------------\
429 | |
430 | GraalSwitchColormap |
431 | |
432 \------------------------------------------------------------*/
433
GraalInitializeColorMap()434 void GraalInitializeColorMap()
435 {
436 Display *ADisplay;
437 Screen *AScreen;
438
439 ADisplay = XtDisplay( GraalTopLevel );
440 AScreen = XtScreen( GraalTopLevel );
441 GraalColorMap = DefaultColormapOfScreen( AScreen );
442
443 if ( GRAAL_SWITCH_COLOR_MAP )
444 {
445 GraalColorMap = XCopyColormapAndFree( ADisplay, GraalColorMap );
446 XInstallColormap( ADisplay, GraalColorMap );
447 XtVaSetValues( GraalTopLevel, XmNcolormap, GraalColorMap, NULL );
448 }
449 }
450
451 /*------------------------------------------------------------\
452 | |
453 | GraalInitializeColors |
454 | |
455 \------------------------------------------------------------*/
456
GraalInitializeColors()457 void GraalInitializeColors()
458
459 {
460 XColor ForgetIt;
461 XColor GetIt;
462 Window Root;
463 int Counter;
464 char Error;
465 char *ColorName;
466
467 rdsbegin();
468
469 if ( GRAAL_CURSOR_COLOR_NAME != (char *)NULL )
470 {
471 GraalColorName[ 6 ] = GRAAL_CURSOR_COLOR_NAME;
472 }
473
474 Error = False;
475
476 for ( Counter = 0; Counter < GRAAL_MAX_COLOR; Counter++ )
477 {
478 if ( Counter >= 7 )
479 {
480 ColorName = GRAAL_RDS_LAYER_NAME_TABLE[ Counter - 7 ][ 1 ];
481 }
482 else
483 {
484 ColorName = GraalColorName[ Counter ];
485 }
486
487 if ( ColorName != (char *)NULL )
488 {
489 if ( ! XAllocNamedColor( GraalGraphicDisplay,
490 GraalColorMap, ColorName,
491 &GetIt, &ForgetIt ) )
492 {
493 fprintf( stderr, "\nGmx: Unable to allocate color '%s' !\n",
494 ColorName );
495
496 Error = True;
497 }
498
499 GraalColor[ Counter ] = GetIt.pixel;
500 }
501 else
502 {
503 GraalColor[ Counter ] = GraalColor[ 0 ];
504 }
505 }
506
507 if ( Error == True ) exit( 1 );
508
509 Root = RootWindowOfScreen ( XtScreen ( GraalGraphicWindow ) );
510
511 for ( Counter = 0; Counter < GRAAL_MAX_PATTERN; Counter++ )
512 {
513 GraalPattern[ Counter ] =
514
515 XCreateBitmapFromData( GraalGraphicDisplay,
516 Root,
517 GraalPatternBits[ Counter ],
518 GRAAL_PATTERN_WIDTH,
519 GRAAL_PATTERN_HEIGHT );
520 }
521
522 rdsend();
523 }
524
525 /*------------------------------------------------------------\
526 | |
527 | GraalChangeCursorContext |
528 | |
529 \------------------------------------------------------------*/
530
GraalChangeCursorContext()531 void GraalChangeCursorContext()
532 {
533 if ( GRAAL_XOR_CURSOR == GRAAL_TRUE )
534 {
535 GraalXorGC = GraalXorGCXor;
536 }
537 else
538 {
539 GraalXorGC = GraalXorGCInvert;
540 }
541 }
542
543 /*------------------------------------------------------------\
544 | |
545 | GraalInitializeGraphicContext |
546 | |
547 \------------------------------------------------------------*/
548
GraalInitializeGraphicContext()549 void GraalInitializeGraphicContext()
550
551 {
552 XGCValues GraphicValue;
553 int Counter;
554 Window Root;
555 char Pattern;
556
557 rdsbegin();
558
559 GraalLargeTextFont = XLoadQueryFont( GraalGraphicDisplay,
560 GRAAL_LARGE_TEXT_FONT_NAME );
561
562 GraalMediumTextFont = XLoadQueryFont( GraalGraphicDisplay,
563 GRAAL_MEDIUM_TEXT_FONT_NAME );
564
565 GraalSmallTextFont = XLoadQueryFont( GraalGraphicDisplay,
566 GRAAL_SMALL_TEXT_FONT_NAME );
567
568 GraphicValue.foreground = GraalColor[ 0 ]; /* Black */
569 GraphicValue.background = GraalColor[ 0 ];
570 GraphicValue.plane_mask = AllPlanes;
571
572 Root = RootWindowOfScreen ( XtScreen ( GraalGraphicWindow ) ),
573
574 GraalBackgroundGC = XCreateGC ( GraalGraphicDisplay,
575 Root,
576 ( GCForeground |
577 GCBackground |
578 GCPlaneMask ),
579 &GraphicValue );
580
581 GraphicValue.foreground = GraalColor[ 1 ]; /* White */
582
583 GraalGridGC = XCreateGC ( GraalGraphicDisplay,
584 Root,
585 ( GCForeground |
586 GCBackground |
587 GCPlaneMask ),
588 &GraphicValue );
589
590 GraphicValue.foreground = GraalColor[ 3 ];
591
592 GraalAcceptDrawGC = XCreateGC ( GraalGraphicDisplay,
593 Root,
594 ( GCForeground |
595 GCBackground |
596 GCPlaneMask ),
597 &GraphicValue );
598
599 GraphicValue.foreground = GraalColor[ 4 ];
600
601 GraalEquiDrawGC = XCreateGC ( GraalGraphicDisplay,
602 Root,
603 ( GCForeground |
604 GCBackground |
605 GCPlaneMask ),
606 &GraphicValue );
607
608 GraphicValue.foreground = GraalColor[ 5 ];
609
610 GraalDrucDrawGC = XCreateGC ( GraalGraphicDisplay,
611 Root,
612 ( GCForeground |
613 GCBackground |
614 GCPlaneMask ),
615 &GraphicValue );
616
617 GraphicValue.foreground = GraalColor[ 2 ]; /* Text */
618
619 GraalSmallTextGC = XCreateGC ( GraalGraphicDisplay,
620 Root,
621 ( GCForeground |
622 GCBackground |
623 GCPlaneMask ),
624 &GraphicValue );
625
626 GraalMediumTextGC = XCreateGC ( GraalGraphicDisplay,
627 Root,
628 ( GCForeground |
629 GCBackground |
630 GCPlaneMask ),
631 &GraphicValue );
632
633 GraalLargeTextGC = XCreateGC ( GraalGraphicDisplay,
634 Root,
635 ( GCForeground |
636 GCBackground |
637 GCPlaneMask ),
638 &GraphicValue );
639
640 XSetFont( GraalGraphicDisplay,
641 GraalSmallTextGC, GraalSmallTextFont->fid );
642
643 XSetFont( GraalGraphicDisplay,
644 GraalMediumTextGC, GraalMediumTextFont->fid );
645
646 XSetFont( GraalGraphicDisplay,
647 GraalLargeTextGC, GraalLargeTextFont->fid );
648
649 GraphicValue.background = GraalColor[ 6 ]; /* Xor Color */
650 GraphicValue.foreground = GraalColor[ 6 ]; /* Xor Color */
651 GraphicValue.function = GXxor;
652
653 GraalXorGCXor = XCreateGC ( GraalGraphicDisplay,
654 Root,
655 ( GCFunction |
656 GCForeground |
657 GCBackground |
658 GCPlaneMask ),
659 &GraphicValue );
660
661 GraphicValue.function = GXinvert;
662
663 GraalXorGCInvert = XCreateGC ( GraalGraphicDisplay,
664 Root,
665 ( GCFunction |
666 GCPlaneMask ),
667 &GraphicValue );
668
669 GraalChangeCursorContext();
670
671 GraphicValue.background = GraalColor[ 0 ]; /* Black */
672 GraphicValue.foreground = GraalColor[ 1 ]; /* White */
673
674 for ( Counter = 0; Counter < RDS_ALL_LAYER; Counter++ )
675 {
676 if ( GRAAL_RDS_LAYER_NAME_TABLE[ Counter ][ 0 ] != (char *)NULL )
677 {
678 Pattern = GRAAL_RDS_LAYER_PATTERN_TABLE[ Counter ];
679
680 if ( ( Pattern < 0 ) ||
681 ( Pattern >= GRAAL_MAX_PATTERN ) )
682 {
683 Pattern = GraalLayerPatternDefine[ Counter ];
684 }
685
686 GraphicValue.stipple = GraalPattern[ (int)Pattern ];
687 GraphicValue.fill_style = FillStippled;
688 GraphicValue.foreground = GraalColor[ 3 ];
689
690 GraalLayerAcceptGC[ Counter ] =
691
692 XCreateGC ( GraalGraphicDisplay,
693 Root,
694 ( GCStipple |
695 GCForeground |
696 GCBackground |
697 GCFillStyle |
698 GCPlaneMask ),
699 &GraphicValue );
700
701 GraphicValue.foreground = GraalColor[ 4 ];
702
703 GraalLayerEquiGC[ Counter ] =
704
705 XCreateGC ( GraalGraphicDisplay,
706 Root,
707 ( GCStipple |
708 GCForeground |
709 GCBackground |
710 GCFillStyle |
711 GCPlaneMask ),
712 &GraphicValue );
713
714 GraphicValue.foreground = GraalColor[ 5 ];
715
716 GraalLayerDrucGC[ Counter ] =
717
718 XCreateGC ( GraalGraphicDisplay,
719 Root,
720 ( GCStipple |
721 GCForeground |
722 GCBackground |
723 GCFillStyle |
724 GCPlaneMask ),
725 &GraphicValue );
726
727 GraphicValue.foreground = GraalColor[ Counter + 7 ];
728
729 GraalLayerFillGC[ Counter ] =
730
731 XCreateGC ( GraalGraphicDisplay,
732 Root,
733 ( GCStipple |
734 GCForeground |
735 GCBackground |
736 GCFillStyle |
737 GCPlaneMask ),
738 &GraphicValue );
739
740 GraalLayerDrawGC[ Counter ] =
741
742 XCreateGC ( GraalGraphicDisplay,
743 Root,
744 ( GCForeground |
745 GCBackground |
746 GCPlaneMask ),
747 &GraphicValue );
748
749 }
750 }
751
752 rdsend();
753 }
754