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