1 /* Generic glyph data structures + display tables
2 Copyright (C) 1994 Board of Trustees, University of Illinois.
3 Copyright (C) 1995, 1996 Ben Wing
5 This file is part of XEmacs.
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
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
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. */
22 /* Synched up with: Not in FSF. */
24 #ifndef _XEMACS_GLYPHS_H_
25 #define _XEMACS_GLYPHS_H_
27 #include "specifier.h"
30 /************************************************************************/
31 /* Image Instantiators */
32 /************************************************************************/
34 struct image_instantiator_methods;
36 /* Remember the distinction between image instantiator formats and
37 image instance types. Here's an approximate mapping:
39 image instantiator format image instance type
40 ------------------------- -------------------
44 xbm mono-pixmap, color-pixmap, pointer
45 xpm color-pixmap, mono-pixmap, pointer
46 xface mono-pixmap, color-pixmap, pointer
53 mswindows-resource pointer
57 autodetect mono-pixmap, color-pixmap, pointer, text
65 /* These are methods specific to a particular format of image instantiator
66 (e.g. xpm, string, etc.). */
68 typedef struct ii_keyword_entry ii_keyword_entry;
69 struct ii_keyword_entry
72 void (*validate) (Lisp_Object data);
78 Dynarr_declare (ii_keyword_entry);
79 } ii_keyword_entry_dynarr;
81 struct image_instantiator_methods
85 Lisp_Object device; /* sometimes used */
87 ii_keyword_entry_dynarr *keywords;
88 /* Implementation specific methods: */
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);
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);
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);
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,
117 /* Property method: Given an image instance, return device specific
119 Lisp_Object (*property_method) (Lisp_Object image_instance,
120 Lisp_Object property);
121 /* Set-property method: Given an image instance, set device specific
123 Lisp_Object (*set_property_method) (Lisp_Object image_instance,
124 Lisp_Object property,
128 /***** Calling an image-instantiator method *****/
130 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0)
131 #define IIFORMAT_METH(mstruc, m, args) (((mstruc)->m##_method) args)
133 /* Call a void-returning specifier method, if it exists */
134 #define MAYBE_IIFORMAT_METH(mstruc, m, args) \
136 struct image_instantiator_methods *MIM_mstruc = (mstruc); \
137 if (MIM_mstruc && HAS_IIFORMAT_METH_P (MIM_mstruc, m)) \
138 IIFORMAT_METH (MIM_mstruc, m, args); \
141 #define MAYBE_IIFORMAT_DEVMETH(device, mstruc, m, args) \
143 struct image_instantiator_methods *MID_mstruc = \
144 decode_ii_device (device, mstruc); \
146 MAYBE_IIFORMAT_METH(MID_mstruc, m, args); \
150 /* Call a specifier method, if it exists; otherwise return
151 the specified value */
153 #define IIFORMAT_METH_OR_GIVEN(mstruc, m, args, given) \
154 (HAS_IIFORMAT_METH_P (mstruc, m) ? \
155 IIFORMAT_METH (mstruc, m, args) : (given))
157 /***** Defining new image-instantiator types *****/
159 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \
160 extern struct image_instantiator_methods *format##_image_instantiator_methods
162 #define DEFINE_IMAGE_INSTANTIATOR_FORMAT(format) \
163 struct image_instantiator_methods *format##_image_instantiator_methods
165 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name) \
167 format##_image_instantiator_methods = \
168 xnew_and_zero (struct image_instantiator_methods); \
169 format##_image_instantiator_methods->symbol = Q##format; \
170 format##_image_instantiator_methods->device = Qnil; \
171 format##_image_instantiator_methods->keywords = \
172 Dynarr_new (ii_keyword_entry); \
173 add_entry_to_image_instantiator_format_list \
174 (Q##format, format##_image_instantiator_methods); \
177 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \
179 defsymbol (&Q##format, obj_name); \
180 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name); \
183 /* Declare that image-instantiator format FORMAT has method M; used in
184 initialization routines */
185 #define IIFORMAT_HAS_METHOD(format, m) \
186 (format##_image_instantiator_methods->m##_method = format##_##m)
188 #define IIFORMAT_HAS_SHARED_METHOD(format, m, type) \
189 (format##_image_instantiator_methods->m##_method = type##_##m)
191 /* Declare that KEYW is a valid keyword for image-instantiator format
192 FORMAT. VALIDATE_FUN if a function that returns whether the data
193 is valid. The keyword may not appear more than once. */
194 #define IIFORMAT_VALID_KEYWORD(format, keyw, validate_fun) \
196 struct ii_keyword_entry entry; \
198 entry.keyword = keyw; \
199 entry.validate = validate_fun; \
200 entry.multiple_p = 0; \
201 Dynarr_add (format##_image_instantiator_methods->keywords, \
205 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may
206 appear multiple times. */
207 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyword, validate_fun) \
209 struct ii_keyword_entry entry; \
211 entry.keyword = keyword; \
212 entry.validate = validate_fun; \
213 entry.multiple_p = 1; \
214 Dynarr_add (format##_image_instantiator_methods->keywords, \
218 #define DEFINE_DEVICE_IIFORMAT(type, format)\
219 struct image_instantiator_methods *type##_##format##_image_instantiator_methods
221 #define INITIALIZE_DEVICE_IIFORMAT(type, format) \
223 type##_##format##_image_instantiator_methods = \
224 xnew_and_zero (struct image_instantiator_methods); \
225 type##_##format##_image_instantiator_methods->symbol = Q##format; \
226 type##_##format##_image_instantiator_methods->device = Q##type; \
227 type##_##format##_image_instantiator_methods->keywords = \
228 Dynarr_new (ii_keyword_entry); \
229 add_entry_to_device_ii_format_list \
230 (Q##type, Q##format, type##_##format##_image_instantiator_methods); \
233 /* Declare that image-instantiator format FORMAT has method M; used in
234 initialization routines */
235 #define IIFORMAT_HAS_DEVMETHOD(type, format, m) \
236 (type##_##format##_image_instantiator_methods->m##_method = type##_##format##_##m)
238 struct image_instantiator_methods *
239 decode_device_ii_format (Lisp_Object device, Lisp_Object format,
240 Error_behavior errb);
241 struct image_instantiator_methods *
242 decode_image_instantiator_format (Lisp_Object format, Error_behavior errb);
244 void add_entry_to_image_instantiator_format_list (Lisp_Object symbol,
245 struct image_instantiator_methods *meths);
246 void add_entry_to_device_ii_format_list (Lisp_Object device, Lisp_Object symbol,
247 struct image_instantiator_methods *meths);
248 Lisp_Object find_keyword_in_vector (Lisp_Object vector,
249 Lisp_Object keyword);
250 Lisp_Object find_keyword_in_vector_or_given (Lisp_Object vector,
252 Lisp_Object default_);
253 Lisp_Object simple_image_type_normalize (Lisp_Object inst,
254 Lisp_Object console_type,
255 Lisp_Object image_type_tag);
256 Lisp_Object potential_pixmap_file_instantiator (Lisp_Object instantiator,
257 Lisp_Object file_keyword,
258 Lisp_Object data_keyword,
259 Lisp_Object console_type);
260 void check_valid_string (Lisp_Object data);
261 void check_valid_int (Lisp_Object data);
262 void check_valid_face (Lisp_Object data);
263 void check_valid_vector (Lisp_Object data);
265 void initialize_subwindow_image_instance (struct Lisp_Image_Instance*);
266 void subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
267 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
268 int dest_mask, Lisp_Object domain);
270 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator,
272 int desired_dest_mask));
273 DECLARE_DOESNT_RETURN (signal_image_error (CONST char *, Lisp_Object));
274 DECLARE_DOESNT_RETURN (signal_image_error_2 (CONST char *, Lisp_Object, Lisp_Object));
276 /************************************************************************/
277 /* Image Specifier Object */
278 /************************************************************************/
280 DECLARE_SPECIFIER_TYPE (image);
281 #define XIMAGE_SPECIFIER(x) XSPECIFIER_TYPE (x, image)
282 #define XSETIMAGE_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, image)
283 #define IMAGE_SPECIFIERP(x) SPECIFIER_TYPEP (x, image)
284 #define CHECK_IMAGE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, image)
285 #define CONCHECK_IMAGE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, image)
287 void set_image_attached_to (Lisp_Object obj, Lisp_Object face_or_glyph,
288 Lisp_Object property);
290 struct image_specifier
293 Lisp_Object attachee; /* face or glyph this is attached to, or nil */
294 Lisp_Object attachee_property;/* property of that face or glyph */
297 #define IMAGE_SPECIFIER_DATA(g) (SPECIFIER_TYPE_DATA (g, image))
298 #define IMAGE_SPECIFIER_ALLOWED(g) (IMAGE_SPECIFIER_DATA (g)->allowed)
299 #define IMAGE_SPECIFIER_ATTACHEE(g) (IMAGE_SPECIFIER_DATA (g)->attachee)
300 #define IMAGE_SPECIFIER_ATTACHEE_PROPERTY(g) \
301 (IMAGE_SPECIFIER_DATA (g)->attachee_property)
303 #define XIMAGE_SPECIFIER_ALLOWED(g) \
304 IMAGE_SPECIFIER_ALLOWED (XIMAGE_SPECIFIER (g))
306 /************************************************************************/
307 /* Image Instance Object */
308 /************************************************************************/
310 DECLARE_LRECORD (image_instance, struct Lisp_Image_Instance);
311 #define XIMAGE_INSTANCE(x) \
312 XRECORD (x, image_instance, struct Lisp_Image_Instance)
313 #define XSETIMAGE_INSTANCE(x, p) XSETRECORD (x, p, image_instance)
314 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance)
315 #define GC_IMAGE_INSTANCEP(x) GC_RECORDP (x, image_instance)
316 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance)
317 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance)
319 enum image_instance_type
331 #define IMAGE_NOTHING_MASK (1 << 0)
332 #define IMAGE_TEXT_MASK (1 << 1)
333 #define IMAGE_MONO_PIXMAP_MASK (1 << 2)
334 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3)
335 #define IMAGE_POINTER_MASK (1 << 4)
336 #define IMAGE_SUBWINDOW_MASK (1 << 5)
337 #define IMAGE_WIDGET_MASK (1 << 6)
339 #define IMAGE_INSTANCE_TYPE_P(ii, type) \
340 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type)
342 #define NOTHING_IMAGE_INSTANCEP(ii) \
343 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_NOTHING)
344 #define TEXT_IMAGE_INSTANCEP(ii) \
345 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_TEXT)
346 #define MONO_PIXMAP_IMAGE_INSTANCEP(ii) \
347 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_MONO_PIXMAP)
348 #define COLOR_PIXMAP_IMAGE_INSTANCEP(ii) \
349 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_COLOR_PIXMAP)
350 #define POINTER_IMAGE_INSTANCEP(ii) \
351 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER)
352 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \
353 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW)
354 #define WIDGET_IMAGE_INSTANCEP(ii) \
355 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_WIDGET)
357 #define CHECK_NOTHING_IMAGE_INSTANCE(x) do { \
358 CHECK_IMAGE_INSTANCE (x); \
359 if (!NOTHING_IMAGE_INSTANCEP (x)) \
360 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \
363 #define CHECK_TEXT_IMAGE_INSTANCE(x) do { \
364 CHECK_IMAGE_INSTANCE (x); \
365 if (!TEXT_IMAGE_INSTANCEP (x)) \
366 x = wrong_type_argument (Qtext_image_instance_p, (x)); \
369 #define CHECK_MONO_PIXMAP_IMAGE_INSTANCE(x) do { \
370 CHECK_IMAGE_INSTANCE (x); \
371 if (!MONO_PIXMAP_IMAGE_INSTANCEP (x)) \
372 x = wrong_type_argument (Qmono_pixmap_image_instance_p, (x)); \
375 #define CHECK_COLOR_PIXMAP_IMAGE_INSTANCE(x) do { \
376 CHECK_IMAGE_INSTANCE (x); \
377 if (!COLOR_PIXMAP_IMAGE_INSTANCEP (x)) \
378 x = wrong_type_argument (Qcolor_pixmap_image_instance_p, (x)); \
381 #define CHECK_POINTER_IMAGE_INSTANCE(x) do { \
382 CHECK_IMAGE_INSTANCE (x); \
383 if (!POINTER_IMAGE_INSTANCEP (x)) \
384 x = wrong_type_argument (Qpointer_image_instance_p, (x)); \
387 #define CHECK_SUBWINDOW_IMAGE_INSTANCE(x) do { \
388 CHECK_IMAGE_INSTANCE (x); \
389 if (!SUBWINDOW_IMAGE_INSTANCEP (x) \
390 && !WIDGET_IMAGE_INSTANCEP (x)) \
391 x = wrong_type_argument (Qsubwindow_image_instance_p, (x)); \
394 #define CHECK_WIDGET_IMAGE_INSTANCE(x) do { \
395 CHECK_IMAGE_INSTANCE (x); \
396 if (!WIDGET_IMAGE_INSTANCEP (x)) \
397 x = wrong_type_argument (Qwidget_image_instance_p, (x)); \
400 struct Lisp_Image_Instance
402 struct lcrecord_header header;
405 enum image_instance_type type;
414 int width, height, depth;
415 Lisp_Object hotspot_x, hotspot_y; /* integer or Qnil */
416 Lisp_Object filename; /* string or Qnil */
417 Lisp_Object mask_filename; /* string or Qnil */
418 Lisp_Object fg, bg; /* foreground and background colors,
419 if this is a colorized mono-pixmap
421 Lisp_Object auxdata; /* list or Qnil: any additional data
422 to be seen from lisp */
423 } pixmap; /* used for pointers as well */
427 unsigned int width, height;
428 void* subwindow; /* specific devices can use this as necessary */
429 int being_displayed; /* used to detect when needs to be unmapped */
432 Lisp_Object face; /* foreground and background colors */
434 Lisp_Object props; /* properties */
435 struct gui_item gui_item;
436 } widget; /* widgets are subwindows */
440 /* console-type- and image-type-specific data */
444 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device)
445 #define IMAGE_INSTANCE_NAME(i) ((i)->name)
446 #define IMAGE_INSTANCE_TYPE(i) ((i)->type)
447 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \
448 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \
449 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP))
451 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string)
453 #define IMAGE_INSTANCE_PIXMAP_WIDTH(i) ((i)->u.pixmap.width)
454 #define IMAGE_INSTANCE_PIXMAP_HEIGHT(i) ((i)->u.pixmap.height)
455 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth)
456 #define IMAGE_INSTANCE_PIXMAP_FILENAME(i) ((i)->u.pixmap.filename)
457 #define IMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) ((i)->u.pixmap.mask_filename)
458 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) ((i)->u.pixmap.hotspot_x)
459 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) ((i)->u.pixmap.hotspot_y)
460 #define IMAGE_INSTANCE_PIXMAP_FG(i) ((i)->u.pixmap.fg)
461 #define IMAGE_INSTANCE_PIXMAP_BG(i) ((i)->u.pixmap.bg)
462 #define IMAGE_INSTANCE_PIXMAP_AUXDATA(i) ((i)->u.pixmap.auxdata)
464 #define IMAGE_INSTANCE_SUBWINDOW_WIDTH(i) ((i)->u.subwindow.width)
465 #define IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) ((i)->u.subwindow.height)
466 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow)
467 #define IMAGE_INSTANCE_SUBWINDOW_FRAME(i) ((i)->u.subwindow.frame)
468 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \
469 ((i)->u.subwindow.being_displayed)
471 #define IMAGE_INSTANCE_WIDGET_WIDTH(i) \
472 IMAGE_INSTANCE_SUBWINDOW_WIDTH(i)
473 #define IMAGE_INSTANCE_WIDGET_HEIGHT(i) \
474 IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i)
475 #define IMAGE_INSTANCE_WIDGET_CALLBACK(i) \
476 ((i)->u.subwindow.widget.gui_item.callback)
477 #define IMAGE_INSTANCE_WIDGET_TYPE(i) ((i)->u.subwindow.widget.type)
478 #define IMAGE_INSTANCE_WIDGET_PROPS(i) ((i)->u.subwindow.widget.props)
479 #define IMAGE_INSTANCE_WIDGET_FACE(i) ((i)->u.subwindow.widget.face)
480 #define IMAGE_INSTANCE_WIDGET_TEXT(i) ((i)->u.subwindow.widget.gui_item.name)
481 #define IMAGE_INSTANCE_WIDGET_ITEM(i) ((i)->u.subwindow.widget.gui_item)
483 #define XIMAGE_INSTANCE_DEVICE(i) \
484 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i))
485 #define XIMAGE_INSTANCE_NAME(i) \
486 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i))
487 #define XIMAGE_INSTANCE_TYPE(i) \
488 IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (i))
490 #define XIMAGE_INSTANCE_TEXT_STRING(i) \
491 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i))
493 #define XIMAGE_INSTANCE_PIXMAP_WIDTH(i) \
494 IMAGE_INSTANCE_PIXMAP_WIDTH (XIMAGE_INSTANCE (i))
495 #define XIMAGE_INSTANCE_PIXMAP_HEIGHT(i) \
496 IMAGE_INSTANCE_PIXMAP_HEIGHT (XIMAGE_INSTANCE (i))
497 #define XIMAGE_INSTANCE_PIXMAP_DEPTH(i) \
498 IMAGE_INSTANCE_PIXMAP_DEPTH (XIMAGE_INSTANCE (i))
499 #define XIMAGE_INSTANCE_PIXMAP_FILENAME(i) \
500 IMAGE_INSTANCE_PIXMAP_FILENAME (XIMAGE_INSTANCE (i))
501 #define XIMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) \
502 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (XIMAGE_INSTANCE (i))
503 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) \
504 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (XIMAGE_INSTANCE (i))
505 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) \
506 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (XIMAGE_INSTANCE (i))
507 #define XIMAGE_INSTANCE_PIXMAP_FG(i) \
508 IMAGE_INSTANCE_PIXMAP_FG (XIMAGE_INSTANCE (i))
509 #define XIMAGE_INSTANCE_PIXMAP_BG(i) \
510 IMAGE_INSTANCE_PIXMAP_BG (XIMAGE_INSTANCE (i))
512 #define XIMAGE_INSTANCE_WIDGET_WIDTH(i) \
513 IMAGE_INSTANCE_WIDGET_WIDTH (XIMAGE_INSTANCE (i))
514 #define XIMAGE_INSTANCE_WIDGET_HEIGHT(i) \
515 IMAGE_INSTANCE_WIDGET_HEIGHT (XIMAGE_INSTANCE (i))
516 #define XIMAGE_INSTANCE_WIDGET_CALLBACK(i) \
517 IMAGE_INSTANCE_WIDGET_CALLBACK (XIMAGE_INSTANCE (i))
518 #define XIMAGE_INSTANCE_WIDGET_TYPE(i) \
519 IMAGE_INSTANCE_WIDGET_TYPE (XIMAGE_INSTANCE (i))
520 #define XIMAGE_INSTANCE_WIDGET_PROPS(i) \
521 IMAGE_INSTANCE_WIDGET_PROPS (XIMAGE_INSTANCE (i))
522 #define XIMAGE_INSTANCE_WIDGET_FACE(i) \
523 IMAGE_INSTANCE_WIDGET_FACE (XIMAGE_INSTANCE (i))
524 #define XIMAGE_INSTANCE_WIDGET_TEXT(i) \
525 IMAGE_INSTANCE_WIDGET_TEXT (XIMAGE_INSTANCE (i))
526 #define XIMAGE_INSTANCE_WIDGET_ITEM(i) \
527 IMAGE_INSTANCE_WIDGET_ITEM (XIMAGE_INSTANCE (i))
529 #define XIMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \
530 IMAGE_INSTANCE_SUBWINDOW_WIDTH (XIMAGE_INSTANCE (i))
531 #define XIMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \
532 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (XIMAGE_INSTANCE (i))
533 #define XIMAGE_INSTANCE_SUBWINDOW_ID(i) \
534 IMAGE_INSTANCE_SUBWINDOW_ID (XIMAGE_INSTANCE (i))
535 #define XIMAGE_INSTANCE_SUBWINDOW_FRAME(i) \
536 IMAGE_INSTANCE_SUBWINDOW_FRAME (XIMAGE_INSTANCE (i))
537 #define XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \
538 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (XIMAGE_INSTANCE (i))
541 Lisp_Object evaluate_xpm_color_symbols (void);
542 Lisp_Object pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid);
543 #endif /* HAVE_XPM */
544 #ifdef HAVE_WINDOW_SYSTEM
545 Lisp_Object bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot,
546 int ok_if_data_invalid);
547 int read_bitmap_data_from_file (CONST char *filename, unsigned int *width,
548 unsigned int *height, unsigned char **datap,
549 int *x_hot, int *y_hot);
550 Lisp_Object xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file,
551 Lisp_Object mask_file,
552 Lisp_Object console_type);
555 /************************************************************************/
557 /************************************************************************/
569 struct lcrecord_header header;
571 enum glyph_type type;
574 Lisp_Object image; /* the actual image */
575 Lisp_Object contrib_p; /* whether to figure into line height */
576 Lisp_Object baseline; /* percent above baseline */
578 Lisp_Object face; /* if non-nil, face to use when displaying */
581 void (*after_change) (Lisp_Object glyph, Lisp_Object property,
585 DECLARE_LRECORD (glyph, struct Lisp_Glyph);
586 #define XGLYPH(x) XRECORD (x, glyph, struct Lisp_Glyph)
587 #define XSETGLYPH(x, p) XSETRECORD (x, p, glyph)
588 #define GLYPHP(x) RECORDP (x, glyph)
589 #define GC_GLYPHP(x) GC_RECORDP (x, glyph)
590 #define CHECK_GLYPH(x) CHECK_RECORD (x, glyph)
591 #define CONCHECK_GLYPH(x) CONCHECK_RECORD (x, glyph)
593 #define CHECK_BUFFER_GLYPH(x) do { \
595 if (XGLYPH (x)->type != GLYPH_BUFFER) \
596 x = wrong_type_argument (Qbuffer_glyph_p, (x)); \
599 #define CHECK_POINTER_GLYPH(x) do { \
601 if (XGLYPH (x)->type != GLYPH_POINTER) \
602 x = wrong_type_argument (Qpointer_glyph_p, (x)); \
605 #define CHECK_ICON_GLYPH(x) do { \
607 if (XGLYPH (x)->type != GLYPH_ICON) \
608 x = wrong_type_argument (Qicon_glyph_p, (x)); \
611 #define GLYPH_TYPE(g) ((g)->type)
612 #define GLYPH_IMAGE(g) ((g)->image)
613 #define GLYPH_CONTRIB_P(g) ((g)->contrib_p)
614 #define GLYPH_BASELINE(g) ((g)->baseline)
615 #define GLYPH_FACE(g) ((g)->face)
617 #define XGLYPH_TYPE(g) GLYPH_TYPE (XGLYPH (g))
618 #define XGLYPH_IMAGE(g) GLYPH_IMAGE (XGLYPH (g))
619 #define XGLYPH_CONTRIB_P(g) GLYPH_CONTRIB_P (XGLYPH (g))
620 #define XGLYPH_BASELINE(g) GLYPH_BASELINE (XGLYPH (g))
621 #define XGLYPH_FACE(g) GLYPH_FACE (XGLYPH (g))
623 extern Lisp_Object Qxpm, Qxface;
624 extern Lisp_Object Q_data, Q_file, Q_color_symbols, Qconst_glyph_variable;
625 extern Lisp_Object Qxbm, Qedit, Qgroup, Qlabel, Qcombo, Qscrollbar, Qprogress;
626 extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y;
627 extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group;
628 extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text;
629 extern Lisp_Object Q_items, Q_properties, Q_image, Q_percent, Qimage_conversion_error;
630 extern Lisp_Object Vcontinuation_glyph, Vcontrol_arrow_glyph, Vhscroll_glyph;
631 extern Lisp_Object Vinvisible_text_glyph, Voctal_escape_glyph, Vtruncation_glyph;
632 extern Lisp_Object Vxemacs_logo;
634 unsigned short glyph_width (Lisp_Object glyph, Lisp_Object frame_face,
635 face_index window_findex,
637 unsigned short glyph_ascent (Lisp_Object glyph, Lisp_Object frame_face,
638 face_index window_findex,
640 unsigned short glyph_descent (Lisp_Object glyph,
641 Lisp_Object frame_face,
642 face_index window_findex,
644 unsigned short glyph_height (Lisp_Object glyph, Lisp_Object frame_face,
645 face_index window_findex,
647 Lisp_Object glyph_baseline (Lisp_Object glyph, Lisp_Object domain);
648 Lisp_Object glyph_face (Lisp_Object glyph, Lisp_Object domain);
649 int glyph_contrib_p (Lisp_Object glyph, Lisp_Object domain);
650 Lisp_Object glyph_image_instance (Lisp_Object glyph,
652 Error_behavior errb, int no_quit);
653 void file_or_data_must_be_present (Lisp_Object instantiator);
654 void data_must_be_present (Lisp_Object instantiator);
655 Lisp_Object make_string_from_file (Lisp_Object file);
656 Lisp_Object tagged_vector_to_alist (Lisp_Object vector);
657 Lisp_Object alist_to_tagged_vector (Lisp_Object tag, Lisp_Object alist);
658 void string_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
659 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
660 int dest_mask, Lisp_Object domain);
661 Lisp_Object allocate_glyph (enum glyph_type type,
662 void (*after_change) (Lisp_Object glyph,
663 Lisp_Object property,
664 Lisp_Object locale));
665 Lisp_Object widget_face_font_info (Lisp_Object domain, Lisp_Object face,
666 int *height, int *width);
667 void widget_text_to_pixel_conversion (Lisp_Object domain, Lisp_Object face,
669 int* height, int* width);
671 /************************************************************************/
673 /************************************************************************/
675 typedef struct glyph_cachel glyph_cachel;
680 unsigned int updated :1;
681 unsigned short width;
682 unsigned short ascent;
683 unsigned short descent;
686 #define CONT_GLYPH_INDEX (glyph_index) 0
687 #define TRUN_GLYPH_INDEX (glyph_index) 1
688 #define HSCROLL_GLYPH_INDEX (glyph_index) 2
689 #define CONTROL_GLYPH_INDEX (glyph_index) 3
690 #define OCT_ESC_GLYPH_INDEX (glyph_index) 4
691 #define INVIS_GLYPH_INDEX (glyph_index) 5
693 #define GLYPH_CACHEL(window, index) \
694 Dynarr_atp (window->glyph_cachels, index)
695 #define GLYPH_CACHEL_GLYPH(window, index) \
696 Dynarr_atp (window->glyph_cachels, index)->glyph
697 #define GLYPH_CACHEL_WIDTH(window, index) \
698 Dynarr_atp (window->glyph_cachels, index)->width
699 #define GLYPH_CACHEL_ASCENT(window, index) \
700 Dynarr_atp (window->glyph_cachels, index)->ascent
701 #define GLYPH_CACHEL_DESCENT(window, index) \
702 Dynarr_atp (window->glyph_cachels, index)->descent
704 void mark_glyph_cachels (glyph_cachel_dynarr *elements,
705 void (*markobj) (Lisp_Object));
706 void mark_glyph_cachels_as_not_updated (struct window *w);
707 void reset_glyph_cachels (struct window *w);
709 #ifdef MEMORY_USAGE_STATS
710 int compute_glyph_cachel_usage (glyph_cachel_dynarr *glyph_cachels,
711 struct overhead_stats *ovstats);
712 #endif /* MEMORY_USAGE_STATS */
714 /************************************************************************/
716 /************************************************************************/
718 Lisp_Object display_table_entry (Emchar, Lisp_Object, Lisp_Object);
719 void get_display_tables (struct window *, face_index,
720 Lisp_Object *, Lisp_Object *);
722 /****************************************************************************
724 ****************************************************************************/
726 /* redisplay needs a per-frame cache of subwindows being displayed so
727 * that we known when to unmap them */
728 typedef struct subwindow_cachel subwindow_cachel;
729 struct subwindow_cachel
731 Lisp_Object subwindow;
740 Dynarr_declare (subwindow_cachel);
741 } subwindow_cachel_dynarr;
743 void mark_subwindow_cachels (subwindow_cachel_dynarr *elements,
744 void (*markobj) (Lisp_Object));
745 void mark_subwindow_cachels_as_not_updated (struct frame *f);
746 void reset_subwindow_cachels (struct frame *f);
747 void unmap_subwindow (Lisp_Object subwindow);
748 void map_subwindow (Lisp_Object subwindow, int x, int y);
749 void update_frame_subwindows (struct frame *f);
751 #endif /* _XEMACS_GLYPHS_H_ */