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