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 SXEmacs
7 SXEmacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 SXEmacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 /* Synched up with: Not in FSF. */
23 #ifndef INCLUDED_glyphs_h_
24 #define INCLUDED_glyphs_h_
26 #include "specifier.h"
29 /************************************************************************/
30 /* Image Instantiators */
31 /************************************************************************/
33 struct image_instantiator_methods;
35 /* Remember the distinction between image instantiator formats and
36 image instance types. Here's an approximate mapping:
38 image instantiator format image instance type
39 ------------------------- -------------------
43 xbm mono-pixmap, color-pixmap, pointer
44 xpm color-pixmap, mono-pixmap, pointer
45 xface mono-pixmap, color-pixmap, pointer
52 mswindows-resource pointer, color-pixmap
56 autodetect mono-pixmap, color-pixmap, pointer, text
69 /* These are methods specific to a particular format of image instantiator
70 (e.g. xpm, string, etc.). */
72 typedef struct ii_keyword_entry ii_keyword_entry;
73 struct ii_keyword_entry {
75 void (*validate) (Lisp_Object data);
81 Dynarr_declare(ii_keyword_entry);
82 } ii_keyword_entry_dynarr;
84 extern const struct struct_description iim_description;
86 enum image_instance_geometry {
88 IMAGE_DESIRED_GEOMETRY,
93 #define IMAGE_UNSPECIFIED_GEOMETRY -1
94 #define IMAGE_UNCHANGED_GEOMETRY -2
96 #define DEFAULT_WIDGET_BORDER_WIDTH 2
97 #define DEFAULT_WIDGET_SPACING 3
98 #define DEFAULT_WIDGET_SHADOW_WIDTH 2
100 enum governing_domain {
101 GOVERNING_DOMAIN_WINDOW,
102 GOVERNING_DOMAIN_FRAME,
103 GOVERNING_DOMAIN_DEVICE
106 struct image_instantiator_methods {
109 Lisp_Object device; /* sometimes used */
111 ii_keyword_entry_dynarr *keywords;
112 /* consoles this ii is supported on */
113 console_type_entry_dynarr *consoles;
114 /* Implementation specific methods: */
116 /* Validate method: Given an instantiator vector, signal an error if
117 it's invalid for this image-instantiator format. Note that this
118 validation only occurs after all the keyword-specific validation
119 has already been performed. This is chiefly useful for making
120 sure that certain required keywords are present. */
121 void (*validate_method) (Lisp_Object instantiator);
123 /* Normalize method: Given an instantiator, convert it to the form
124 that should be used in a glyph, for devices of type CONSOLE_TYPE.
125 Signal an error if conversion fails. */
126 Lisp_Object(*normalize_method) (Lisp_Object instantiator,
127 Lisp_Object console_type,
128 Lisp_Object dest_mask);
130 /* Governing domain method: Return an int indicating what type of
131 domain an instance in this format is governed by. */
132 int (*governing_domain_method) (void);
134 /* Possible-dest-types method: Return a mask indicating what dest types
135 are compatible with this format. */
136 int (*possible_dest_types_method) (void);
138 /* Instantiate method: Given an instantiator and a partially
139 filled-in image instance, complete the filling-in. Return
140 non-zero if the instantiation succeeds, 0 if it fails.
141 This must be present. */
142 void (*instantiate_method) (Lisp_Object image_instance,
143 Lisp_Object instantiator,
144 Lisp_Object pointer_fg,
145 Lisp_Object pointer_bg,
146 int dest_mask, Lisp_Object domain);
147 /* Post instantiate method: finish instantiation of the image
149 void (*post_instantiate_method) (Lisp_Object image_instance,
150 Lisp_Object instantiator,
152 /* Property method: Given an image instance, return device specific
154 Lisp_Object(*property_method) (Lisp_Object image_instance,
155 Lisp_Object property);
156 /* Set-property method: Given an image instance, set device specific
158 Lisp_Object(*set_property_method) (Lisp_Object image_instance,
159 Lisp_Object property,
161 /* Asynchronously update properties. */
162 void (*update_method) (Lisp_Object image_instance,
163 Lisp_Object instantiator);
164 void (*redisplay_method) (Lisp_Object image_instance);
166 /* Find out the desired geometry, as given by disp, of this image
167 instance. Actual geometry is stored in the appropriate slots in the
169 void (*query_geometry_method) (Lisp_Object image_instance,
170 int *width, int *height,
171 enum image_instance_geometry disp,
174 /* Layout the instance and its children bounded by the provided
175 dimensions. Returns success or failure. */
176 int (*layout_method) (Lisp_Object image_instance,
177 int width, int height, int xoffset, int yoffset,
181 /***** Calling an image-instantiator method *****/
183 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0)
184 #define IIFORMAT_METH(mstruc, m, args) (((mstruc)->m##_method) args)
186 /* Call a void-returning specifier method, if it exists */
187 #define MAYBE_IIFORMAT_METH(mstruc, m, args) \
189 struct image_instantiator_methods *MIM_mstruc = (mstruc); \
190 if (MIM_mstruc && HAS_IIFORMAT_METH_P (MIM_mstruc, m)) \
191 IIFORMAT_METH (MIM_mstruc, m, args); \
194 #define MAYBE_IIFORMAT_DEVMETH(device, mstruc, m, args) \
196 struct image_instantiator_methods *MID_mstruc = \
197 decode_ii_device (device, mstruc); \
199 MAYBE_IIFORMAT_METH(MID_mstruc, m, args); \
202 /* Call a specifier method, if it exists; otherwise return
203 the specified value */
205 #define IIFORMAT_METH_OR_GIVEN(mstruc, m, args, given) \
206 ((mstruc && HAS_IIFORMAT_METH_P (mstruc, m)) ? \
207 IIFORMAT_METH (mstruc, m, args) : (given))
209 /***** Defining new image-instantiator types *****/
211 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \
212 extern struct image_instantiator_methods *format##_image_instantiator_methods
214 #define DEFINE_IMAGE_INSTANTIATOR_FORMAT(format) \
215 struct image_instantiator_methods *format##_image_instantiator_methods
217 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name) \
219 format##_image_instantiator_methods = \
220 xnew_and_zero (struct image_instantiator_methods); \
221 format##_image_instantiator_methods->symbol = Q##format; \
222 format##_image_instantiator_methods->device = Qnil; \
223 format##_image_instantiator_methods->keywords = \
224 Dynarr_new (ii_keyword_entry); \
225 format##_image_instantiator_methods->consoles = \
226 Dynarr_new (console_type_entry); \
227 add_entry_to_image_instantiator_format_list \
228 (Q##format, format##_image_instantiator_methods); \
229 dump_add_root_struct_ptr (&format##_image_instantiator_methods, \
233 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \
235 defsymbol (&Q##format, obj_name); \
236 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name);\
239 /* Declare that image-instantiator format FORMAT has method M; used in
240 initialization routines */
241 #define IIFORMAT_HAS_METHOD(format, m) \
242 (format##_image_instantiator_methods->m##_method = format##_##m)
244 #define IIFORMAT_HAS_SHARED_METHOD(format, m, type) \
245 (format##_image_instantiator_methods->m##_method = type##_##m)
247 /* Declare that KEYW is a valid keyword for image-instantiator format
248 FORMAT. VALIDATE_FUN if a function that returns whether the data
249 is valid. The keyword may not appear more than once. */
250 #define IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, copy, multi) \
252 struct ii_keyword_entry entry; \
254 entry.keyword = keyw; \
255 entry.validate = validate_fun; \
256 entry.multiple_p = multi; \
257 entry.copy_p = copy; \
258 Dynarr_add (format##_image_instantiator_methods->keywords, \
262 #define IIFORMAT_VALID_KEYWORD(format, keyw, validate_fun) \
263 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 1, 0)
265 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may
266 appear multiple times. */
267 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyw, validate_fun) \
268 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 1, 1)
270 /* Same as IIFORMAT_VALID_KEYWORD except that the argument is not
271 copied by the specifier functions. This is necessary for things
272 like callbacks etc. */
273 #define IIFORMAT_VALID_NONCOPY_KEYWORD(format, keyw, validate_fun) \
274 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 0, 0)
276 /* Declare that image-instantiator format FORMAT is supported on
278 #define IIFORMAT_VALID_CONSOLE(console, format) \
280 struct console_type_entry entry; \
282 entry.symbol = Q##console; \
283 entry.meths = console##_console_methods; \
284 Dynarr_add (format##_image_instantiator_methods->consoles, \
288 #define IIFORMAT_VALID_CONSOLE2(con1, con2, format) \
289 IIFORMAT_VALID_CONSOLE (con1, format); \
290 IIFORMAT_VALID_CONSOLE (con2, format);
292 #define DEFINE_DEVICE_IIFORMAT(type, format) \
293 DECLARE_IMAGE_INSTANTIATOR_FORMAT(format); \
294 struct image_instantiator_methods *type##_##format##_image_instantiator_methods
296 #define INITIALIZE_DEVICE_IIFORMAT(type, format) \
298 type##_##format##_image_instantiator_methods = \
299 xnew_and_zero (struct image_instantiator_methods); \
300 type##_##format##_image_instantiator_methods->symbol = Q##format; \
301 type##_##format##_image_instantiator_methods->device = Q##type; \
302 type##_##format##_image_instantiator_methods->keywords = \
303 Dynarr_new (ii_keyword_entry); \
304 add_entry_to_device_ii_format_list \
305 (Q##type, Q##format, type##_##format##_image_instantiator_methods); \
306 IIFORMAT_VALID_CONSOLE(type,format); \
307 dump_add_root_struct_ptr (&type##_##format##_image_instantiator_methods, \
311 /* Declare that image-instantiator format FORMAT has method M; used in
312 initialization routines */
313 #define IIFORMAT_HAS_DEVMETHOD(type, format, m) \
314 (type##_##format##_image_instantiator_methods->m##_method = type##_##format##_##m)
315 #define IIFORMAT_HAS_SHARED_DEVMETHOD(type, format, m, fromformat) \
316 (type##_##format##_image_instantiator_methods->m##_method = type##_##fromformat##_##m)
318 #define IIFORMAT_INHERITS_DEVMETHOD(type, from, format, m) \
319 (type##_##format##_image_instantiator_methods->m##_method = from##_##format##_##m)
320 #define IIFORMAT_INHERITS_SHARED_DEVMETHOD(type, from, format, m, fromformat) \
321 (type##_##format##_image_instantiator_methods->m##_method = from##_##fromformat##_##m)
323 #define INSTANTIATOR_TYPE(inst) (XVECTOR_DATA ((inst))[0])
325 struct image_instantiator_methods *decode_device_ii_format(Lisp_Object device,
327 Error_behavior errb);
328 struct image_instantiator_methods *decode_image_instantiator_format(Lisp_Object
333 void add_entry_to_image_instantiator_format_list(Lisp_Object symbol,
335 image_instantiator_methods
337 void add_entry_to_device_ii_format_list(Lisp_Object device, Lisp_Object symbol,
338 struct image_instantiator_methods
340 Lisp_Object find_keyword_in_vector(Lisp_Object vector, Lisp_Object keyword);
341 Lisp_Object find_keyword_in_vector_or_given(Lisp_Object vector,
343 Lisp_Object default_);
344 Lisp_Object simple_image_type_normalize(Lisp_Object inst,
345 Lisp_Object console_type,
346 Lisp_Object image_type_tag);
347 Lisp_Object potential_pixmap_file_instantiator(Lisp_Object instantiator,
348 Lisp_Object file_keyword,
349 Lisp_Object data_keyword,
350 Lisp_Object console_type);
351 void check_valid_string(Lisp_Object data);
352 void check_valid_int(Lisp_Object data);
353 void check_valid_face(Lisp_Object data);
354 void check_valid_vector(Lisp_Object data);
355 void check_valid_item_list(Lisp_Object items);
357 void initialize_subwindow_image_instance(Lisp_Image_Instance *);
358 void subwindow_instantiate(Lisp_Object image_instance, Lisp_Object instantiator,
359 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
360 int dest_mask, Lisp_Object domain);
361 int subwindow_governing_domain(void);
362 void widget_instantiate(Lisp_Object image_instance, Lisp_Object instantiator,
363 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
364 int dest_mask, Lisp_Object domain);
365 void image_instance_query_geometry(Lisp_Object image_instance,
366 int *width, int *height,
367 enum image_instance_geometry disp,
369 void image_instance_layout(Lisp_Object image_instance,
370 int width, int height, int xoffset, int yoffset,
372 int layout_layout(Lisp_Object image_instance,
373 int width, int height, int xoffset, int yoffset,
375 int invalidate_glyph_geometry_maybe(Lisp_Object glyph_or_ii, struct window *w);
376 Lisp_Object make_image_instance_cache_hash_table(void);
378 DECLARE_DOESNT_RETURN(incompatible_image_types(Lisp_Object instantiator,
380 int desired_dest_mask));
381 DECLARE_DOESNT_RETURN(signal_image_error(const char *, Lisp_Object));
382 DECLARE_DOESNT_RETURN(signal_image_error_2
383 (const char *, Lisp_Object, Lisp_Object));
385 /************************************************************************/
386 /* Image Specifier Object */
387 /************************************************************************/
389 DECLARE_SPECIFIER_TYPE(image);
390 #define XIMAGE_SPECIFIER(x) XSPECIFIER_TYPE (x, image)
391 #define XSETIMAGE_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, image)
392 #define IMAGE_SPECIFIERP(x) SPECIFIER_TYPEP (x, image)
393 #define CHECK_IMAGE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, image)
394 #define CONCHECK_IMAGE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, image)
396 void set_image_attached_to(Lisp_Object obj, Lisp_Object face_or_glyph,
397 Lisp_Object property);
399 struct image_specifier {
401 Lisp_Object attachee; /* face or glyph this is attached to, or nil */
402 Lisp_Object attachee_property; /* property of that face or glyph */
405 #define IMAGE_SPECIFIER_DATA(g) SPECIFIER_TYPE_DATA (g, image)
406 #define IMAGE_SPECIFIER_ALLOWED(g) (IMAGE_SPECIFIER_DATA (g)->allowed)
407 #define IMAGE_SPECIFIER_ATTACHEE(g) (IMAGE_SPECIFIER_DATA (g)->attachee)
408 #define IMAGE_SPECIFIER_ATTACHEE_PROPERTY(g) \
409 (IMAGE_SPECIFIER_DATA (g)->attachee_property)
411 #define XIMAGE_SPECIFIER_ALLOWED(g) \
412 IMAGE_SPECIFIER_ALLOWED (XIMAGE_SPECIFIER (g))
414 /************************************************************************/
415 /* Image Instance Object */
416 /************************************************************************/
418 DECLARE_LRECORD(image_instance, Lisp_Image_Instance);
419 #define XIMAGE_INSTANCE(x) XRECORD (x, image_instance, Lisp_Image_Instance)
420 #define XSETIMAGE_INSTANCE(x, p) XSETRECORD (x, p, image_instance)
421 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance)
422 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance)
423 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance)
425 #ifdef ERROR_CHECK_GLYPHS
426 void check_image_instance_structure(Lisp_Object instance);
427 void check_window_subwindow_cache(struct window *w);
428 #define ERROR_CHECK_IMAGE_INSTANCE(ii) \
429 check_image_instance_structure (ii)
430 #define ERROR_CHECK_SUBWINDOW_CACHE(w) \
431 check_window_subwindow_cache (w)
433 #define ERROR_CHECK_IMAGE_INSTANCE(ii)
434 #define ERROR_CHECK_SUBWINDOW_CACHE(w)
437 enum image_instance_type {
448 #define IMAGE_NOTHING_MASK (1 << 0)
449 #define IMAGE_TEXT_MASK (1 << 1)
450 #define IMAGE_MONO_PIXMAP_MASK (1 << 2)
451 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3)
452 #define IMAGE_POINTER_MASK (1 << 4)
453 #define IMAGE_SUBWINDOW_MASK (1 << 5)
454 #define IMAGE_WIDGET_MASK (1 << 6)
456 /* This depends on the fact that enums are assigned consecutive
457 integers starting at 0. (Remember that IMAGE_UNKNOWN is the
458 first enum.) I'm fairly sure this behavior is ANSI-mandated,
459 so there should be no portability problems here. */
460 #define image_instance_type_to_mask(type) \
461 ((int) (1 << ((int) (type) - 1)))
463 #define IMAGE_INSTANCE_TYPE_P(ii, type) \
464 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type)
466 #define NOTHING_IMAGE_INSTANCEP(ii) \
467 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_NOTHING)
468 #define TEXT_IMAGE_INSTANCEP(ii) \
469 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_TEXT)
470 #define MONO_PIXMAP_IMAGE_INSTANCEP(ii) \
471 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_MONO_PIXMAP)
472 #define COLOR_PIXMAP_IMAGE_INSTANCEP(ii) \
473 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_COLOR_PIXMAP)
474 #define POINTER_IMAGE_INSTANCEP(ii) \
475 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER)
476 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \
477 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW)
478 #define WIDGET_IMAGE_INSTANCEP(ii) \
479 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_WIDGET)
481 #define CHECK_NOTHING_IMAGE_INSTANCE(x) do { \
482 CHECK_IMAGE_INSTANCE (x); \
483 if (!NOTHING_IMAGE_INSTANCEP (x)) \
484 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \
487 #define CHECK_TEXT_IMAGE_INSTANCE(x) do { \
488 CHECK_IMAGE_INSTANCE (x); \
489 if (!TEXT_IMAGE_INSTANCEP (x)) \
490 x = wrong_type_argument (Qtext_image_instance_p, (x)); \
493 #define CHECK_MONO_PIXMAP_IMAGE_INSTANCE(x) do { \
494 CHECK_IMAGE_INSTANCE (x); \
495 if (!MONO_PIXMAP_IMAGE_INSTANCEP (x)) \
496 x = wrong_type_argument (Qmono_pixmap_image_instance_p, (x)); \
499 #define CHECK_COLOR_PIXMAP_IMAGE_INSTANCE(x) do { \
500 CHECK_IMAGE_INSTANCE (x); \
501 if (!COLOR_PIXMAP_IMAGE_INSTANCEP (x)) \
502 x = wrong_type_argument (Qcolor_pixmap_image_instance_p, (x)); \
505 #define CHECK_POINTER_IMAGE_INSTANCE(x) do { \
506 CHECK_IMAGE_INSTANCE (x); \
507 if (!POINTER_IMAGE_INSTANCEP (x)) \
508 x = wrong_type_argument (Qpointer_image_instance_p, (x)); \
511 #define CHECK_SUBWINDOW_IMAGE_INSTANCE(x) do { \
512 CHECK_IMAGE_INSTANCE (x); \
513 if (!SUBWINDOW_IMAGE_INSTANCEP (x) \
514 && !WIDGET_IMAGE_INSTANCEP (x)) \
515 x = wrong_type_argument (Qsubwindow_image_instance_p, (x)); \
518 #define CHECK_WIDGET_IMAGE_INSTANCE(x) do { \
519 CHECK_IMAGE_INSTANCE (x); \
520 if (!WIDGET_IMAGE_INSTANCEP (x)) \
521 x = wrong_type_argument (Qwidget_image_instance_p, (x)); \
524 struct Lisp_Image_Instance {
525 struct lcrecord_header header;
526 Lisp_Object domain; /* The domain in which we were cached. */
527 Lisp_Object device; /* The device of the domain. Recorded
528 since the domain may get deleted
531 /* The glyph from which we were instantiated. This is a weak
534 /* The instantiator from which we were instantiated. */
535 Lisp_Object instantiator;
536 enum image_instance_type type;
537 unsigned int x_offset, y_offset; /* for layout purposes */
538 int width, height, margin_width;
539 unsigned long display_hash; /* Hash value representing the structure
540 of the image_instance when it was
542 unsigned int dirty:1;
543 unsigned int size_changed:1;
544 unsigned int text_changed:1;
545 unsigned int layout_changed:1;
546 unsigned int optimize_output:1; /* For outputting layouts. */
547 unsigned int initialized:1; /* When we're fully done. */
548 unsigned int wants_initial_focus:1;
552 unsigned int descent;
557 unsigned int slice, maxslice, timeout;
558 Lisp_Object hotspot_x, hotspot_y; /* integer or Qnil */
559 Lisp_Object filename; /* string or Qnil */
560 Lisp_Object mask_filename; /* string or Qnil */
561 Lisp_Object fg, bg; /* foreground and background colors,
562 if this is a colorized mono-pixmap
564 Lisp_Object auxdata; /* list or Qnil: any additional data
565 to be seen from lisp */
566 void *mask; /* mask that can be seen from all windowing systems */
567 } pixmap; /* used for pointers as well */
569 void *subwindow; /* specific devices can use this as necessary */
570 struct { /* We need these so we can do without
573 unsigned int width, height;
575 unsigned int being_displayed:1; /* used to detect when needs
577 unsigned int v_resize:1; /* Whether the vsize is allowed to change. */
578 unsigned int h_resize:1; /* Whether the hsize is allowed to change. */
579 unsigned int orientation:1; /* Vertical or horizontal. */
580 unsigned int h_justification:2; /* left, right or center. */
581 unsigned int v_justification:2; /* top, bottom or center. */
582 /* Face for colors and font. We specify this here because we
583 want people to be able to put :face in the instantiator
584 spec. Using glyph-face is more inconvenient, although more
588 Lisp_Object props; /* properties or border */
589 Lisp_Object items; /* a list of displayed gui_items */
590 Lisp_Object pending_items; /* gui_items that should be displayed */
591 Lisp_Object children; /* a list of children */
592 Lisp_Object width; /* dynamic width spec. */
593 Lisp_Object height; /* dynamic height spec. */
594 /* Change flags to augment dirty. */
595 unsigned int face_changed:1;
596 unsigned int items_changed:1;
597 unsigned int action_occurred:1;
601 /* console-type- and image-type-specific data */
605 /* Layout bit-fields. */
606 #define LAYOUT_HORIZONTAL 0
607 #define LAYOUT_VERTICAL 1
609 #define LAYOUT_JUSTIFY_LEFT 0
610 #define LAYOUT_JUSTIFY_TOP 0
611 #define LAYOUT_JUSTIFY_RIGHT 1
612 #define LAYOUT_JUSTIFY_BOTTOM 1
613 #define LAYOUT_JUSTIFY_CENTER 2
615 #define IMAGE_INSTANCE_HASH_DEPTH 0
617 /* Accessor macros. */
618 #define IMAGE_INSTANCE_DOMAIN(i) ((i)->domain)
619 #define IMAGE_INSTANCE_DOMAIN_LIVE_P(i) (DOMAIN_LIVE_P ((i)->domain))
620 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device)
621 #define IMAGE_INSTANCE_FRAME(i) (DOMAIN_FRAME ((i)->domain))
622 #define IMAGE_INSTANCE_NAME(i) ((i)->name)
623 #define IMAGE_INSTANCE_PARENT(i) ((i)->parent)
624 #define IMAGE_INSTANCE_INSTANTIATOR(i) ((i)->instantiator)
625 #define IMAGE_INSTANCE_GLYPH(i) (image_instance_parent_glyph(i))
626 #define IMAGE_INSTANCE_TYPE(i) ((i)->type)
627 #define IMAGE_INSTANCE_XOFFSET(i) ((i)->x_offset)
628 #define IMAGE_INSTANCE_YOFFSET(i) ((i)->y_offset)
629 #define IMAGE_INSTANCE_WIDTH(i) ((i)->width)
630 #define IMAGE_INSTANCE_MARGIN_WIDTH(i) ((i)->margin_width)
631 #define IMAGE_INSTANCE_HEIGHT(i) ((i)->height)
632 #define IMAGE_INSTANCE_INITIALIZED(i) ((i)->initialized)
633 #define IMAGE_INSTANCE_DISPLAY_HASH(i) ((i)->display_hash)
634 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \
635 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \
636 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP))
637 #define IMAGE_INSTANCE_DIRTYP(i) ((i)->dirty)
638 #define IMAGE_INSTANCE_NEEDS_LAYOUT(i) \
639 ((IMAGE_INSTANCE_DIRTYP (i) && IMAGE_INSTANCE_LAYOUT_CHANGED (i)) \
640 || (FRAMEP (IMAGE_INSTANCE_FRAME (i)) \
641 && XFRAME (IMAGE_INSTANCE_FRAME (i))->size_changed))
643 /* converted to inline for clarity */
644 #define IMAGE_INSTANCE_FACE(i) \
645 (GLYPHP (IMAGE_INSTANCE_GLYPH (i)) ? \
646 XGLYPH_FACE (IMAGE_INSTANCE_GLYPH (i)) : Qnil)
648 static inline Lisp_Object
649 IMAGE_INSTANCE_FACE(Lisp_Image_Instance *i)
650 __attribute__((always_inline));
652 #define IMAGE_INSTANCE_WANTS_INITIAL_FOCUS(i) ((i)->wants_initial_focus)
655 #define IMAGE_INSTANCE_TEXT_CHANGED(i) ((i)->text_changed)
656 #define IMAGE_INSTANCE_SIZE_CHANGED(i) ((i)->size_changed)
657 #define IMAGE_INSTANCE_WIDGET_FACE_CHANGED(i) \
658 ((i)->u.subwindow.face_changed)
659 #define IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED(i) \
660 ((i)->u.subwindow.items_changed)
661 #define IMAGE_INSTANCE_WIDGET_ACTION_OCCURRED(i) \
662 ((i)->u.subwindow.action_occurred)
663 #define IMAGE_INSTANCE_LAYOUT_CHANGED(i) ((i)->layout_changed)
664 #define IMAGE_INSTANCE_OPTIMIZE_OUTPUT(i) ((i)->optimize_output)
666 /* Text properties */
667 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string)
668 #define IMAGE_INSTANCE_TEXT_WIDTH(i) \
669 IMAGE_INSTANCE_WIDTH(i)
670 #define IMAGE_INSTANCE_TEXT_HEIGHT(i) \
671 IMAGE_INSTANCE_HEIGHT(i)
672 #define IMAGE_INSTANCE_TEXT_DESCENT(i) ((i)->u.text.descent)
673 #define IMAGE_INSTANCE_TEXT_ASCENT(i) \
674 (IMAGE_INSTANCE_TEXT_HEIGHT(i) - IMAGE_INSTANCE_TEXT_DESCENT(i))
676 /* Pixmap properties */
677 #define IMAGE_INSTANCE_PIXMAP_WIDTH(i) \
678 IMAGE_INSTANCE_WIDTH(i)
679 #define IMAGE_INSTANCE_PIXMAP_HEIGHT(i) \
680 IMAGE_INSTANCE_HEIGHT(i)
681 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth)
682 #define IMAGE_INSTANCE_PIXMAP_FILENAME(i) ((i)->u.pixmap.filename)
683 #define IMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) ((i)->u.pixmap.mask_filename)
684 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) ((i)->u.pixmap.hotspot_x)
685 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) ((i)->u.pixmap.hotspot_y)
686 #define IMAGE_INSTANCE_PIXMAP_FG(i) ((i)->u.pixmap.fg)
687 #define IMAGE_INSTANCE_PIXMAP_BG(i) ((i)->u.pixmap.bg)
688 #define IMAGE_INSTANCE_PIXMAP_AUXDATA(i) ((i)->u.pixmap.auxdata)
689 #define IMAGE_INSTANCE_PIXMAP_MASK(i) ((i)->u.pixmap.mask)
690 #define IMAGE_INSTANCE_PIXMAP_SLICE(i) ((i)->u.pixmap.slice)
691 #define IMAGE_INSTANCE_PIXMAP_MAXSLICE(i) ((i)->u.pixmap.maxslice)
692 #define IMAGE_INSTANCE_PIXMAP_TIMEOUT(i) ((i)->u.pixmap.timeout)
694 /* Subwindow properties */
695 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow)
697 #define IMAGE_INSTANCE_DISPLAY_X(i) ((i)->u.subwindow.display_data.x)
698 #define IMAGE_INSTANCE_DISPLAY_Y(i) ((i)->u.subwindow.display_data.y)
699 #define IMAGE_INSTANCE_DISPLAY_WIDTH(i) \
700 ((i)->u.subwindow.display_data.width)
701 #define IMAGE_INSTANCE_DISPLAY_HEIGHT(i) \
702 ((i)->u.subwindow.display_data.height)
703 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \
704 ((i)->u.subwindow.being_displayed)
705 #define IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP(i) \
706 ((i)->u.subwindow.v_resize)
707 #define IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP(i) \
708 ((i)->u.subwindow.h_resize)
709 #define IMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \
710 ((i)->u.subwindow.orientation)
711 #define IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) \
712 ((i)->u.subwindow.h_justification)
713 #define IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) \
714 ((i)->u.subwindow.v_justification)
715 #define IMAGE_INSTANCE_SUBWINDOW_RIGHT_JUSTIFIED(i) \
716 (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) == LAYOUT_JUSTIFY_RIGHT)
717 #define IMAGE_INSTANCE_SUBWINDOW_LEFT_JUSTIFIED(i) \
718 (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) == LAYOUT_JUSTIFY_LEFT)
719 #define IMAGE_INSTANCE_SUBWINDOW_TOP_JUSTIFIED(i) \
720 (IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) == LAYOUT_JUSTIFY_TOP)
721 #define IMAGE_INSTANCE_SUBWINDOW_BOTTOM_JUSTIFIED(i) \
722 (IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) == LAYOUT_JUSTIFY_BOTTOM)
723 #define IMAGE_INSTANCE_SUBWINDOW_H_CENTERED(i) \
724 (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) == LAYOUT_JUSTIFY_CENTER)
725 #define IMAGE_INSTANCE_SUBWINDOW_V_CENTERED(i) \
726 (IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) == LAYOUT_JUSTIFY_CENTER)
727 #define IMAGE_INSTANCE_SUBWINDOW_LOGICAL_LAYOUT(i) \
728 (IMAGE_INSTANCE_SUBWINDOW_ORIENT (i) \
729 == LAYOUT_VERTICAL && !IMAGE_INSTANCE_SUBWINDOW_V_CENTERED (i))
731 #define IMAGE_INSTANCE_SUBWINDOW_FACE(i) \
732 ((i)->u.subwindow.face)
734 /* Widget properties */
735 #define IMAGE_INSTANCE_WIDGET_WIDTH(i) \
736 IMAGE_INSTANCE_WIDTH(i)
737 #define IMAGE_INSTANCE_WIDGET_HEIGHT(i) \
738 IMAGE_INSTANCE_HEIGHT(i)
739 #define IMAGE_INSTANCE_WIDGET_WIDTH_SUBR(i) ((i)->u.subwindow.width)
740 #define IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR(i) ((i)->u.subwindow.height)
741 #define IMAGE_INSTANCE_WIDGET_TYPE(i) ((i)->u.subwindow.type)
742 #define IMAGE_INSTANCE_WIDGET_PROPS(i) ((i)->u.subwindow.props)
743 #define SET_IMAGE_INSTANCE_WIDGET_FACE(i,f) \
744 ((i)->u.subwindow.face = f)
746 /* converted to an inline for better readability */
747 #define IMAGE_INSTANCE_WIDGET_FACE(i) \
748 (!NILP ((i)->u.subwindow.face) ? (i)->u.subwindow.face : \
749 !NILP (IMAGE_INSTANCE_FACE (i)) ? IMAGE_INSTANCE_FACE (i) : \
752 static inline Lisp_Object
753 IMAGE_INSTANCE_WIDGET_FACE(Lisp_Image_Instance *i)
754 __attribute__((always_inline));
757 #define IMAGE_INSTANCE_WIDGET_ITEMS(i) ((i)->u.subwindow.items)
758 #define IMAGE_INSTANCE_WIDGET_PENDING_ITEMS(i) \
759 ((i)->u.subwindow.pending_items)
760 #define IMAGE_INSTANCE_WIDGET_ITEM(i) \
761 (CONSP (IMAGE_INSTANCE_WIDGET_ITEMS (i)) ? \
762 XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (i)) : \
763 IMAGE_INSTANCE_WIDGET_ITEMS (i))
764 #define IMAGE_INSTANCE_WIDGET_TEXT(i) \
765 XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (i))->name
767 /* Layout properties */
768 #define IMAGE_INSTANCE_LAYOUT_CHILDREN(i) ((i)->u.subwindow.children)
769 #define IMAGE_INSTANCE_LAYOUT_BORDER(i) ((i)->u.subwindow.props)
771 #define XIMAGE_INSTANCE_DOMAIN(i) \
772 IMAGE_INSTANCE_DOMAIN (XIMAGE_INSTANCE (i))
773 #define XIMAGE_INSTANCE_DOMAIN_LIVE_P(i) \
774 IMAGE_INSTANCE_DOMAIN_LIVE_P (XIMAGE_INSTANCE (i))
775 #define XIMAGE_INSTANCE_DEVICE(i) \
776 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i))
777 #define XIMAGE_INSTANCE_FRAME(i) \
778 IMAGE_INSTANCE_FRAME (XIMAGE_INSTANCE (i))
779 #define XIMAGE_INSTANCE_NAME(i) \
780 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i))
781 #define XIMAGE_INSTANCE_GLYPH(i) \
782 IMAGE_INSTANCE_GLYPH (XIMAGE_INSTANCE (i))
783 #define XIMAGE_INSTANCE_PARENT(i) \
784 IMAGE_INSTANCE_PARENT (XIMAGE_INSTANCE (i))
785 #define XIMAGE_INSTANCE_INSTANTIATOR(i) \
786 IMAGE_INSTANCE_INSTANTIATOR (XIMAGE_INSTANCE (i))
787 #define XIMAGE_INSTANCE_TYPE(i) \
788 IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (i))
789 #define XIMAGE_INSTANCE_DISPLAY_HASH(i) \
790 IMAGE_INSTANCE_DISPLAY_HASH (XIMAGE_INSTANCE (i))
791 #define XIMAGE_INSTANCE_XOFFSET(i) \
792 IMAGE_INSTANCE_XOFFSET (XIMAGE_INSTANCE (i))
793 #define XIMAGE_INSTANCE_YOFFSET(i) \
794 IMAGE_INSTANCE_YOFFSET (XIMAGE_INSTANCE (i))
795 #define XIMAGE_INSTANCE_DIRTYP(i) \
796 IMAGE_INSTANCE_DIRTYP (XIMAGE_INSTANCE (i))
797 #define XIMAGE_INSTANCE_NEEDS_LAYOUT(i) \
798 IMAGE_INSTANCE_NEEDS_LAYOUT (XIMAGE_INSTANCE (i))
799 #define XIMAGE_INSTANCE_WIDTH(i) \
800 IMAGE_INSTANCE_WIDTH (XIMAGE_INSTANCE (i))
801 #define XIMAGE_INSTANCE_MARGIN_WIDTH(i) \
802 IMAGE_INSTANCE_MARGIN_WIDTH (XIMAGE_INSTANCE (i))
803 #define XIMAGE_INSTANCE_HEIGHT(i) \
804 IMAGE_INSTANCE_HEIGHT (XIMAGE_INSTANCE (i))
805 #define XIMAGE_INSTANCE_INITIALIZED(i) \
806 IMAGE_INSTANCE_INITIALIZED (XIMAGE_INSTANCE (i))
807 #define XIMAGE_INSTANCE_FACE(i) \
808 IMAGE_INSTANCE_FACE (XIMAGE_INSTANCE (i))
810 #define XIMAGE_INSTANCE_TEXT_STRING(i) \
811 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i))
812 #define XIMAGE_INSTANCE_TEXT_WIDTH(i) \
813 IMAGE_INSTANCE_TEXT_WIDTH (XIMAGE_INSTANCE (i))
814 #define XIMAGE_INSTANCE_TEXT_HEIGHT(i) \
815 IMAGE_INSTANCE_TEXT_HEIGHT (XIMAGE_INSTANCE (i))
816 #define XIMAGE_INSTANCE_TEXT_ASCENT(i) \
817 IMAGE_INSTANCE_TEXT_ASCENT (XIMAGE_INSTANCE (i))
818 #define XIMAGE_INSTANCE_TEXT_DESCENT(i) \
819 IMAGE_INSTANCE_TEXT_DESCENT (XIMAGE_INSTANCE (i))
821 #define XIMAGE_INSTANCE_PIXMAP_WIDTH(i) \
822 IMAGE_INSTANCE_PIXMAP_WIDTH (XIMAGE_INSTANCE (i))
823 #define XIMAGE_INSTANCE_PIXMAP_HEIGHT(i) \
824 IMAGE_INSTANCE_PIXMAP_HEIGHT (XIMAGE_INSTANCE (i))
825 #define XIMAGE_INSTANCE_PIXMAP_DEPTH(i) \
826 IMAGE_INSTANCE_PIXMAP_DEPTH (XIMAGE_INSTANCE (i))
827 #define XIMAGE_INSTANCE_PIXMAP_FILENAME(i) \
828 IMAGE_INSTANCE_PIXMAP_FILENAME (XIMAGE_INSTANCE (i))
829 #define XIMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) \
830 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (XIMAGE_INSTANCE (i))
831 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) \
832 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (XIMAGE_INSTANCE (i))
833 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) \
834 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (XIMAGE_INSTANCE (i))
835 #define XIMAGE_INSTANCE_PIXMAP_FG(i) \
836 IMAGE_INSTANCE_PIXMAP_FG (XIMAGE_INSTANCE (i))
837 #define XIMAGE_INSTANCE_PIXMAP_BG(i) \
838 IMAGE_INSTANCE_PIXMAP_BG (XIMAGE_INSTANCE (i))
839 #define XIMAGE_INSTANCE_PIXMAP_MASK(i) \
840 IMAGE_INSTANCE_PIXMAP_MASK (XIMAGE_INSTANCE (i))
841 #define XIMAGE_INSTANCE_PIXMAP_SLICE(i) \
842 IMAGE_INSTANCE_PIXMAP_SLICE (XIMAGE_INSTANCE (i))
843 #define XIMAGE_INSTANCE_PIXMAP_MAXSLICE(i) \
844 IMAGE_INSTANCE_PIXMAP_MAXSLICE (XIMAGE_INSTANCE (i))
845 #define XIMAGE_INSTANCE_PIXMAP_TIMEOUT(i) \
846 IMAGE_INSTANCE_PIXMAP_TIMEOUT (XIMAGE_INSTANCE (i))
848 #define XIMAGE_INSTANCE_WIDGET_WIDTH(i) \
849 IMAGE_INSTANCE_WIDGET_WIDTH (XIMAGE_INSTANCE (i))
850 #define XIMAGE_INSTANCE_WIDGET_HEIGHT(i) \
851 IMAGE_INSTANCE_WIDGET_HEIGHT (XIMAGE_INSTANCE (i))
852 #define XIMAGE_INSTANCE_WIDGET_WIDTH_SUBR(i) \
853 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (XIMAGE_INSTANCE (i))
854 #define XIMAGE_INSTANCE_WIDGET_HEIGHT_SUBR(i) \
855 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (XIMAGE_INSTANCE (i))
856 #define XIMAGE_INSTANCE_WIDGET_TYPE(i) \
857 IMAGE_INSTANCE_WIDGET_TYPE (XIMAGE_INSTANCE (i))
858 #define XIMAGE_INSTANCE_WIDGET_PROPS(i) \
859 IMAGE_INSTANCE_WIDGET_PROPS (XIMAGE_INSTANCE (i))
860 #define XIMAGE_INSTANCE_WIDGET_FACE(i) \
861 IMAGE_INSTANCE_WIDGET_FACE (XIMAGE_INSTANCE (i))
862 #define XSET_IMAGE_INSTANCE_WIDGET_FACE(i) \
863 SET_IMAGE_INSTANCE_WIDGET_FACE (XIMAGE_INSTANCE (i))
864 #define XIMAGE_INSTANCE_WIDGET_ITEM(i) \
865 IMAGE_INSTANCE_WIDGET_ITEM (XIMAGE_INSTANCE (i))
866 #define XIMAGE_INSTANCE_WIDGET_ITEMS(i) \
867 IMAGE_INSTANCE_WIDGET_ITEMS (XIMAGE_INSTANCE (i))
868 #define XIMAGE_INSTANCE_WIDGET_PENDING_ITEMS(i) \
869 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (XIMAGE_INSTANCE (i))
870 #define XIMAGE_INSTANCE_WIDGET_TEXT(i) \
871 IMAGE_INSTANCE_WIDGET_TEXT (XIMAGE_INSTANCE (i))
872 #define XIMAGE_INSTANCE_WIDGET_ACTION_OCCURRED(i) \
873 IMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (XIMAGE_INSTANCE (i))
875 #define XIMAGE_INSTANCE_LAYOUT_CHILDREN(i) \
876 IMAGE_INSTANCE_LAYOUT_CHILDREN (XIMAGE_INSTANCE (i))
877 #define XIMAGE_INSTANCE_LAYOUT_BORDER(i) \
878 IMAGE_INSTANCE_LAYOUT_BORDER (XIMAGE_INSTANCE (i))
880 #define XIMAGE_INSTANCE_SUBWINDOW_ID(i) \
881 IMAGE_INSTANCE_SUBWINDOW_ID (XIMAGE_INSTANCE (i))
882 #define XIMAGE_INSTANCE_DISPLAY_X(i) \
883 IMAGE_INSTANCE_DISPLAY_X (XIMAGE_INSTANCE (i))
884 #define XIMAGE_INSTANCE_DISPLAY_Y(i) \
885 IMAGE_INSTANCE_DISPLAY_Y (XIMAGE_INSTANCE (i))
886 #define XIMAGE_INSTANCE_DISPLAY_WIDTH(i) \
887 IMAGE_INSTANCE_DISPLAY_WIDTH (XIMAGE_INSTANCE (i))
888 #define XIMAGE_INSTANCE_DISPLAY_HEIGHT(i) \
889 IMAGE_INSTANCE_DISPLAY_HEIGHT (XIMAGE_INSTANCE (i))
890 #define XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \
891 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (XIMAGE_INSTANCE (i))
892 #define XIMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \
893 IMAGE_INSTANCE_SUBWINDOW_ORIENT (XIMAGE_INSTANCE (i))
894 #define XIMAGE_INSTANCE_SUBWINDOW_JUSTIFY(i) \
895 IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (XIMAGE_INSTANCE (i))
896 #define XIMAGE_INSTANCE_SUBWINDOW_FACE(i) \
897 IMAGE_INSTANCE_SUBWINDOW_FACE (XIMAGE_INSTANCE (i))
899 #define MARK_IMAGE_INSTANCE_CHANGED(i) \
900 (IMAGE_INSTANCE_DIRTYP (i) = 1);
902 Lisp_Object image_instance_device(Lisp_Object instance);
903 Lisp_Object image_instance_frame(Lisp_Object instance);
904 Lisp_Object image_instance_window(Lisp_Object instance);
905 int image_instance_live_p(Lisp_Object instance);
908 Lisp_Object evaluate_xpm_color_symbols(void);
909 Lisp_Object pixmap_to_lisp_data(Lisp_Object name, int ok_if_data_invalid);
910 #endif /* HAVE_XPM */
911 #ifdef HAVE_WINDOW_SYSTEM
912 Lisp_Object bitmap_to_lisp_data(Lisp_Object name, int *xhot, int *yhot,
913 int ok_if_data_invalid);
914 int read_bitmap_data_from_file(const char *filename, unsigned int *width,
915 unsigned int *height, unsigned char **datap,
916 int *x_hot, int *y_hot);
917 Lisp_Object xbm_mask_file_munging(Lisp_Object alist, Lisp_Object file,
918 Lisp_Object mask_file,
919 Lisp_Object console_type);
922 /************************************************************************/
924 /************************************************************************/
934 struct lcrecord_header header;
936 enum glyph_type type;
939 Lisp_Object image; /* the actual image */
940 Lisp_Object contrib_p; /* whether to figure into line height */
941 Lisp_Object baseline; /* percent above baseline */
943 Lisp_Object face; /* if non-nil, face to use when displaying */
946 void (*after_change) (Lisp_Object glyph, Lisp_Object property,
949 unsigned int dirty:1; /* So that we can selectively
950 redisplay changed glyphs. */
952 typedef struct Lisp_Glyph Lisp_Glyph;
954 DECLARE_LRECORD(glyph, Lisp_Glyph);
955 #define XGLYPH(x) XRECORD (x, glyph, Lisp_Glyph)
956 #define XSETGLYPH(x, p) XSETRECORD (x, p, glyph)
957 #define GLYPHP(x) RECORDP (x, glyph)
958 #define CHECK_GLYPH(x) CHECK_RECORD (x, glyph)
959 #define CONCHECK_GLYPH(x) CONCHECK_RECORD (x, glyph)
961 #define CHECK_BUFFER_GLYPH(x) do { \
963 if (XGLYPH (x)->type != GLYPH_BUFFER) \
964 x = wrong_type_argument (Qbuffer_glyph_p, (x)); \
967 #define CHECK_POINTER_GLYPH(x) do { \
969 if (XGLYPH (x)->type != GLYPH_POINTER) \
970 x = wrong_type_argument (Qpointer_glyph_p, (x)); \
973 #define CHECK_ICON_GLYPH(x) do { \
975 if (XGLYPH (x)->type != GLYPH_ICON) \
976 x = wrong_type_argument (Qicon_glyph_p, (x)); \
979 #define GLYPH_TYPE(g) ((g)->type)
980 #define GLYPH_IMAGE(g) ((g)->image)
981 #define GLYPH_CONTRIB_P(g) ((g)->contrib_p)
982 #define GLYPH_BASELINE(g) ((g)->baseline)
983 #define GLYPH_FACE(g) ((g)->face)
984 #define GLYPH_DIRTYP(g) ((g)->dirty)
986 #define XGLYPH_TYPE(g) GLYPH_TYPE (XGLYPH (g))
987 #define XGLYPH_IMAGE(g) GLYPH_IMAGE (XGLYPH (g))
988 #define XGLYPH_CONTRIB_P(g) GLYPH_CONTRIB_P (XGLYPH (g))
989 #define XGLYPH_BASELINE(g) GLYPH_BASELINE (XGLYPH (g))
990 #define XGLYPH_FACE(g) GLYPH_FACE (XGLYPH (g))
991 #define XGLYPH_DIRTYP(g) GLYPH_DIRTYP (XGLYPH (g))
993 #define MARK_GLYPH_CHANGED(g) (GLYPH_DIRTYP (g) = 1);
995 extern Lisp_Object Qxpm, Qxface, Qetched_in, Qetched_out, Qbevel_in, Qbevel_out;
996 extern Lisp_Object Q_data, Q_file, Q_color_symbols, Qconst_glyph_variable;
997 extern Lisp_Object Qxbm, Qedit_field, Qgroup, Qlabel, Qcombo_box, Qscrollbar;
998 extern Lisp_Object Qtree_view, Qtab_control, Qprogress_gauge, Q_border;
999 extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y;
1000 extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group;
1001 extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text;
1002 extern Lisp_Object Q_items, Q_properties, Q_image, Qimage_conversion_error;
1003 extern Lisp_Object Q_orientation, Q_margin_width;
1004 extern Lisp_Object Vcontinuation_glyph, Vcontrol_arrow_glyph, Vhscroll_glyph;
1005 extern Lisp_Object Vinvisible_text_glyph, Voctal_escape_glyph,
1007 extern Lisp_Object Vsxemacs_logo;
1009 unsigned short glyph_width(Lisp_Object glyph, Lisp_Object domain);
1010 unsigned short glyph_ascent(Lisp_Object glyph, Lisp_Object domain);
1011 unsigned short glyph_descent(Lisp_Object glyph, Lisp_Object domain);
1012 unsigned short glyph_height(Lisp_Object glyph, Lisp_Object domain);
1013 Lisp_Object glyph_baseline(Lisp_Object glyph, Lisp_Object domain);
1014 Lisp_Object glyph_face(Lisp_Object glyph, Lisp_Object domain);
1015 int glyph_contrib_p(Lisp_Object glyph, Lisp_Object domain);
1016 Lisp_Object glyph_image_instance(Lisp_Object glyph,
1018 Error_behavior errb, int no_quit);
1019 void file_or_data_must_be_present(Lisp_Object instantiator);
1020 void data_must_be_present(Lisp_Object instantiator);
1021 Lisp_Object make_string_from_file(Lisp_Object file);
1022 Lisp_Object tagged_vector_to_alist(Lisp_Object vector);
1023 Lisp_Object alist_to_tagged_vector(Lisp_Object tag, Lisp_Object alist);
1024 void string_instantiate(Lisp_Object image_instance, Lisp_Object instantiator,
1025 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
1026 int dest_mask, Lisp_Object domain);
1027 int tab_control_order_only_changed(Lisp_Object image_instance);
1028 Lisp_Object allocate_glyph(enum glyph_type type,
1029 void (*after_change) (Lisp_Object glyph,
1030 Lisp_Object property,
1031 Lisp_Object locale));
1032 Lisp_Object normalize_image_instantiator(Lisp_Object instantiator,
1033 Lisp_Object contype,
1034 Lisp_Object dest_mask);
1035 void glyph_query_geometry(Lisp_Object glyph_or_image, int *width, int *height,
1036 enum image_instance_geometry disp,
1037 Lisp_Object domain);
1038 void glyph_do_layout(Lisp_Object glyph_or_image, int width, int height,
1039 int xoffset, int yoffset, Lisp_Object domain);
1040 void query_string_geometry(Lisp_Object string, Lisp_Object face,
1041 int *width, int *height, int *descent,
1042 Lisp_Object domain);
1043 Lisp_Object query_string_font(Lisp_Object string,
1044 Lisp_Object face, Lisp_Object domain);
1045 Lisp_Object add_glyph_animated_timeout(EMACS_INT tickms, Lisp_Object device);
1046 void disable_glyph_animated_timeout(int i);
1048 /************************************************************************/
1050 /************************************************************************/
1052 typedef struct glyph_cachel glyph_cachel;
1053 struct glyph_cachel {
1056 unsigned int dirty:1; /* I'm copying faces here. I'm not
1057 sure why we need two dirty
1058 flags. Maybe because an image
1059 instance can be dirty and so we
1060 need to frob this in the same way
1061 as other image instance properties. */
1062 unsigned int updated:1;
1064 unsigned short width;
1065 unsigned short ascent;
1066 unsigned short descent;
1069 #define CONT_GLYPH_INDEX (glyph_index) 0
1070 #define TRUN_GLYPH_INDEX (glyph_index) 1
1071 #define HSCROLL_GLYPH_INDEX (glyph_index) 2
1072 #define CONTROL_GLYPH_INDEX (glyph_index) 3
1073 #define OCT_ESC_GLYPH_INDEX (glyph_index) 4
1074 #define INVIS_GLYPH_INDEX (glyph_index) 5
1076 #ifdef ERROR_CHECK_GLYPHS
1080 extern_inline int GLYPH_CACHEL_WIDTH(struct window *window, int ind);
1081 extern_inline int GLYPH_CACHEL_WIDTH(struct window *window, int ind)
1083 int wid = Dynarr_atp(window->glyph_cachels, ind)->width;
1084 assert(wid >= 0 && wid < 10000);
1087 extern_inline int GLYPH_CACHEL_ASCENT(struct window *window, int ind);
1088 extern_inline int GLYPH_CACHEL_ASCENT(struct window *window, int ind)
1090 int wid = Dynarr_atp(window->glyph_cachels, ind)->ascent;
1091 assert(wid >= 0 && wid < 10000);
1094 extern_inline int GLYPH_CACHEL_DESCENT(struct window *window, int ind);
1095 extern_inline int GLYPH_CACHEL_DESCENT(struct window *window, int ind)
1097 int wid = Dynarr_atp(window->glyph_cachels, ind)->descent;
1098 assert(wid >= 0 && wid < 10000);
1102 #else /* not ERROR_CHECK_GLYPHS */
1104 #define GLYPH_CACHEL_WIDTH(window, ind) \
1105 Dynarr_atp (window->glyph_cachels, ind)->width
1106 #define GLYPH_CACHEL_ASCENT(window, ind) \
1107 Dynarr_atp (window->glyph_cachels, ind)->ascent
1108 #define GLYPH_CACHEL_DESCENT(window, ind) \
1109 Dynarr_atp (window->glyph_cachels, ind)->descent
1111 #endif /* not ERROR_CHECK_GLYPHS */
1113 #define GLYPH_CACHEL(window, ind) \
1114 Dynarr_atp (window->glyph_cachels, ind)
1115 #define GLYPH_CACHEL_GLYPH(window, ind) \
1116 Dynarr_atp (window->glyph_cachels, ind)->glyph
1117 #define GLYPH_CACHEL_DIRTYP(window, ind) \
1118 Dynarr_atp (window->glyph_cachels, ind)->dirty
1120 void mark_glyph_cachels(glyph_cachel_dynarr * elements);
1121 void mark_glyph_cachels_as_not_updated(struct window *w);
1122 void mark_glyph_cachels_as_clean(struct window *w);
1123 void reset_glyph_cachels(struct window *w);
1124 glyph_index get_glyph_cachel_index(struct window *w, Lisp_Object glyph);
1126 #ifdef MEMORY_USAGE_STATS
1127 int compute_glyph_cachel_usage(glyph_cachel_dynarr * glyph_cachels,
1128 struct overhead_stats *ovstats);
1129 #endif /* MEMORY_USAGE_STATS */
1131 /************************************************************************/
1132 /* Display Tables */
1133 /************************************************************************/
1135 Lisp_Object display_table_entry(Emchar, Lisp_Object, Lisp_Object);
1136 void get_display_tables(struct window *, face_index,
1137 Lisp_Object *, Lisp_Object *);
1139 /****************************************************************************
1140 * Subwindow Object *
1141 ****************************************************************************/
1143 void unmap_subwindow(Lisp_Object subwindow);
1144 void map_subwindow(Lisp_Object subwindow, int x, int y,
1145 struct display_glyph_area *dga);
1146 int find_matching_subwindow(struct frame *f, int x, int y, int width,
1148 void redisplay_widget(Lisp_Object widget);
1149 void update_widget_instances(Lisp_Object frame);
1150 void redisplay_subwindow(Lisp_Object subwindow);
1151 Lisp_Object image_instance_parent_glyph(struct Lisp_Image_Instance *);
1152 int image_instance_changed(Lisp_Object image);
1153 void free_frame_subwindow_instances(struct frame *f);
1154 void reset_frame_subwindow_instance_cache(struct frame *f);
1155 int unmap_subwindow_instance_cache_mapper(Lisp_Object key,
1156 Lisp_Object value, void *finalize);
1158 struct expose_ignore {
1160 unsigned int width, height;
1161 struct expose_ignore *next;
1164 int check_for_ignored_expose(struct frame *f, int x, int y, int width,
1166 extern int hold_ignored_expose_registration;
1168 #define ROUND_UP(arg, unit) (((int)((arg) + (unit) - 1) / (int)(unit)) * (int)(unit))
1172 static inline Lisp_Object
1173 IMAGE_INSTANCE_FACE(Lisp_Image_Instance *i)
1175 Lisp_Object tmp = IMAGE_INSTANCE_GLYPH(i);
1178 return XGLYPH_FACE(tmp);
1184 static inline Lisp_Object
1185 IMAGE_INSTANCE_WIDGET_FACE(Lisp_Image_Instance *i)
1187 extern Lisp_Object Vwidget_face;
1190 if (!NILP(res = (i)->u.subwindow.face)) {
1192 } else if (!NILP(res = IMAGE_INSTANCE_FACE(i))) {
1195 return Vwidget_face;
1199 #endif /* INCLUDED_glyphs_h_ */