Mercurial > hg > xemacs-beta
comparison src/glyphs.h @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | 56c54cf7c5b6 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
1 /* Generic glyph data structures + display tables | |
2 Copyright (C) 1994 Board of Trustees, University of Illinois. | |
3 Copyright (C) 1995, 1996 Ben Wing | |
4 | |
5 This file is part of XEmacs. | |
6 | |
7 XEmacs is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 2, or (at your option) any | |
10 later version. | |
11 | |
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with XEmacs; see the file COPYING. If not, write to | |
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 Boston, MA 02111-1307, USA. */ | |
21 | |
22 /* Synched up with: Not in FSF. */ | |
23 | |
24 #ifndef _XEMACS_GLYPHS_H_ | |
25 #define _XEMACS_GLYPHS_H_ | |
26 | |
27 #include "specifier.h" | |
28 | |
29 /***************************************************************************** | |
30 * Image Instantiators * | |
31 *****************************************************************************/ | |
32 | |
33 struct image_instantiator_methods; | |
34 | |
35 /* Remember the distinction between image instantiator formats and | |
36 image instance types. Here's an approximate mapping: | |
37 | |
38 image instantiator format image instance type | |
39 ------------------------- ------------------- | |
40 nothing nothing | |
41 string text | |
42 formatted-string text | |
43 xbm mono-pixmap, color-pixmap, pointer | |
44 xpm color-pixmap, mono-pixmap, pointer | |
45 xface mono-pixmap, color-pixmap, pointer | |
46 gif color-pixmap | |
47 jpeg color-pixmap | |
48 png color-pixmap | |
49 tiff color-pixmap | |
50 cursor-font pointer | |
51 font pointer | |
52 subwindow subwindow | |
53 inherit mono-pixmap | |
54 autodetect mono-pixmap, color-pixmap, pointer, | |
55 text | |
56 */ | |
57 | |
58 typedef struct ii_keyword_entry_dynarr_type | |
59 { | |
60 Dynarr_declare (struct ii_keyword_entry); | |
61 } Ii_keyword_entry_dynarr; | |
62 | |
63 /* These are methods specific to a particular format of image instantiator | |
64 (e.g. xpm, string, etc.). */ | |
65 | |
66 struct image_instantiator_methods | |
67 { | |
68 Lisp_Object symbol; | |
69 | |
70 Ii_keyword_entry_dynarr *keywords; | |
71 /* Implementation specific methods: */ | |
72 | |
73 /* Validate method: Given an instantiator vector, signal an error if | |
74 it's invalid for this image-instantiator format. Note that this | |
75 validation only occurs after all the keyword-specific validation | |
76 has already been performed. This is chiefly useful for making | |
77 sure that certain required keywords are present. */ | |
78 void (*validate_method) (Lisp_Object instantiator); | |
79 | |
80 /* Normalize method: Given an instantiator, convert it to the form | |
81 that should be used in a glyph, for devices of type CONSOLE_TYPE. | |
82 Signal an error if conversion fails. */ | |
83 Lisp_Object (*normalize_method) (Lisp_Object instantiator, | |
84 Lisp_Object console_type); | |
85 | |
86 /* Possible-dest-types method: Return a mask indicating what dest types | |
87 are compatible with this format. */ | |
88 int (*possible_dest_types_method) (void); | |
89 | |
90 /* Instantiate method: Given an instantiator and a partially | |
91 filled-in image instance, complete the filling-in. Return | |
92 non-zero if the instantiation succeeds, 0 if it fails. | |
93 This must be present. */ | |
94 void (*instantiate_method) (Lisp_Object image_instance, | |
95 Lisp_Object instantiator, | |
96 Lisp_Object pointer_fg, | |
97 Lisp_Object pointer_bg, | |
98 int dest_mask); | |
99 }; | |
100 | |
101 struct ii_keyword_entry | |
102 { | |
103 Lisp_Object keyword; | |
104 void (*validate) (Lisp_Object data); | |
105 int multiple_p; | |
106 }; | |
107 | |
108 /***** Calling an image-instantiator method *****/ | |
109 | |
110 #define HAS_IIFORMAT_METH_P(mstruc, m) ((mstruc)->m##_method) | |
111 #define IIFORMAT_METH(mstruc, m, args) (((mstruc)->m##_method) args) | |
112 | |
113 /* Call a void-returning specifier method, if it exists */ | |
114 #define MAYBE_IIFORMAT_METH(mstruc, m, args) \ | |
115 do { \ | |
116 struct image_instantiator_methods *_maybe_iiformat_meth_mstruc = (mstruc); \ | |
117 if (HAS_IIFORMAT_METH_P (_maybe_iiformat_meth_mstruc, m)) \ | |
118 IIFORMAT_METH (_maybe_iiformat_meth_mstruc, m, args); \ | |
119 } while (0) | |
120 | |
121 MAC_DECLARE_EXTERN (struct image_instantiator_methods *, | |
122 MTiiformat_meth_or_given) | |
123 | |
124 /* Call a specifier method, if it exists; otherwise return | |
125 the specified value */ | |
126 | |
127 #define IIFORMAT_METH_OR_GIVEN(mstruc, m, args, given) \ | |
128 MAC_BEGIN \ | |
129 MAC_DECLARE (struct image_instantiator_methods *, \ | |
130 MTiiformat_meth_or_given, mstruc) \ | |
131 HAS_IIFORMAT_METH_P (MTiiformat_meth_or_given, m) ? \ | |
132 IIFORMAT_METH (MTiiformat_meth_or_given, m, args) : (given) \ | |
133 MAC_END | |
134 | |
135 /***** Defining new image-instantiator types *****/ | |
136 | |
137 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \ | |
138 extern struct image_instantiator_methods *format##_image_instantiator_methods | |
139 | |
140 #define DEFINE_IMAGE_INSTANTIATOR_FORMAT(format) \ | |
141 struct image_instantiator_methods *format##_image_instantiator_methods | |
142 | |
143 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \ | |
144 do { \ | |
145 format##_image_instantiator_methods = \ | |
146 malloc_type_and_zero (struct image_instantiator_methods); \ | |
147 defsymbol (&Q##format, obj_name); \ | |
148 format##_image_instantiator_methods->symbol = Q##format; \ | |
149 format##_image_instantiator_methods->keywords = \ | |
150 Dynarr_new (struct ii_keyword_entry); \ | |
151 add_entry_to_image_instantiator_format_list \ | |
152 (Q##format, format##_image_instantiator_methods); \ | |
153 } while (0) | |
154 | |
155 /* Declare that image-instantiator format FORMAT has method M; used in | |
156 initialization routines */ | |
157 #define IIFORMAT_HAS_METHOD(format, m) \ | |
158 (format##_image_instantiator_methods->m##_method = format##_##m) | |
159 | |
160 /* Declare that KEYW is a valid keyword for image-instantiator format | |
161 FORMAT. VALIDATE_FUN if a function that returns whether the data | |
162 is valid. The keyword may not appear more than once. */ | |
163 #define IIFORMAT_VALID_KEYWORD(format, keyw, validate_fun) \ | |
164 do { \ | |
165 struct ii_keyword_entry entry; \ | |
166 \ | |
167 entry.keyword = keyw; \ | |
168 entry.validate = validate_fun; \ | |
169 entry.multiple_p = 0; \ | |
170 Dynarr_add (format##_image_instantiator_methods->keywords, \ | |
171 entry); \ | |
172 } while (0) | |
173 | |
174 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may | |
175 appear multiple times. */ | |
176 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyword, validate_fun) \ | |
177 do { \ | |
178 struct ii_keyword_entry entry; \ | |
179 \ | |
180 entry.keyword = keyword; \ | |
181 entry.validate = validate_fun; \ | |
182 entry.multiple_p = 1; \ | |
183 Dynarr_add (format##_image_instantiator_methods->keywords, \ | |
184 entry); \ | |
185 } while (0) | |
186 | |
187 extern Lisp_Object Q_data, Q_file; | |
188 | |
189 void add_entry_to_image_instantiator_format_list (Lisp_Object symbol, | |
190 struct image_instantiator_methods *meths); | |
191 Lisp_Object find_keyword_in_vector (Lisp_Object vector, | |
192 Lisp_Object keyword); | |
193 Lisp_Object find_keyword_in_vector_or_given (Lisp_Object vector, | |
194 Lisp_Object keyword, | |
195 Lisp_Object defalt); | |
196 void check_valid_string (Lisp_Object data); | |
197 void check_valid_int (Lisp_Object data); | |
198 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator, | |
199 int given_dest_mask, | |
200 int desired_dest_mask)); | |
201 | |
202 /***************************************************************************** | |
203 * Image Specifier Object * | |
204 *****************************************************************************/ | |
205 | |
206 DECLARE_SPECIFIER_TYPE (image); | |
207 extern Lisp_Object Qimage; | |
208 #define XIMAGE_SPECIFIER(x) XSPECIFIER_TYPE (x, image) | |
209 #define XSETIMAGE_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, image) | |
210 #define IMAGE_SPECIFIERP(x) SPECIFIER_TYPEP (x, image) | |
211 #define CHECK_IMAGE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, image) | |
212 #define CONCHECK_IMAGE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, image) | |
213 | |
214 void set_image_attached_to (Lisp_Object obj, Lisp_Object face_or_glyph, | |
215 Lisp_Object property); | |
216 | |
217 struct image_specifier | |
218 { | |
219 int allowed; | |
220 Lisp_Object attachee; /* face or glyph this is attached to, or nil */ | |
221 Lisp_Object attachee_property;/* property of that face or glyph */ | |
222 }; | |
223 | |
224 #define IMAGE_SPECIFIER_DATA(g) (SPECIFIER_TYPE_DATA (g, image)) | |
225 #define IMAGE_SPECIFIER_ALLOWED(g) (IMAGE_SPECIFIER_DATA (g)->allowed) | |
226 #define IMAGE_SPECIFIER_ATTACHEE(g) (IMAGE_SPECIFIER_DATA (g)->attachee) | |
227 #define IMAGE_SPECIFIER_ATTACHEE_PROPERTY(g) \ | |
228 (IMAGE_SPECIFIER_DATA (g)->attachee_property) | |
229 | |
230 #define XIMAGE_SPECIFIER_ALLOWED(g) \ | |
231 IMAGE_SPECIFIER_ALLOWED (XIMAGE_SPECIFIER (g)) | |
232 | |
233 /***************************************************************************** | |
234 * Image Instance Object * | |
235 *****************************************************************************/ | |
236 | |
237 DECLARE_LRECORD (image_instance, struct Lisp_Image_Instance); | |
238 #define XIMAGE_INSTANCE(x) \ | |
239 XRECORD (x, image_instance, struct Lisp_Image_Instance) | |
240 #define XSETIMAGE_INSTANCE(x, p) XSETRECORD (x, p, image_instance) | |
241 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance) | |
242 #define GC_IMAGE_INSTANCEP(x) GC_RECORDP (x, image_instance) | |
243 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance) | |
244 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance) | |
245 | |
246 enum image_instance_type | |
247 { | |
248 IMAGE_UNKNOWN, | |
249 IMAGE_NOTHING, | |
250 IMAGE_TEXT, | |
251 IMAGE_MONO_PIXMAP, | |
252 IMAGE_COLOR_PIXMAP, | |
253 IMAGE_POINTER, | |
254 IMAGE_SUBWINDOW | |
255 }; | |
256 | |
257 #define IMAGE_NOTHING_MASK (1 << 0) | |
258 #define IMAGE_TEXT_MASK (1 << 1) | |
259 #define IMAGE_MONO_PIXMAP_MASK (1 << 2) | |
260 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3) | |
261 #define IMAGE_POINTER_MASK (1 << 4) | |
262 #define IMAGE_SUBWINDOW_MASK (1 << 5) | |
263 | |
264 extern Lisp_Object Qnothing_image_instance_p, Qtext_image_instance_p; | |
265 extern Lisp_Object Qmono_pixmap_image_instance_p; | |
266 extern Lisp_Object Qcolor_pixmap_image_instance_p; | |
267 extern Lisp_Object Qpointer_image_instance_p; | |
268 extern Lisp_Object Qsubwindow_image_instance_p; | |
269 | |
270 #define IMAGE_INSTANCE_TYPE_P(ii, type) \ | |
271 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type) | |
272 | |
273 #define NOTHING_IMAGE_INSTANCEP(ii) IMAGE_INSTANCE_TYPE_P (ii, IMAGE_NOTHING) | |
274 #define TEXT_IMAGE_INSTANCEP(ii) IMAGE_INSTANCE_TYPE_P (ii, IMAGE_TEXT) | |
275 #define MONO_PIXMAP_IMAGE_INSTANCEP(ii) \ | |
276 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_MONO_PIXMAP) | |
277 #define COLOR_PIXMAP_IMAGE_INSTANCEP(ii) \ | |
278 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_COLOR_PIXMAP) | |
279 #define POINTER_IMAGE_INSTANCEP(ii) IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER) | |
280 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \ | |
281 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW) | |
282 | |
283 #define CHECK_NOTHING_IMAGE_INSTANCE(x) \ | |
284 do { CHECK_IMAGE_INSTANCE (x); \ | |
285 if (!NOTHING_IMAGE_INSTANCEP (x)) \ | |
286 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \ | |
287 } while (0) | |
288 | |
289 #define CHECK_TEXT_IMAGE_INSTANCE(x) \ | |
290 do { CHECK_IMAGE_INSTANCE (x); \ | |
291 if (!TEXT_IMAGE_INSTANCEP (x)) \ | |
292 x = wrong_type_argument (Qtext_image_instance_p, (x)); \ | |
293 } while (0) | |
294 | |
295 #define CHECK_MONO_PIXMAP_IMAGE_INSTANCE(x) \ | |
296 do { CHECK_IMAGE_INSTANCE (x); \ | |
297 if (!MONO_PIXMAP_IMAGE_INSTANCEP (x)) \ | |
298 x = wrong_type_argument (Qmono_pixmap_image_instance_p, (x)); \ | |
299 } while (0) | |
300 | |
301 #define CHECK_COLOR_PIXMAP_IMAGE_INSTANCE(x) \ | |
302 do { CHECK_IMAGE_INSTANCE (x); \ | |
303 if (!COLOR_PIXMAP_IMAGE_INSTANCEP (x)) \ | |
304 x = wrong_type_argument (Qcolor_pixmap_image_instance_p, (x)); \ | |
305 } while (0) | |
306 | |
307 #define CHECK_POINTER_IMAGE_INSTANCE(x) \ | |
308 do { CHECK_IMAGE_INSTANCE (x); \ | |
309 if (!POINTER_IMAGE_INSTANCEP (x)) \ | |
310 x = wrong_type_argument (Qpointer_image_instance_p, (x)); \ | |
311 } while (0) | |
312 | |
313 #define CHECK_SUBWINDOW_IMAGE_INSTANCE(x) \ | |
314 do { CHECK_IMAGE_INSTANCE (x); \ | |
315 if (!SUBWINDOW_IMAGE_INSTANCEP (x)) \ | |
316 x = wrong_type_argument (Qsubwindow_image_instance_p, (x)); \ | |
317 } while (0) | |
318 | |
319 struct Lisp_Image_Instance | |
320 { | |
321 struct lcrecord_header header; | |
322 Lisp_Object device; | |
323 Lisp_Object name; | |
324 enum image_instance_type type; | |
325 union | |
326 { | |
327 struct | |
328 { | |
329 Lisp_Object string; | |
330 } text; | |
331 struct | |
332 { | |
333 int width, height, depth; | |
334 Lisp_Object hotspot_x, hotspot_y; /* integer or Qnil */ | |
335 Lisp_Object filename; /* string or Qnil */ | |
336 Lisp_Object mask_filename; /* string or Qnil */ | |
337 Lisp_Object fg, bg; /* foreground and background colors, | |
338 if this is a colorized mono-pixmap | |
339 or a pointer */ | |
340 } pixmap; /* used for pointers as well */ | |
341 struct | |
342 { | |
343 int dummy; /* #### fill in this structure */ | |
344 } subwindow; | |
345 } u; | |
346 | |
347 /* console-type- and image-type-specific data */ | |
348 void *data; | |
349 }; | |
350 | |
351 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device) | |
352 #define IMAGE_INSTANCE_NAME(i) ((i)->name) | |
353 #define IMAGE_INSTANCE_TYPE(i) ((i)->type) | |
354 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \ | |
355 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \ | |
356 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP)) | |
357 | |
358 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string) | |
359 | |
360 #define IMAGE_INSTANCE_PIXMAP_WIDTH(i) ((i)->u.pixmap.width) | |
361 #define IMAGE_INSTANCE_PIXMAP_HEIGHT(i) ((i)->u.pixmap.height) | |
362 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth) | |
363 #define IMAGE_INSTANCE_PIXMAP_FILENAME(i) ((i)->u.pixmap.filename) | |
364 #define IMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) ((i)->u.pixmap.mask_filename) | |
365 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) ((i)->u.pixmap.hotspot_x) | |
366 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) ((i)->u.pixmap.hotspot_y) | |
367 #define IMAGE_INSTANCE_PIXMAP_FG(i) ((i)->u.pixmap.fg) | |
368 #define IMAGE_INSTANCE_PIXMAP_BG(i) ((i)->u.pixmap.bg) | |
369 | |
370 #define XIMAGE_INSTANCE_DEVICE(i) \ | |
371 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i)) | |
372 #define XIMAGE_INSTANCE_NAME(i) \ | |
373 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i)) | |
374 #define XIMAGE_INSTANCE_TYPE(i) \ | |
375 IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (i)) | |
376 | |
377 #define XIMAGE_INSTANCE_TEXT_STRING(i) \ | |
378 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i)) | |
379 | |
380 #define XIMAGE_INSTANCE_PIXMAP_WIDTH(i) \ | |
381 IMAGE_INSTANCE_PIXMAP_WIDTH (XIMAGE_INSTANCE (i)) | |
382 #define XIMAGE_INSTANCE_PIXMAP_HEIGHT(i) \ | |
383 IMAGE_INSTANCE_PIXMAP_HEIGHT (XIMAGE_INSTANCE (i)) | |
384 #define XIMAGE_INSTANCE_PIXMAP_DEPTH(i) \ | |
385 IMAGE_INSTANCE_PIXMAP_DEPTH (XIMAGE_INSTANCE (i)) | |
386 #define XIMAGE_INSTANCE_PIXMAP_FILENAME(i) \ | |
387 IMAGE_INSTANCE_PIXMAP_FILENAME (XIMAGE_INSTANCE (i)) | |
388 #define XIMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) \ | |
389 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (XIMAGE_INSTANCE (i)) | |
390 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) \ | |
391 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (XIMAGE_INSTANCE (i)) | |
392 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) \ | |
393 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (XIMAGE_INSTANCE (i)) | |
394 #define XIMAGE_INSTANCE_PIXMAP_FG(i) \ | |
395 IMAGE_INSTANCE_PIXMAP_FG (XIMAGE_INSTANCE (i)) | |
396 #define XIMAGE_INSTANCE_PIXMAP_BG(i) \ | |
397 IMAGE_INSTANCE_PIXMAP_BG (XIMAGE_INSTANCE (i)) | |
398 | |
399 /***************************************************************************** | |
400 * Glyph Object * | |
401 *****************************************************************************/ | |
402 | |
403 enum glyph_type | |
404 { | |
405 GLYPH_UNKNOWN, | |
406 GLYPH_BUFFER, | |
407 GLYPH_POINTER, | |
408 GLYPH_ICON | |
409 }; | |
410 | |
411 struct Lisp_Glyph | |
412 { | |
413 struct lcrecord_header header; | |
414 | |
415 enum glyph_type type; | |
416 | |
417 /* specifiers: */ | |
418 Lisp_Object image; /* the actual image */ | |
419 Lisp_Object contrib_p; /* whether to figure into line height */ | |
420 Lisp_Object baseline; /* percent above baseline */ | |
421 | |
422 Lisp_Object face; /* if non-nil, face to use when displaying */ | |
423 | |
424 Lisp_Object plist; | |
425 void (*after_change) (Lisp_Object glyph, Lisp_Object property, | |
426 Lisp_Object locale); | |
427 }; | |
428 | |
429 DECLARE_LRECORD (glyph, struct Lisp_Glyph); | |
430 #define XGLYPH(x) XRECORD (x, glyph, struct Lisp_Glyph) | |
431 #define XSETGLYPH(x, p) XSETRECORD (x, p, glyph) | |
432 #define GLYPHP(x) RECORDP (x, glyph) | |
433 #define GC_GLYPHP(x) GC_RECORDP (x, glyph) | |
434 #define CHECK_GLYPH(x) CHECK_RECORD (x, glyph) | |
435 #define CONCHECK_GLYPH(x) CONCHECK_RECORD (x, glyph) | |
436 | |
437 extern Lisp_Object Qbuffer_glyph_p, Qpointer_glyph_p, Qicon_glyph_p; | |
438 | |
439 #define CHECK_BUFFER_GLYPH(x) \ | |
440 do { CHECK_GLYPH (x); \ | |
441 if (XGLYPH (x)->type != GLYPH_BUFFER) \ | |
442 x = wrong_type_argument (Qbuffer_glyph_p, (x)); \ | |
443 } while (0) | |
444 | |
445 #define CHECK_POINTER_GLYPH(x) \ | |
446 do { CHECK_GLYPH (x); \ | |
447 if (XGLYPH (x)->type != GLYPH_POINTER) \ | |
448 x = wrong_type_argument (Qpointer_glyph_p, (x)); \ | |
449 } while (0) | |
450 | |
451 #define CHECK_ICON_GLYPH(x) \ | |
452 do { CHECK_GLYPH (x); \ | |
453 if (XGLYPH (x)->type != GLYPH_ICON) \ | |
454 x = wrong_type_argument (Qicon_glyph_p, (x)); \ | |
455 } while (0) | |
456 | |
457 #define GLYPH_TYPE(g) ((g)->type) | |
458 #define GLYPH_IMAGE(g) ((g)->image) | |
459 #define GLYPH_CONTRIB_P(g) ((g)->contrib_p) | |
460 #define GLYPH_BASELINE(g) ((g)->baseline) | |
461 #define GLYPH_FACE(g) ((g)->face) | |
462 | |
463 #define XGLYPH_TYPE(g) GLYPH_TYPE (XGLYPH (g)) | |
464 #define XGLYPH_IMAGE(g) GLYPH_IMAGE (XGLYPH (g)) | |
465 #define XGLYPH_CONTRIB_P(g) GLYPH_CONTRIB_P (XGLYPH (g)) | |
466 #define XGLYPH_BASELINE(g) GLYPH_BASELINE (XGLYPH (g)) | |
467 #define XGLYPH_FACE(g) GLYPH_FACE (XGLYPH (g)) | |
468 | |
469 extern Lisp_Object Vtruncation_glyph, Vcontinuation_glyph, Voctal_escape_glyph; | |
470 extern Lisp_Object Vcontrol_arrow_glyph, Vinvisible_text_glyph, Vhscroll_glyph; | |
471 extern Lisp_Object Vxemacs_logo; | |
472 | |
473 unsigned short glyph_width (Lisp_Object glyph, Lisp_Object frame_face, | |
474 face_index window_findex, | |
475 Lisp_Object window); | |
476 unsigned short glyph_ascent (Lisp_Object glyph, Lisp_Object frame_face, | |
477 face_index window_findex, | |
478 Lisp_Object window); | |
479 unsigned short glyph_descent (Lisp_Object glyph, | |
480 Lisp_Object frame_face, | |
481 face_index window_findex, | |
482 Lisp_Object window); | |
483 unsigned short glyph_height (Lisp_Object glyph, Lisp_Object frame_face, | |
484 face_index window_findex, | |
485 Lisp_Object window); | |
486 Lisp_Object glyph_baseline (Lisp_Object glyph, Lisp_Object domain); | |
487 Lisp_Object glyph_face (Lisp_Object glyph, Lisp_Object domain); | |
488 int glyph_contrib_p (Lisp_Object glyph, Lisp_Object domain); | |
489 Lisp_Object glyph_image_instance (Lisp_Object glyph, | |
490 Lisp_Object domain, | |
491 Error_behavior errb, int no_quit); | |
492 void file_or_data_must_be_present (Lisp_Object instantiator); | |
493 void data_must_be_present (Lisp_Object instantiator); | |
494 Lisp_Object make_string_from_file (Lisp_Object file); | |
495 Lisp_Object tagged_vector_to_alist (Lisp_Object vector); | |
496 Lisp_Object alist_to_tagged_vector (Lisp_Object tag, Lisp_Object alist); | |
497 void string_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | |
498 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | |
499 int dest_mask); | |
500 Lisp_Object allocate_glyph (enum glyph_type type, | |
501 void (*after_change) (Lisp_Object glyph, | |
502 Lisp_Object property, | |
503 Lisp_Object locale)); | |
504 | |
505 /***************************************************************************** | |
506 * Glyph Cachels * | |
507 *****************************************************************************/ | |
508 | |
509 struct glyph_cachel | |
510 { | |
511 Lisp_Object glyph; | |
512 | |
513 unsigned int updated :1; | |
514 unsigned short width; | |
515 unsigned short ascent; | |
516 unsigned short descent; | |
517 }; | |
518 | |
519 #define CONT_GLYPH_INDEX (glyph_index) 0 | |
520 #define TRUN_GLYPH_INDEX (glyph_index) 1 | |
521 #define HSCROLL_GLYPH_INDEX (glyph_index) 2 | |
522 #define CONTROL_GLYPH_INDEX (glyph_index) 3 | |
523 #define OCT_ESC_GLYPH_INDEX (glyph_index) 4 | |
524 #define INVIS_GLYPH_INDEX (glyph_index) 5 | |
525 | |
526 #define GLYPH_CACHEL(window, index) \ | |
527 Dynarr_atp (window->glyph_cachels, index) | |
528 #define GLYPH_CACHEL_GLYPH(window, index) \ | |
529 Dynarr_atp (window->glyph_cachels, index)->glyph | |
530 #define GLYPH_CACHEL_WIDTH(window, index) \ | |
531 Dynarr_atp (window->glyph_cachels, index)->width | |
532 #define GLYPH_CACHEL_ASCENT(window, index) \ | |
533 Dynarr_atp (window->glyph_cachels, index)->ascent | |
534 #define GLYPH_CACHEL_DESCENT(window, index) \ | |
535 Dynarr_atp (window->glyph_cachels, index)->descent | |
536 | |
537 void mark_glyph_cachels (glyph_cachel_dynarr *elements, | |
538 void (*markobj) (Lisp_Object)); | |
539 void mark_glyph_cachels_as_not_updated (struct window *w); | |
540 void reset_glyph_cachels (struct window *w); | |
541 #ifdef MEMORY_USAGE_STATS | |
542 int compute_glyph_cachel_usage (glyph_cachel_dynarr *glyph_cachels, | |
543 struct overhead_stats *ovstats); | |
544 #endif /* MEMORY_USAGE_STATS */ | |
545 | |
546 /***************************************************************************** | |
547 * Display Tables * | |
548 *****************************************************************************/ | |
549 | |
550 #define DISP_TABLE_SIZE 256 | |
551 #define DISP_CHAR_ENTRY(dp, c) ((dp)->contents[c]) | |
552 | |
553 struct Lisp_Vector *get_display_table (struct window *, face_index); | |
554 | |
555 #endif /* _XEMACS_GLYPHS_H_ */ |