0
|
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
|
122
|
54 autodetect mono-pixmap, color-pixmap, pointer,
|
120
|
55 text
|
0
|
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,
|
124
|
98 int dest_mask,
|
|
99 Lisp_Object domain);
|
0
|
100 };
|
|
101
|
|
102 struct ii_keyword_entry
|
|
103 {
|
|
104 Lisp_Object keyword;
|
|
105 void (*validate) (Lisp_Object data);
|
|
106 int multiple_p;
|
|
107 };
|
|
108
|
|
109 /***** Calling an image-instantiator method *****/
|
|
110
|
|
111 #define HAS_IIFORMAT_METH_P(mstruc, m) ((mstruc)->m##_method)
|
|
112 #define IIFORMAT_METH(mstruc, m, args) (((mstruc)->m##_method) args)
|
|
113
|
|
114 /* Call a void-returning specifier method, if it exists */
|
|
115 #define MAYBE_IIFORMAT_METH(mstruc, m, args) \
|
|
116 do { \
|
|
117 struct image_instantiator_methods *_maybe_iiformat_meth_mstruc = (mstruc); \
|
|
118 if (HAS_IIFORMAT_METH_P (_maybe_iiformat_meth_mstruc, m)) \
|
|
119 IIFORMAT_METH (_maybe_iiformat_meth_mstruc, m, args); \
|
|
120 } while (0)
|
|
121
|
|
122 MAC_DECLARE_EXTERN (struct image_instantiator_methods *,
|
|
123 MTiiformat_meth_or_given)
|
|
124
|
|
125 /* Call a specifier method, if it exists; otherwise return
|
|
126 the specified value */
|
|
127
|
|
128 #define IIFORMAT_METH_OR_GIVEN(mstruc, m, args, given) \
|
|
129 MAC_BEGIN \
|
|
130 MAC_DECLARE (struct image_instantiator_methods *, \
|
|
131 MTiiformat_meth_or_given, mstruc) \
|
|
132 HAS_IIFORMAT_METH_P (MTiiformat_meth_or_given, m) ? \
|
|
133 IIFORMAT_METH (MTiiformat_meth_or_given, m, args) : (given) \
|
|
134 MAC_END
|
|
135
|
|
136 /***** Defining new image-instantiator types *****/
|
|
137
|
|
138 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \
|
|
139 extern struct image_instantiator_methods *format##_image_instantiator_methods
|
|
140
|
|
141 #define DEFINE_IMAGE_INSTANTIATOR_FORMAT(format) \
|
|
142 struct image_instantiator_methods *format##_image_instantiator_methods
|
|
143
|
|
144 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \
|
|
145 do { \
|
|
146 format##_image_instantiator_methods = \
|
|
147 malloc_type_and_zero (struct image_instantiator_methods); \
|
|
148 defsymbol (&Q##format, obj_name); \
|
|
149 format##_image_instantiator_methods->symbol = Q##format; \
|
|
150 format##_image_instantiator_methods->keywords = \
|
|
151 Dynarr_new (struct ii_keyword_entry); \
|
|
152 add_entry_to_image_instantiator_format_list \
|
|
153 (Q##format, format##_image_instantiator_methods); \
|
|
154 } while (0)
|
|
155
|
|
156 /* Declare that image-instantiator format FORMAT has method M; used in
|
|
157 initialization routines */
|
|
158 #define IIFORMAT_HAS_METHOD(format, m) \
|
|
159 (format##_image_instantiator_methods->m##_method = format##_##m)
|
|
160
|
|
161 /* Declare that KEYW is a valid keyword for image-instantiator format
|
|
162 FORMAT. VALIDATE_FUN if a function that returns whether the data
|
|
163 is valid. The keyword may not appear more than once. */
|
|
164 #define IIFORMAT_VALID_KEYWORD(format, keyw, validate_fun) \
|
|
165 do { \
|
|
166 struct ii_keyword_entry entry; \
|
|
167 \
|
|
168 entry.keyword = keyw; \
|
|
169 entry.validate = validate_fun; \
|
|
170 entry.multiple_p = 0; \
|
|
171 Dynarr_add (format##_image_instantiator_methods->keywords, \
|
|
172 entry); \
|
|
173 } while (0)
|
|
174
|
|
175 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may
|
|
176 appear multiple times. */
|
|
177 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyword, validate_fun) \
|
|
178 do { \
|
|
179 struct ii_keyword_entry entry; \
|
|
180 \
|
|
181 entry.keyword = keyword; \
|
|
182 entry.validate = validate_fun; \
|
|
183 entry.multiple_p = 1; \
|
|
184 Dynarr_add (format##_image_instantiator_methods->keywords, \
|
|
185 entry); \
|
|
186 } while (0)
|
|
187
|
|
188 extern Lisp_Object Q_data, Q_file;
|
|
189
|
|
190 void add_entry_to_image_instantiator_format_list (Lisp_Object symbol,
|
|
191 struct image_instantiator_methods *meths);
|
|
192 Lisp_Object find_keyword_in_vector (Lisp_Object vector,
|
|
193 Lisp_Object keyword);
|
|
194 Lisp_Object find_keyword_in_vector_or_given (Lisp_Object vector,
|
|
195 Lisp_Object keyword,
|
|
196 Lisp_Object defalt);
|
|
197 void check_valid_string (Lisp_Object data);
|
|
198 void check_valid_int (Lisp_Object data);
|
|
199 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator,
|
|
200 int given_dest_mask,
|
|
201 int desired_dest_mask));
|
|
202
|
|
203 /*****************************************************************************
|
|
204 * Image Specifier Object *
|
|
205 *****************************************************************************/
|
|
206
|
|
207 DECLARE_SPECIFIER_TYPE (image);
|
|
208 extern Lisp_Object Qimage;
|
|
209 #define XIMAGE_SPECIFIER(x) XSPECIFIER_TYPE (x, image)
|
|
210 #define XSETIMAGE_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, image)
|
|
211 #define IMAGE_SPECIFIERP(x) SPECIFIER_TYPEP (x, image)
|
|
212 #define CHECK_IMAGE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, image)
|
|
213 #define CONCHECK_IMAGE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, image)
|
|
214
|
|
215 void set_image_attached_to (Lisp_Object obj, Lisp_Object face_or_glyph,
|
|
216 Lisp_Object property);
|
|
217
|
|
218 struct image_specifier
|
|
219 {
|
|
220 int allowed;
|
|
221 Lisp_Object attachee; /* face or glyph this is attached to, or nil */
|
|
222 Lisp_Object attachee_property;/* property of that face or glyph */
|
|
223 };
|
|
224
|
|
225 #define IMAGE_SPECIFIER_DATA(g) (SPECIFIER_TYPE_DATA (g, image))
|
|
226 #define IMAGE_SPECIFIER_ALLOWED(g) (IMAGE_SPECIFIER_DATA (g)->allowed)
|
|
227 #define IMAGE_SPECIFIER_ATTACHEE(g) (IMAGE_SPECIFIER_DATA (g)->attachee)
|
|
228 #define IMAGE_SPECIFIER_ATTACHEE_PROPERTY(g) \
|
|
229 (IMAGE_SPECIFIER_DATA (g)->attachee_property)
|
|
230
|
|
231 #define XIMAGE_SPECIFIER_ALLOWED(g) \
|
|
232 IMAGE_SPECIFIER_ALLOWED (XIMAGE_SPECIFIER (g))
|
|
233
|
|
234 /*****************************************************************************
|
|
235 * Image Instance Object *
|
|
236 *****************************************************************************/
|
|
237
|
|
238 DECLARE_LRECORD (image_instance, struct Lisp_Image_Instance);
|
|
239 #define XIMAGE_INSTANCE(x) \
|
|
240 XRECORD (x, image_instance, struct Lisp_Image_Instance)
|
|
241 #define XSETIMAGE_INSTANCE(x, p) XSETRECORD (x, p, image_instance)
|
|
242 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance)
|
|
243 #define GC_IMAGE_INSTANCEP(x) GC_RECORDP (x, image_instance)
|
|
244 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance)
|
|
245 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance)
|
|
246
|
|
247 enum image_instance_type
|
|
248 {
|
|
249 IMAGE_UNKNOWN,
|
|
250 IMAGE_NOTHING,
|
|
251 IMAGE_TEXT,
|
|
252 IMAGE_MONO_PIXMAP,
|
|
253 IMAGE_COLOR_PIXMAP,
|
|
254 IMAGE_POINTER,
|
|
255 IMAGE_SUBWINDOW
|
|
256 };
|
|
257
|
|
258 #define IMAGE_NOTHING_MASK (1 << 0)
|
|
259 #define IMAGE_TEXT_MASK (1 << 1)
|
|
260 #define IMAGE_MONO_PIXMAP_MASK (1 << 2)
|
|
261 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3)
|
|
262 #define IMAGE_POINTER_MASK (1 << 4)
|
|
263 #define IMAGE_SUBWINDOW_MASK (1 << 5)
|
|
264
|
|
265 extern Lisp_Object Qnothing_image_instance_p, Qtext_image_instance_p;
|
|
266 extern Lisp_Object Qmono_pixmap_image_instance_p;
|
|
267 extern Lisp_Object Qcolor_pixmap_image_instance_p;
|
|
268 extern Lisp_Object Qpointer_image_instance_p;
|
|
269 extern Lisp_Object Qsubwindow_image_instance_p;
|
|
270
|
|
271 #define IMAGE_INSTANCE_TYPE_P(ii, type) \
|
|
272 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type)
|
|
273
|
|
274 #define NOTHING_IMAGE_INSTANCEP(ii) IMAGE_INSTANCE_TYPE_P (ii, IMAGE_NOTHING)
|
|
275 #define TEXT_IMAGE_INSTANCEP(ii) IMAGE_INSTANCE_TYPE_P (ii, IMAGE_TEXT)
|
|
276 #define MONO_PIXMAP_IMAGE_INSTANCEP(ii) \
|
|
277 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_MONO_PIXMAP)
|
|
278 #define COLOR_PIXMAP_IMAGE_INSTANCEP(ii) \
|
|
279 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_COLOR_PIXMAP)
|
|
280 #define POINTER_IMAGE_INSTANCEP(ii) IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER)
|
|
281 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \
|
|
282 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW)
|
|
283
|
|
284 #define CHECK_NOTHING_IMAGE_INSTANCE(x) \
|
|
285 do { CHECK_IMAGE_INSTANCE (x); \
|
|
286 if (!NOTHING_IMAGE_INSTANCEP (x)) \
|
|
287 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \
|
|
288 } while (0)
|
|
289
|
|
290 #define CHECK_TEXT_IMAGE_INSTANCE(x) \
|
|
291 do { CHECK_IMAGE_INSTANCE (x); \
|
|
292 if (!TEXT_IMAGE_INSTANCEP (x)) \
|
|
293 x = wrong_type_argument (Qtext_image_instance_p, (x)); \
|
|
294 } while (0)
|
|
295
|
|
296 #define CHECK_MONO_PIXMAP_IMAGE_INSTANCE(x) \
|
|
297 do { CHECK_IMAGE_INSTANCE (x); \
|
|
298 if (!MONO_PIXMAP_IMAGE_INSTANCEP (x)) \
|
|
299 x = wrong_type_argument (Qmono_pixmap_image_instance_p, (x)); \
|
|
300 } while (0)
|
|
301
|
|
302 #define CHECK_COLOR_PIXMAP_IMAGE_INSTANCE(x) \
|
|
303 do { CHECK_IMAGE_INSTANCE (x); \
|
|
304 if (!COLOR_PIXMAP_IMAGE_INSTANCEP (x)) \
|
|
305 x = wrong_type_argument (Qcolor_pixmap_image_instance_p, (x)); \
|
|
306 } while (0)
|
|
307
|
|
308 #define CHECK_POINTER_IMAGE_INSTANCE(x) \
|
|
309 do { CHECK_IMAGE_INSTANCE (x); \
|
|
310 if (!POINTER_IMAGE_INSTANCEP (x)) \
|
|
311 x = wrong_type_argument (Qpointer_image_instance_p, (x)); \
|
|
312 } while (0)
|
|
313
|
|
314 #define CHECK_SUBWINDOW_IMAGE_INSTANCE(x) \
|
|
315 do { CHECK_IMAGE_INSTANCE (x); \
|
|
316 if (!SUBWINDOW_IMAGE_INSTANCEP (x)) \
|
|
317 x = wrong_type_argument (Qsubwindow_image_instance_p, (x)); \
|
|
318 } while (0)
|
|
319
|
|
320 struct Lisp_Image_Instance
|
|
321 {
|
|
322 struct lcrecord_header header;
|
|
323 Lisp_Object device;
|
|
324 Lisp_Object name;
|
|
325 enum image_instance_type type;
|
|
326 union
|
|
327 {
|
|
328 struct
|
|
329 {
|
|
330 Lisp_Object string;
|
|
331 } text;
|
|
332 struct
|
|
333 {
|
|
334 int width, height, depth;
|
|
335 Lisp_Object hotspot_x, hotspot_y; /* integer or Qnil */
|
|
336 Lisp_Object filename; /* string or Qnil */
|
|
337 Lisp_Object mask_filename; /* string or Qnil */
|
|
338 Lisp_Object fg, bg; /* foreground and background colors,
|
|
339 if this is a colorized mono-pixmap
|
|
340 or a pointer */
|
|
341 } pixmap; /* used for pointers as well */
|
|
342 struct
|
|
343 {
|
|
344 int dummy; /* #### fill in this structure */
|
|
345 } subwindow;
|
|
346 } u;
|
|
347
|
|
348 /* console-type- and image-type-specific data */
|
|
349 void *data;
|
|
350 };
|
|
351
|
|
352 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device)
|
|
353 #define IMAGE_INSTANCE_NAME(i) ((i)->name)
|
|
354 #define IMAGE_INSTANCE_TYPE(i) ((i)->type)
|
|
355 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \
|
|
356 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \
|
|
357 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP))
|
|
358
|
|
359 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string)
|
|
360
|
|
361 #define IMAGE_INSTANCE_PIXMAP_WIDTH(i) ((i)->u.pixmap.width)
|
|
362 #define IMAGE_INSTANCE_PIXMAP_HEIGHT(i) ((i)->u.pixmap.height)
|
|
363 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth)
|
|
364 #define IMAGE_INSTANCE_PIXMAP_FILENAME(i) ((i)->u.pixmap.filename)
|
|
365 #define IMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) ((i)->u.pixmap.mask_filename)
|
|
366 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) ((i)->u.pixmap.hotspot_x)
|
|
367 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) ((i)->u.pixmap.hotspot_y)
|
|
368 #define IMAGE_INSTANCE_PIXMAP_FG(i) ((i)->u.pixmap.fg)
|
|
369 #define IMAGE_INSTANCE_PIXMAP_BG(i) ((i)->u.pixmap.bg)
|
|
370
|
|
371 #define XIMAGE_INSTANCE_DEVICE(i) \
|
|
372 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i))
|
|
373 #define XIMAGE_INSTANCE_NAME(i) \
|
|
374 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i))
|
|
375 #define XIMAGE_INSTANCE_TYPE(i) \
|
|
376 IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (i))
|
|
377
|
|
378 #define XIMAGE_INSTANCE_TEXT_STRING(i) \
|
|
379 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i))
|
|
380
|
|
381 #define XIMAGE_INSTANCE_PIXMAP_WIDTH(i) \
|
|
382 IMAGE_INSTANCE_PIXMAP_WIDTH (XIMAGE_INSTANCE (i))
|
|
383 #define XIMAGE_INSTANCE_PIXMAP_HEIGHT(i) \
|
|
384 IMAGE_INSTANCE_PIXMAP_HEIGHT (XIMAGE_INSTANCE (i))
|
|
385 #define XIMAGE_INSTANCE_PIXMAP_DEPTH(i) \
|
|
386 IMAGE_INSTANCE_PIXMAP_DEPTH (XIMAGE_INSTANCE (i))
|
|
387 #define XIMAGE_INSTANCE_PIXMAP_FILENAME(i) \
|
|
388 IMAGE_INSTANCE_PIXMAP_FILENAME (XIMAGE_INSTANCE (i))
|
|
389 #define XIMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) \
|
|
390 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (XIMAGE_INSTANCE (i))
|
|
391 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) \
|
|
392 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (XIMAGE_INSTANCE (i))
|
|
393 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) \
|
|
394 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (XIMAGE_INSTANCE (i))
|
|
395 #define XIMAGE_INSTANCE_PIXMAP_FG(i) \
|
|
396 IMAGE_INSTANCE_PIXMAP_FG (XIMAGE_INSTANCE (i))
|
|
397 #define XIMAGE_INSTANCE_PIXMAP_BG(i) \
|
|
398 IMAGE_INSTANCE_PIXMAP_BG (XIMAGE_INSTANCE (i))
|
|
399
|
|
400 /*****************************************************************************
|
|
401 * Glyph Object *
|
|
402 *****************************************************************************/
|
|
403
|
|
404 enum glyph_type
|
|
405 {
|
|
406 GLYPH_UNKNOWN,
|
|
407 GLYPH_BUFFER,
|
|
408 GLYPH_POINTER,
|
|
409 GLYPH_ICON
|
|
410 };
|
|
411
|
|
412 struct Lisp_Glyph
|
|
413 {
|
|
414 struct lcrecord_header header;
|
|
415
|
|
416 enum glyph_type type;
|
|
417
|
|
418 /* specifiers: */
|
|
419 Lisp_Object image; /* the actual image */
|
|
420 Lisp_Object contrib_p; /* whether to figure into line height */
|
|
421 Lisp_Object baseline; /* percent above baseline */
|
|
422
|
|
423 Lisp_Object face; /* if non-nil, face to use when displaying */
|
|
424
|
|
425 Lisp_Object plist;
|
|
426 void (*after_change) (Lisp_Object glyph, Lisp_Object property,
|
|
427 Lisp_Object locale);
|
|
428 };
|
|
429
|
|
430 DECLARE_LRECORD (glyph, struct Lisp_Glyph);
|
|
431 #define XGLYPH(x) XRECORD (x, glyph, struct Lisp_Glyph)
|
|
432 #define XSETGLYPH(x, p) XSETRECORD (x, p, glyph)
|
|
433 #define GLYPHP(x) RECORDP (x, glyph)
|
|
434 #define GC_GLYPHP(x) GC_RECORDP (x, glyph)
|
|
435 #define CHECK_GLYPH(x) CHECK_RECORD (x, glyph)
|
|
436 #define CONCHECK_GLYPH(x) CONCHECK_RECORD (x, glyph)
|
|
437
|
|
438 extern Lisp_Object Qbuffer_glyph_p, Qpointer_glyph_p, Qicon_glyph_p;
|
|
439
|
|
440 #define CHECK_BUFFER_GLYPH(x) \
|
|
441 do { CHECK_GLYPH (x); \
|
|
442 if (XGLYPH (x)->type != GLYPH_BUFFER) \
|
|
443 x = wrong_type_argument (Qbuffer_glyph_p, (x)); \
|
|
444 } while (0)
|
|
445
|
|
446 #define CHECK_POINTER_GLYPH(x) \
|
|
447 do { CHECK_GLYPH (x); \
|
|
448 if (XGLYPH (x)->type != GLYPH_POINTER) \
|
|
449 x = wrong_type_argument (Qpointer_glyph_p, (x)); \
|
|
450 } while (0)
|
|
451
|
|
452 #define CHECK_ICON_GLYPH(x) \
|
|
453 do { CHECK_GLYPH (x); \
|
|
454 if (XGLYPH (x)->type != GLYPH_ICON) \
|
|
455 x = wrong_type_argument (Qicon_glyph_p, (x)); \
|
|
456 } while (0)
|
|
457
|
|
458 #define GLYPH_TYPE(g) ((g)->type)
|
|
459 #define GLYPH_IMAGE(g) ((g)->image)
|
|
460 #define GLYPH_CONTRIB_P(g) ((g)->contrib_p)
|
|
461 #define GLYPH_BASELINE(g) ((g)->baseline)
|
|
462 #define GLYPH_FACE(g) ((g)->face)
|
|
463
|
|
464 #define XGLYPH_TYPE(g) GLYPH_TYPE (XGLYPH (g))
|
|
465 #define XGLYPH_IMAGE(g) GLYPH_IMAGE (XGLYPH (g))
|
|
466 #define XGLYPH_CONTRIB_P(g) GLYPH_CONTRIB_P (XGLYPH (g))
|
|
467 #define XGLYPH_BASELINE(g) GLYPH_BASELINE (XGLYPH (g))
|
|
468 #define XGLYPH_FACE(g) GLYPH_FACE (XGLYPH (g))
|
|
469
|
|
470 extern Lisp_Object Vtruncation_glyph, Vcontinuation_glyph, Voctal_escape_glyph;
|
|
471 extern Lisp_Object Vcontrol_arrow_glyph, Vinvisible_text_glyph, Vhscroll_glyph;
|
|
472 extern Lisp_Object Vxemacs_logo;
|
|
473
|
|
474 unsigned short glyph_width (Lisp_Object glyph, Lisp_Object frame_face,
|
|
475 face_index window_findex,
|
|
476 Lisp_Object window);
|
|
477 unsigned short glyph_ascent (Lisp_Object glyph, Lisp_Object frame_face,
|
|
478 face_index window_findex,
|
|
479 Lisp_Object window);
|
|
480 unsigned short glyph_descent (Lisp_Object glyph,
|
|
481 Lisp_Object frame_face,
|
|
482 face_index window_findex,
|
|
483 Lisp_Object window);
|
|
484 unsigned short glyph_height (Lisp_Object glyph, Lisp_Object frame_face,
|
|
485 face_index window_findex,
|
|
486 Lisp_Object window);
|
|
487 Lisp_Object glyph_baseline (Lisp_Object glyph, Lisp_Object domain);
|
|
488 Lisp_Object glyph_face (Lisp_Object glyph, Lisp_Object domain);
|
|
489 int glyph_contrib_p (Lisp_Object glyph, Lisp_Object domain);
|
|
490 Lisp_Object glyph_image_instance (Lisp_Object glyph,
|
|
491 Lisp_Object domain,
|
|
492 Error_behavior errb, int no_quit);
|
|
493 void file_or_data_must_be_present (Lisp_Object instantiator);
|
|
494 void data_must_be_present (Lisp_Object instantiator);
|
|
495 Lisp_Object make_string_from_file (Lisp_Object file);
|
|
496 Lisp_Object tagged_vector_to_alist (Lisp_Object vector);
|
|
497 Lisp_Object alist_to_tagged_vector (Lisp_Object tag, Lisp_Object alist);
|
|
498 void string_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
499 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
124
|
500 int dest_mask, Lisp_Object domain);
|
0
|
501 Lisp_Object allocate_glyph (enum glyph_type type,
|
|
502 void (*after_change) (Lisp_Object glyph,
|
|
503 Lisp_Object property,
|
|
504 Lisp_Object locale));
|
|
505
|
|
506 /*****************************************************************************
|
|
507 * Glyph Cachels *
|
|
508 *****************************************************************************/
|
|
509
|
|
510 struct glyph_cachel
|
|
511 {
|
|
512 Lisp_Object glyph;
|
|
513
|
|
514 unsigned int updated :1;
|
|
515 unsigned short width;
|
|
516 unsigned short ascent;
|
|
517 unsigned short descent;
|
|
518 };
|
|
519
|
|
520 #define CONT_GLYPH_INDEX (glyph_index) 0
|
|
521 #define TRUN_GLYPH_INDEX (glyph_index) 1
|
|
522 #define HSCROLL_GLYPH_INDEX (glyph_index) 2
|
|
523 #define CONTROL_GLYPH_INDEX (glyph_index) 3
|
|
524 #define OCT_ESC_GLYPH_INDEX (glyph_index) 4
|
|
525 #define INVIS_GLYPH_INDEX (glyph_index) 5
|
|
526
|
|
527 #define GLYPH_CACHEL(window, index) \
|
|
528 Dynarr_atp (window->glyph_cachels, index)
|
|
529 #define GLYPH_CACHEL_GLYPH(window, index) \
|
|
530 Dynarr_atp (window->glyph_cachels, index)->glyph
|
|
531 #define GLYPH_CACHEL_WIDTH(window, index) \
|
|
532 Dynarr_atp (window->glyph_cachels, index)->width
|
|
533 #define GLYPH_CACHEL_ASCENT(window, index) \
|
|
534 Dynarr_atp (window->glyph_cachels, index)->ascent
|
|
535 #define GLYPH_CACHEL_DESCENT(window, index) \
|
|
536 Dynarr_atp (window->glyph_cachels, index)->descent
|
|
537
|
|
538 void mark_glyph_cachels (glyph_cachel_dynarr *elements,
|
|
539 void (*markobj) (Lisp_Object));
|
|
540 void mark_glyph_cachels_as_not_updated (struct window *w);
|
|
541 void reset_glyph_cachels (struct window *w);
|
|
542 #ifdef MEMORY_USAGE_STATS
|
|
543 int compute_glyph_cachel_usage (glyph_cachel_dynarr *glyph_cachels,
|
|
544 struct overhead_stats *ovstats);
|
|
545 #endif /* MEMORY_USAGE_STATS */
|
|
546
|
|
547 /*****************************************************************************
|
|
548 * Display Tables *
|
|
549 *****************************************************************************/
|
|
550
|
|
551 #define DISP_TABLE_SIZE 256
|
94
|
552 #define DISP_CHAR_ENTRY(dp, c) ((c < (dp)->size) ? (dp)->contents[c] : Qnil)
|
0
|
553
|
|
554 struct Lisp_Vector *get_display_table (struct window *, face_index);
|
|
555
|
|
556 #endif /* _XEMACS_GLYPHS_H_ */
|