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