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