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