Mercurial > hg > xemacs-beta
comparison src/glyphs.h @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | 576fb035e263 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
48 jpeg color-pixmap | 48 jpeg color-pixmap |
49 png color-pixmap | 49 png color-pixmap |
50 tiff color-pixmap | 50 tiff color-pixmap |
51 bmp color-pixmap | 51 bmp color-pixmap |
52 cursor-font pointer | 52 cursor-font pointer |
53 mswindows-resource pointer | 53 mswindows-resource pointer, color-pixmap |
54 font pointer | 54 font pointer |
55 subwindow subwindow | 55 subwindow subwindow |
56 inherit mono-pixmap | 56 inherit mono-pixmap |
57 autodetect mono-pixmap, color-pixmap, pointer, text | 57 autodetect mono-pixmap, color-pixmap, pointer, text |
58 button widget | 58 button widget |
59 edit-field widget | 59 edit-field widget |
60 combo -box widget | 60 combo-box widget |
61 progress-gauge widget | 61 progress-gauge widget |
62 tab-control widget | 62 tab-control widget |
63 tree-view widget | 63 tree-view widget |
64 scrollbar widget | 64 scrollbar widget |
65 static widget | 65 label widget |
66 layout widget | |
67 native-layout widget | |
66 */ | 68 */ |
67 | 69 |
68 /* These are methods specific to a particular format of image instantiator | 70 /* These are methods specific to a particular format of image instantiator |
69 (e.g. xpm, string, etc.). */ | 71 (e.g. xpm, string, etc.). */ |
70 | 72 |
87 enum image_instance_geometry | 89 enum image_instance_geometry |
88 { | 90 { |
89 IMAGE_GEOMETRY, | 91 IMAGE_GEOMETRY, |
90 IMAGE_DESIRED_GEOMETRY, | 92 IMAGE_DESIRED_GEOMETRY, |
91 IMAGE_MIN_GEOMETRY, | 93 IMAGE_MIN_GEOMETRY, |
92 IMAGE_MAX_GEOMETRY, | 94 IMAGE_MAX_GEOMETRY |
93 IMAGE_UNSPECIFIED_GEOMETRY = ~0 | |
94 }; | 95 }; |
96 | |
97 #define IMAGE_UNSPECIFIED_GEOMETRY -1 | |
98 #define IMAGE_UNCHANGED_GEOMETRY -2 | |
95 | 99 |
96 #define WIDGET_BORDER_HEIGHT 4 | 100 #define WIDGET_BORDER_HEIGHT 4 |
97 #define WIDGET_BORDER_WIDTH 4 | 101 #define WIDGET_BORDER_WIDTH 4 |
102 | |
103 enum governing_domain | |
104 { | |
105 GOVERNING_DOMAIN_WINDOW, | |
106 GOVERNING_DOMAIN_FRAME, | |
107 GOVERNING_DOMAIN_DEVICE | |
108 }; | |
98 | 109 |
99 struct image_instantiator_methods | 110 struct image_instantiator_methods |
100 { | 111 { |
101 Lisp_Object symbol; | 112 Lisp_Object symbol; |
102 | 113 |
116 | 127 |
117 /* Normalize method: Given an instantiator, convert it to the form | 128 /* Normalize method: Given an instantiator, convert it to the form |
118 that should be used in a glyph, for devices of type CONSOLE_TYPE. | 129 that should be used in a glyph, for devices of type CONSOLE_TYPE. |
119 Signal an error if conversion fails. */ | 130 Signal an error if conversion fails. */ |
120 Lisp_Object (*normalize_method) (Lisp_Object instantiator, | 131 Lisp_Object (*normalize_method) (Lisp_Object instantiator, |
121 Lisp_Object console_type); | 132 Lisp_Object console_type, |
133 Lisp_Object dest_mask); | |
134 | |
135 /* Governing domain method: Return an int indicating what type of | |
136 domain an instance in this format is governed by. */ | |
137 int (*governing_domain_method) (void); | |
122 | 138 |
123 /* Possible-dest-types method: Return a mask indicating what dest types | 139 /* Possible-dest-types method: Return a mask indicating what dest types |
124 are compatible with this format. */ | 140 are compatible with this format. */ |
125 int (*possible_dest_types_method) (void); | 141 int (*possible_dest_types_method) (void); |
126 | 142 |
132 Lisp_Object instantiator, | 148 Lisp_Object instantiator, |
133 Lisp_Object pointer_fg, | 149 Lisp_Object pointer_fg, |
134 Lisp_Object pointer_bg, | 150 Lisp_Object pointer_bg, |
135 int dest_mask, | 151 int dest_mask, |
136 Lisp_Object domain); | 152 Lisp_Object domain); |
153 /* Post instantiate method: finish instantiation of the image | |
154 instance. */ | |
155 void (*post_instantiate_method) (Lisp_Object image_instance, | |
156 Lisp_Object instantiator, | |
157 Lisp_Object domain); | |
137 /* Property method: Given an image instance, return device specific | 158 /* Property method: Given an image instance, return device specific |
138 properties. */ | 159 properties. */ |
139 Lisp_Object (*property_method) (Lisp_Object image_instance, | 160 Lisp_Object (*property_method) (Lisp_Object image_instance, |
140 Lisp_Object property); | 161 Lisp_Object property); |
141 /* Set-property method: Given an image instance, set device specific | 162 /* Set-property method: Given an image instance, set device specific |
142 properties. */ | 163 properties. */ |
143 Lisp_Object (*set_property_method) (Lisp_Object image_instance, | 164 Lisp_Object (*set_property_method) (Lisp_Object image_instance, |
144 Lisp_Object property, | 165 Lisp_Object property, |
145 Lisp_Object val); | 166 Lisp_Object val); |
167 /* Asynchronously update properties. */ | |
168 void (*update_method) (Lisp_Object image_instance, | |
169 Lisp_Object instantiator); | |
170 void (*redisplay_method) (Lisp_Object image_instance); | |
146 | 171 |
147 /* Find out the desired geometry, as given by disp, of this image | 172 /* Find out the desired geometry, as given by disp, of this image |
148 instance. Actual geometry is stored in the appropriate slots in the | 173 instance. Actual geometry is stored in the appropriate slots in the |
149 image instance. */ | 174 image instance. */ |
150 void (*query_geometry_method) (Lisp_Object image_instance, | 175 void (*query_geometry_method) (Lisp_Object image_instance, |
151 unsigned int* width, unsigned int* height, | 176 int* width, int* height, |
152 enum image_instance_geometry disp, | 177 enum image_instance_geometry disp, |
153 Lisp_Object domain); | 178 Lisp_Object domain); |
154 | 179 |
155 /* Layout the instance and its children bounded by the provided | 180 /* Layout the instance and its children bounded by the provided |
156 dimensions. */ | 181 dimensions. Returns success or failure. */ |
157 void (*layout_method) (Lisp_Object image_instance, | 182 int (*layout_method) (Lisp_Object image_instance, |
158 unsigned int width, unsigned int height, | 183 int width, int height, int xoffset, int yoffset, |
159 Lisp_Object domain); | 184 Lisp_Object domain); |
160 }; | 185 }; |
161 | 186 |
162 /***** Calling an image-instantiator method *****/ | 187 /***** Calling an image-instantiator method *****/ |
163 | 188 |
164 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0) | 189 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0) |
183 | 208 |
184 /* Call a specifier method, if it exists; otherwise return | 209 /* Call a specifier method, if it exists; otherwise return |
185 the specified value */ | 210 the specified value */ |
186 | 211 |
187 #define IIFORMAT_METH_OR_GIVEN(mstruc, m, args, given) \ | 212 #define IIFORMAT_METH_OR_GIVEN(mstruc, m, args, given) \ |
188 (HAS_IIFORMAT_METH_P (mstruc, m) ? \ | 213 ((mstruc && HAS_IIFORMAT_METH_P (mstruc, m)) ? \ |
189 IIFORMAT_METH (mstruc, m, args) : (given)) | 214 IIFORMAT_METH (mstruc, m, args) : (given)) |
190 | 215 |
191 /***** Defining new image-instantiator types *****/ | 216 /***** Defining new image-instantiator types *****/ |
192 | 217 |
193 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \ | 218 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \ |
247 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may | 272 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may |
248 appear multiple times. */ | 273 appear multiple times. */ |
249 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyw, validate_fun) \ | 274 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyw, validate_fun) \ |
250 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 1, 1) | 275 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 1, 1) |
251 | 276 |
252 /* Same as IIFORMAT_VALID_KEYWORD execpt that the argument is not | 277 /* Same as IIFORMAT_VALID_KEYWORD except that the argument is not |
253 copied by the specifier functions. This is necessary for things | 278 copied by the specifier functions. This is necessary for things |
254 like callbacks etc. */ | 279 like callbacks etc. */ |
255 #define IIFORMAT_VALID_NONCOPY_KEYWORD(format, keyw, validate_fun) \ | 280 #define IIFORMAT_VALID_NONCOPY_KEYWORD(format, keyw, validate_fun) \ |
256 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 0, 0) | 281 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 0, 0) |
257 | 282 |
264 entry.symbol = Q##console; \ | 289 entry.symbol = Q##console; \ |
265 entry.meths = console##_console_methods; \ | 290 entry.meths = console##_console_methods; \ |
266 Dynarr_add (format##_image_instantiator_methods->consoles, \ | 291 Dynarr_add (format##_image_instantiator_methods->consoles, \ |
267 entry); \ | 292 entry); \ |
268 } while (0) | 293 } while (0) |
294 | |
295 #define IIFORMAT_VALID_CONSOLE2(con1, con2, format) \ | |
296 IIFORMAT_VALID_CONSOLE (con1, format); \ | |
297 IIFORMAT_VALID_CONSOLE (con2, format); | |
269 | 298 |
270 #define DEFINE_DEVICE_IIFORMAT(type, format) \ | 299 #define DEFINE_DEVICE_IIFORMAT(type, format) \ |
271 DECLARE_IMAGE_INSTANTIATOR_FORMAT(format); \ | 300 DECLARE_IMAGE_INSTANTIATOR_FORMAT(format); \ |
272 struct image_instantiator_methods *type##_##format##_image_instantiator_methods | 301 struct image_instantiator_methods *type##_##format##_image_instantiator_methods |
273 | 302 |
290 initialization routines */ | 319 initialization routines */ |
291 #define IIFORMAT_HAS_DEVMETHOD(type, format, m) \ | 320 #define IIFORMAT_HAS_DEVMETHOD(type, format, m) \ |
292 (type##_##format##_image_instantiator_methods->m##_method = type##_##format##_##m) | 321 (type##_##format##_image_instantiator_methods->m##_method = type##_##format##_##m) |
293 #define IIFORMAT_HAS_SHARED_DEVMETHOD(type, format, m, fromformat) \ | 322 #define IIFORMAT_HAS_SHARED_DEVMETHOD(type, format, m, fromformat) \ |
294 (type##_##format##_image_instantiator_methods->m##_method = type##_##fromformat##_##m) | 323 (type##_##format##_image_instantiator_methods->m##_method = type##_##fromformat##_##m) |
324 | |
325 #define IIFORMAT_INHERITS_DEVMETHOD(type, from, format, m) \ | |
326 (type##_##format##_image_instantiator_methods->m##_method = from##_##format##_##m) | |
327 #define IIFORMAT_INHERITS_SHARED_DEVMETHOD(type, from, format, m, fromformat) \ | |
328 (type##_##format##_image_instantiator_methods->m##_method = from##_##fromformat##_##m) | |
295 | 329 |
296 struct image_instantiator_methods * | 330 struct image_instantiator_methods * |
297 decode_device_ii_format (Lisp_Object device, Lisp_Object format, | 331 decode_device_ii_format (Lisp_Object device, Lisp_Object format, |
298 Error_behavior errb); | 332 Error_behavior errb); |
299 struct image_instantiator_methods * | 333 struct image_instantiator_methods * |
317 Lisp_Object console_type); | 351 Lisp_Object console_type); |
318 void check_valid_string (Lisp_Object data); | 352 void check_valid_string (Lisp_Object data); |
319 void check_valid_int (Lisp_Object data); | 353 void check_valid_int (Lisp_Object data); |
320 void check_valid_face (Lisp_Object data); | 354 void check_valid_face (Lisp_Object data); |
321 void check_valid_vector (Lisp_Object data); | 355 void check_valid_vector (Lisp_Object data); |
322 void check_valid_item_list_1 (Lisp_Object items); | 356 void check_valid_item_list (Lisp_Object items); |
323 | 357 |
324 void initialize_subwindow_image_instance (Lisp_Image_Instance*); | 358 void initialize_subwindow_image_instance (Lisp_Image_Instance*); |
325 void subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 359 void subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
326 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 360 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
327 int dest_mask, Lisp_Object domain); | 361 int dest_mask, Lisp_Object domain); |
362 int subwindow_governing_domain (void); | |
328 void widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 363 void widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
329 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 364 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
330 int dest_mask, Lisp_Object domain); | 365 int dest_mask, Lisp_Object domain); |
331 void image_instance_query_geometry (Lisp_Object image_instance, | 366 void image_instance_query_geometry (Lisp_Object image_instance, |
332 unsigned int* width, unsigned int* height, | 367 int* width, int* height, |
333 enum image_instance_geometry disp, | 368 enum image_instance_geometry disp, |
334 Lisp_Object domain); | 369 Lisp_Object domain); |
335 void image_instance_layout (Lisp_Object image_instance, | 370 void image_instance_layout (Lisp_Object image_instance, |
336 unsigned int width, unsigned int height, | 371 int width, int height, int xoffset, int yoffset, |
337 Lisp_Object domain); | 372 Lisp_Object domain); |
373 int layout_layout (Lisp_Object image_instance, | |
374 int width, int height, int xoffset, int yoffset, | |
375 Lisp_Object domain); | |
338 int invalidate_glyph_geometry_maybe (Lisp_Object glyph_or_ii, struct window* w); | 376 int invalidate_glyph_geometry_maybe (Lisp_Object glyph_or_ii, struct window* w); |
339 | 377 |
340 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator, | 378 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator, |
341 int given_dest_mask, | 379 int given_dest_mask, |
342 int desired_dest_mask)); | 380 int desired_dest_mask)); |
343 DECLARE_DOESNT_RETURN (signal_image_error (CONST char *, Lisp_Object)); | 381 DECLARE_DOESNT_RETURN (signal_image_error (const char *, Lisp_Object)); |
344 DECLARE_DOESNT_RETURN (signal_image_error_2 (CONST char *, Lisp_Object, Lisp_Object)); | 382 DECLARE_DOESNT_RETURN (signal_image_error_2 (const char *, Lisp_Object, Lisp_Object)); |
345 | 383 |
346 /************************************************************************/ | 384 /************************************************************************/ |
347 /* Image Specifier Object */ | 385 /* Image Specifier Object */ |
348 /************************************************************************/ | 386 /************************************************************************/ |
349 | 387 |
381 #define XIMAGE_INSTANCE(x) XRECORD (x, image_instance, Lisp_Image_Instance) | 419 #define XIMAGE_INSTANCE(x) XRECORD (x, image_instance, Lisp_Image_Instance) |
382 #define XSETIMAGE_INSTANCE(x, p) XSETRECORD (x, p, image_instance) | 420 #define XSETIMAGE_INSTANCE(x, p) XSETRECORD (x, p, image_instance) |
383 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance) | 421 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance) |
384 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance) | 422 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance) |
385 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance) | 423 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance) |
424 | |
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) | |
432 #else | |
433 #define ERROR_CHECK_IMAGE_INSTANCE(ii) | |
434 #define ERROR_CHECK_SUBWINDOW_CACHE(w) | |
435 #endif | |
386 | 436 |
387 enum image_instance_type | 437 enum image_instance_type |
388 { | 438 { |
389 IMAGE_UNKNOWN, | 439 IMAGE_UNKNOWN, |
390 IMAGE_NOTHING, | 440 IMAGE_NOTHING, |
391 IMAGE_TEXT, | 441 IMAGE_TEXT, |
392 IMAGE_MONO_PIXMAP, | 442 IMAGE_MONO_PIXMAP, |
393 IMAGE_COLOR_PIXMAP, | 443 IMAGE_COLOR_PIXMAP, |
394 IMAGE_POINTER, | 444 IMAGE_POINTER, |
395 IMAGE_SUBWINDOW, | 445 IMAGE_SUBWINDOW, |
396 IMAGE_WIDGET, | 446 IMAGE_WIDGET |
397 IMAGE_LAYOUT | |
398 }; | 447 }; |
399 | 448 |
400 #define IMAGE_NOTHING_MASK (1 << 0) | 449 #define IMAGE_NOTHING_MASK (1 << 0) |
401 #define IMAGE_TEXT_MASK (1 << 1) | 450 #define IMAGE_TEXT_MASK (1 << 1) |
402 #define IMAGE_MONO_PIXMAP_MASK (1 << 2) | 451 #define IMAGE_MONO_PIXMAP_MASK (1 << 2) |
403 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3) | 452 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3) |
404 #define IMAGE_POINTER_MASK (1 << 4) | 453 #define IMAGE_POINTER_MASK (1 << 4) |
405 #define IMAGE_SUBWINDOW_MASK (1 << 5) | 454 #define IMAGE_SUBWINDOW_MASK (1 << 5) |
406 #define IMAGE_WIDGET_MASK (1 << 6) | 455 #define IMAGE_WIDGET_MASK (1 << 6) |
407 #define IMAGE_LAYOUT_MASK (1 << 7) | 456 |
457 /* This depends on the fact that enums are assigned consecutive | |
458 integers starting at 0. (Remember that IMAGE_UNKNOWN is the | |
459 first enum.) I'm fairly sure this behavior is ANSI-mandated, | |
460 so there should be no portability problems here. */ | |
461 #define image_instance_type_to_mask(type) \ | |
462 ((int) (1 << ((int) (type) - 1))) | |
408 | 463 |
409 #define IMAGE_INSTANCE_TYPE_P(ii, type) \ | 464 #define IMAGE_INSTANCE_TYPE_P(ii, type) \ |
410 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type) | 465 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type) |
411 | 466 |
412 #define NOTHING_IMAGE_INSTANCEP(ii) \ | 467 #define NOTHING_IMAGE_INSTANCEP(ii) \ |
421 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER) | 476 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER) |
422 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \ | 477 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \ |
423 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW) | 478 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW) |
424 #define WIDGET_IMAGE_INSTANCEP(ii) \ | 479 #define WIDGET_IMAGE_INSTANCEP(ii) \ |
425 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_WIDGET) | 480 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_WIDGET) |
426 #define LAYOUT_IMAGE_INSTANCEP(ii) \ | |
427 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_LAYOUT) | |
428 | 481 |
429 #define CHECK_NOTHING_IMAGE_INSTANCE(x) do { \ | 482 #define CHECK_NOTHING_IMAGE_INSTANCE(x) do { \ |
430 CHECK_IMAGE_INSTANCE (x); \ | 483 CHECK_IMAGE_INSTANCE (x); \ |
431 if (!NOTHING_IMAGE_INSTANCEP (x)) \ | 484 if (!NOTHING_IMAGE_INSTANCEP (x)) \ |
432 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \ | 485 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \ |
467 CHECK_IMAGE_INSTANCE (x); \ | 520 CHECK_IMAGE_INSTANCE (x); \ |
468 if (!WIDGET_IMAGE_INSTANCEP (x)) \ | 521 if (!WIDGET_IMAGE_INSTANCEP (x)) \ |
469 x = wrong_type_argument (Qwidget_image_instance_p, (x)); \ | 522 x = wrong_type_argument (Qwidget_image_instance_p, (x)); \ |
470 } while (0) | 523 } while (0) |
471 | 524 |
472 #define CHECK_LAYOUT_IMAGE_INSTANCE(x) do { \ | |
473 CHECK_IMAGE_INSTANCE (x); \ | |
474 if (!LAYOUT_IMAGE_INSTANCEP (x)) \ | |
475 x = wrong_type_argument (Qlayout_image_instance_p, (x)); \ | |
476 } while (0) | |
477 | |
478 struct Lisp_Image_Instance | 525 struct Lisp_Image_Instance |
479 { | 526 { |
480 struct lcrecord_header header; | 527 struct lcrecord_header header; |
481 Lisp_Object device; | 528 Lisp_Object domain; /* The domain in which we were cached. */ |
529 Lisp_Object device; /* The device of the domain. Recorded | |
530 since the domain may get deleted | |
531 before us. */ | |
482 Lisp_Object name; | 532 Lisp_Object name; |
483 /* The glyph from which we were instantiated. This is a weak | 533 /* The glyph from which we were instantiated. This is a weak |
484 reference. */ | 534 reference. */ |
485 Lisp_Object glyph; | 535 Lisp_Object parent; |
536 /* The instantiator from which we were instantiated. */ | |
537 Lisp_Object instantiator; | |
486 enum image_instance_type type; | 538 enum image_instance_type type; |
487 unsigned int x_offset, y_offset; /* for layout purposes */ | 539 unsigned int x_offset, y_offset; /* for layout purposes */ |
488 unsigned int width, height; | 540 int width, height, margin_width; |
541 unsigned long display_hash; /* Hash value representing the structure | |
542 of the image_instance when it was | |
543 last displayed. */ | |
489 unsigned int dirty : 1; | 544 unsigned int dirty : 1; |
545 unsigned int size_changed : 1; | |
546 unsigned int text_changed : 1; | |
547 unsigned int layout_changed : 1; | |
548 unsigned int optimize_output : 1; /* For outputting layouts. */ | |
549 unsigned int initialized : 1; /* When we're fully done. */ | |
550 unsigned int wants_initial_focus : 1; | |
551 | |
490 union | 552 union |
491 { | 553 { |
492 struct | 554 struct |
493 { | 555 { |
494 unsigned int descent; | 556 unsigned int descent; |
508 to be seen from lisp */ | 570 to be seen from lisp */ |
509 void* mask; /* mask that can be seen from all windowing systems */ | 571 void* mask; /* mask that can be seen from all windowing systems */ |
510 } pixmap; /* used for pointers as well */ | 572 } pixmap; /* used for pointers as well */ |
511 struct | 573 struct |
512 { | 574 { |
513 Lisp_Object frame; | |
514 void* subwindow; /* specific devices can use this as necessary */ | 575 void* subwindow; /* specific devices can use this as necessary */ |
515 unsigned int being_displayed : 1; /* used to detect when needs to be unmapped */ | 576 struct |
577 { /* We need these so we can do without | |
578 subwindow_cachel */ | |
579 unsigned int x, y; | |
580 unsigned int width, height; | |
581 } display_data; | |
582 unsigned int being_displayed : 1; /* used to detect when needs | |
583 to be unmapped */ | |
516 unsigned int v_resize : 1; /* Whether the vsize is allowed to change. */ | 584 unsigned int v_resize : 1; /* Whether the vsize is allowed to change. */ |
517 unsigned int h_resize : 1; /* Whether the hsize is allowed to change. */ | 585 unsigned int h_resize : 1; /* Whether the hsize is allowed to change. */ |
518 unsigned int orientation : 1; /* Vertical or horizontal. */ | 586 unsigned int orientation : 1; /* Vertical or horizontal. */ |
519 unsigned int justification : 2; /* Left, right or center. */ | 587 unsigned int justification : 2; /* Left, right or center. */ |
520 /* Face for colors and font. We specify this here becuase we | 588 /* Face for colors and font. We specify this here because we |
521 want people to be able to put :face in the instantiator | 589 want people to be able to put :face in the instantiator |
522 spec. Using gyph-face is more inconvenient, although more | 590 spec. Using glyph-face is more inconvenient, although more |
523 general. */ | 591 general. */ |
524 Lisp_Object face; | 592 Lisp_Object face; |
525 Lisp_Object type; | 593 Lisp_Object type; |
526 Lisp_Object props; /* properties or border*/ | 594 Lisp_Object props; /* properties or border*/ |
527 Lisp_Object items; /* a list of gui_items or children */ | 595 Lisp_Object items; /* a list of displayed gui_items */ |
596 Lisp_Object pending_items; /* gui_items that should be displayed */ | |
597 Lisp_Object children; /* a list of children */ | |
598 Lisp_Object width; /* dynamic width spec. */ | |
599 Lisp_Object height; /* dynamic height spec. */ | |
600 /* Change flags to augment dirty. */ | |
601 unsigned int face_changed : 1; | |
602 unsigned int items_changed : 1; | |
603 unsigned int action_occurred : 1; | |
528 } subwindow; | 604 } subwindow; |
529 } u; | 605 } u; |
530 | 606 |
531 /* console-type- and image-type-specific data */ | 607 /* console-type- and image-type-specific data */ |
532 void *data; | 608 void *data; |
538 | 614 |
539 #define LAYOUT_JUSTIFY_LEFT 0 | 615 #define LAYOUT_JUSTIFY_LEFT 0 |
540 #define LAYOUT_JUSTIFY_RIGHT 1 | 616 #define LAYOUT_JUSTIFY_RIGHT 1 |
541 #define LAYOUT_JUSTIFY_CENTER 2 | 617 #define LAYOUT_JUSTIFY_CENTER 2 |
542 | 618 |
619 #define IMAGE_INSTANCE_HASH_DEPTH 0 | |
620 | |
543 /* Accessor macros. */ | 621 /* Accessor macros. */ |
622 #define IMAGE_INSTANCE_DOMAIN(i) ((i)->domain) | |
623 #define IMAGE_INSTANCE_DOMAIN_LIVE_P(i) (DOMAIN_LIVE_P ((i)->domain)) | |
544 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device) | 624 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device) |
625 #define IMAGE_INSTANCE_FRAME(i) (DOMAIN_FRAME ((i)->domain)) | |
545 #define IMAGE_INSTANCE_NAME(i) ((i)->name) | 626 #define IMAGE_INSTANCE_NAME(i) ((i)->name) |
546 #define IMAGE_INSTANCE_GLYPH(i) ((i)->glyph) | 627 #define IMAGE_INSTANCE_PARENT(i) ((i)->parent) |
628 #define IMAGE_INSTANCE_INSTANTIATOR(i) ((i)->instantiator) | |
629 #define IMAGE_INSTANCE_GLYPH(i) (image_instance_parent_glyph(i)) | |
547 #define IMAGE_INSTANCE_TYPE(i) ((i)->type) | 630 #define IMAGE_INSTANCE_TYPE(i) ((i)->type) |
548 #define IMAGE_INSTANCE_XOFFSET(i) ((i)->x_offset) | 631 #define IMAGE_INSTANCE_XOFFSET(i) ((i)->x_offset) |
549 #define IMAGE_INSTANCE_YOFFSET(i) ((i)->y_offset) | 632 #define IMAGE_INSTANCE_YOFFSET(i) ((i)->y_offset) |
550 #define IMAGE_INSTANCE_WIDTH(i) ((i)->width) | 633 #define IMAGE_INSTANCE_WIDTH(i) ((i)->width) |
634 #define IMAGE_INSTANCE_MARGIN_WIDTH(i) ((i)->margin_width) | |
551 #define IMAGE_INSTANCE_HEIGHT(i) ((i)->height) | 635 #define IMAGE_INSTANCE_HEIGHT(i) ((i)->height) |
636 #define IMAGE_INSTANCE_INITIALIZED(i) ((i)->initialized) | |
637 #define IMAGE_INSTANCE_DISPLAY_HASH(i) ((i)->display_hash) | |
552 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \ | 638 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \ |
553 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \ | 639 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \ |
554 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP)) | 640 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP)) |
555 #define IMAGE_INSTANCE_DIRTYP(i) ((i)->dirty) | 641 #define IMAGE_INSTANCE_DIRTYP(i) ((i)->dirty) |
642 #define IMAGE_INSTANCE_NEEDS_LAYOUT(i) \ | |
643 ((IMAGE_INSTANCE_DIRTYP (i) && IMAGE_INSTANCE_LAYOUT_CHANGED (i)) \ | |
644 || (FRAMEP (IMAGE_INSTANCE_FRAME (i)) \ | |
645 && XFRAME (IMAGE_INSTANCE_FRAME (i))->size_changed)) | |
556 #define IMAGE_INSTANCE_FACE(i) \ | 646 #define IMAGE_INSTANCE_FACE(i) \ |
557 XGLYPH_FACE (IMAGE_INSTANCE_GLYPH (i)) | 647 (GLYPHP (IMAGE_INSTANCE_GLYPH (i)) ? \ |
558 | 648 XGLYPH_FACE (IMAGE_INSTANCE_GLYPH (i)) : Qnil) |
649 #define IMAGE_INSTANCE_WANTS_INITIAL_FOCUS(i) ((i)->wants_initial_focus) | |
650 | |
651 /* Changed flags */ | |
652 #define IMAGE_INSTANCE_TEXT_CHANGED(i) ((i)->text_changed) | |
653 #define IMAGE_INSTANCE_SIZE_CHANGED(i) ((i)->size_changed) | |
654 #define IMAGE_INSTANCE_WIDGET_FACE_CHANGED(i) \ | |
655 ((i)->u.subwindow.face_changed) | |
656 #define IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED(i) \ | |
657 ((i)->u.subwindow.items_changed) | |
658 #define IMAGE_INSTANCE_WIDGET_ACTION_OCCURRED(i) \ | |
659 ((i)->u.subwindow.action_occurred) | |
660 #define IMAGE_INSTANCE_LAYOUT_CHANGED(i) ((i)->layout_changed) | |
661 #define IMAGE_INSTANCE_OPTIMIZE_OUTPUT(i) ((i)->optimize_output) | |
662 | |
663 /* Text properties */ | |
559 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string) | 664 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string) |
560 #define IMAGE_INSTANCE_TEXT_WIDTH(i) \ | 665 #define IMAGE_INSTANCE_TEXT_WIDTH(i) \ |
561 IMAGE_INSTANCE_WIDTH(i) | 666 IMAGE_INSTANCE_WIDTH(i) |
562 #define IMAGE_INSTANCE_TEXT_HEIGHT(i) \ | 667 #define IMAGE_INSTANCE_TEXT_HEIGHT(i) \ |
563 IMAGE_INSTANCE_HEIGHT(i) | 668 IMAGE_INSTANCE_HEIGHT(i) |
564 #define IMAGE_INSTANCE_TEXT_DESCENT(i) ((i)->u.text.descent) | 669 #define IMAGE_INSTANCE_TEXT_DESCENT(i) ((i)->u.text.descent) |
565 #define IMAGE_INSTANCE_TEXT_ASCENT(i) \ | 670 #define IMAGE_INSTANCE_TEXT_ASCENT(i) \ |
566 (IMAGE_INSTANCE_TEXT_HEIGHT(i) - IMAGE_INSTANCE_TEXT_DESCENT(i)) | 671 (IMAGE_INSTANCE_TEXT_HEIGHT(i) - IMAGE_INSTANCE_TEXT_DESCENT(i)) |
567 | 672 |
673 /* Pixmap properties */ | |
568 #define IMAGE_INSTANCE_PIXMAP_WIDTH(i) \ | 674 #define IMAGE_INSTANCE_PIXMAP_WIDTH(i) \ |
569 IMAGE_INSTANCE_WIDTH(i) | 675 IMAGE_INSTANCE_WIDTH(i) |
570 #define IMAGE_INSTANCE_PIXMAP_HEIGHT(i) \ | 676 #define IMAGE_INSTANCE_PIXMAP_HEIGHT(i) \ |
571 IMAGE_INSTANCE_HEIGHT(i) | 677 IMAGE_INSTANCE_HEIGHT(i) |
572 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth) | 678 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth) |
580 #define IMAGE_INSTANCE_PIXMAP_MASK(i) ((i)->u.pixmap.mask) | 686 #define IMAGE_INSTANCE_PIXMAP_MASK(i) ((i)->u.pixmap.mask) |
581 #define IMAGE_INSTANCE_PIXMAP_SLICE(i) ((i)->u.pixmap.slice) | 687 #define IMAGE_INSTANCE_PIXMAP_SLICE(i) ((i)->u.pixmap.slice) |
582 #define IMAGE_INSTANCE_PIXMAP_MAXSLICE(i) ((i)->u.pixmap.maxslice) | 688 #define IMAGE_INSTANCE_PIXMAP_MAXSLICE(i) ((i)->u.pixmap.maxslice) |
583 #define IMAGE_INSTANCE_PIXMAP_TIMEOUT(i) ((i)->u.pixmap.timeout) | 689 #define IMAGE_INSTANCE_PIXMAP_TIMEOUT(i) ((i)->u.pixmap.timeout) |
584 | 690 |
585 #define IMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \ | 691 /* Subwindow properties */ |
586 IMAGE_INSTANCE_WIDTH(i) | |
587 #define IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \ | |
588 IMAGE_INSTANCE_HEIGHT(i) | |
589 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow) | 692 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow) |
590 #define IMAGE_INSTANCE_SUBWINDOW_FRAME(i) ((i)->u.subwindow.frame) | 693 /* Display data. */ |
694 #define IMAGE_INSTANCE_DISPLAY_X(i) ((i)->u.subwindow.display_data.x) | |
695 #define IMAGE_INSTANCE_DISPLAY_Y(i) ((i)->u.subwindow.display_data.y) | |
696 #define IMAGE_INSTANCE_DISPLAY_WIDTH(i) \ | |
697 ((i)->u.subwindow.display_data.width) | |
698 #define IMAGE_INSTANCE_DISPLAY_HEIGHT(i) \ | |
699 ((i)->u.subwindow.display_data.height) | |
591 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ | 700 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ |
592 ((i)->u.subwindow.being_displayed) | 701 ((i)->u.subwindow.being_displayed) |
593 #define IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP(i) \ | 702 #define IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP(i) \ |
594 ((i)->u.subwindow.v_resize) | 703 ((i)->u.subwindow.v_resize) |
595 #define IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP(i) \ | 704 #define IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP(i) \ |
596 ((i)->u.subwindow.h_resize) | 705 ((i)->u.subwindow.h_resize) |
597 #define IMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \ | 706 #define IMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \ |
598 ((i)->u.subwindow.orientation) | 707 ((i)->u.subwindow.orientation) |
599 #define IMAGE_INSTANCE_SUBWINDOW_JUSTIFY(i) \ | 708 #define IMAGE_INSTANCE_SUBWINDOW_JUSTIFY(i) \ |
600 ((i)->u.subwindow.justification) | 709 ((i)->u.subwindow.justification) |
601 | 710 #define IMAGE_INSTANCE_SUBWINDOW_FACE(i) \ |
711 ((i)->u.subwindow.face) | |
712 | |
713 /* Widget properties */ | |
602 #define IMAGE_INSTANCE_WIDGET_WIDTH(i) \ | 714 #define IMAGE_INSTANCE_WIDGET_WIDTH(i) \ |
603 IMAGE_INSTANCE_WIDTH(i) | 715 IMAGE_INSTANCE_WIDTH(i) |
604 #define IMAGE_INSTANCE_WIDGET_HEIGHT(i) \ | 716 #define IMAGE_INSTANCE_WIDGET_HEIGHT(i) \ |
605 IMAGE_INSTANCE_HEIGHT(i) | 717 IMAGE_INSTANCE_HEIGHT(i) |
718 #define IMAGE_INSTANCE_WIDGET_WIDTH_SUBR(i) ((i)->u.subwindow.width) | |
719 #define IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR(i) ((i)->u.subwindow.height) | |
606 #define IMAGE_INSTANCE_WIDGET_TYPE(i) ((i)->u.subwindow.type) | 720 #define IMAGE_INSTANCE_WIDGET_TYPE(i) ((i)->u.subwindow.type) |
607 #define IMAGE_INSTANCE_WIDGET_PROPS(i) ((i)->u.subwindow.props) | 721 #define IMAGE_INSTANCE_WIDGET_PROPS(i) ((i)->u.subwindow.props) |
608 #define SET_IMAGE_INSTANCE_WIDGET_FACE(i,f) \ | 722 #define SET_IMAGE_INSTANCE_WIDGET_FACE(i,f) \ |
609 ((i)->u.subwindow.face = f) | 723 ((i)->u.subwindow.face = f) |
610 #define IMAGE_INSTANCE_WIDGET_FACE(i) \ | 724 #define IMAGE_INSTANCE_WIDGET_FACE(i) \ |
611 (!NILP ((i)->u.subwindow.face) ? (i)->u.subwindow.face : \ | 725 (!NILP ((i)->u.subwindow.face) ? (i)->u.subwindow.face : \ |
612 !NILP (IMAGE_INSTANCE_FACE (i)) ? IMAGE_INSTANCE_FACE (i) : \ | 726 !NILP (IMAGE_INSTANCE_FACE (i)) ? IMAGE_INSTANCE_FACE (i) : \ |
613 Vwidget_face) | 727 Vwidget_face) |
614 #define IMAGE_INSTANCE_WIDGET_ITEMS(i) ((i)->u.subwindow.items) | 728 #define IMAGE_INSTANCE_WIDGET_ITEMS(i) ((i)->u.subwindow.items) |
729 #define IMAGE_INSTANCE_WIDGET_PENDING_ITEMS(i) \ | |
730 ((i)->u.subwindow.pending_items) | |
615 #define IMAGE_INSTANCE_WIDGET_ITEM(i) \ | 731 #define IMAGE_INSTANCE_WIDGET_ITEM(i) \ |
616 (CONSP (IMAGE_INSTANCE_WIDGET_ITEMS (i)) ? \ | 732 (CONSP (IMAGE_INSTANCE_WIDGET_ITEMS (i)) ? \ |
617 XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (i)) : \ | 733 XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (i)) : \ |
618 IMAGE_INSTANCE_WIDGET_ITEMS (i)) | 734 IMAGE_INSTANCE_WIDGET_ITEMS (i)) |
619 #define IMAGE_INSTANCE_WIDGET_TEXT(i) XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (i))->name | 735 #define IMAGE_INSTANCE_WIDGET_TEXT(i) XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (i))->name |
620 | 736 |
621 #define IMAGE_INSTANCE_LAYOUT_CHILDREN(i) ((i)->u.subwindow.items) | 737 /* Layout properties */ |
738 #define IMAGE_INSTANCE_LAYOUT_CHILDREN(i) ((i)->u.subwindow.children) | |
622 #define IMAGE_INSTANCE_LAYOUT_BORDER(i) ((i)->u.subwindow.props) | 739 #define IMAGE_INSTANCE_LAYOUT_BORDER(i) ((i)->u.subwindow.props) |
623 | 740 |
741 #define XIMAGE_INSTANCE_DOMAIN(i) \ | |
742 IMAGE_INSTANCE_DOMAIN (XIMAGE_INSTANCE (i)) | |
743 #define XIMAGE_INSTANCE_DOMAIN_LIVE_P(i) \ | |
744 IMAGE_INSTANCE_DOMAIN_LIVE_P (XIMAGE_INSTANCE (i)) | |
624 #define XIMAGE_INSTANCE_DEVICE(i) \ | 745 #define XIMAGE_INSTANCE_DEVICE(i) \ |
625 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i)) | 746 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i)) |
747 #define XIMAGE_INSTANCE_FRAME(i) \ | |
748 IMAGE_INSTANCE_FRAME (XIMAGE_INSTANCE (i)) | |
626 #define XIMAGE_INSTANCE_NAME(i) \ | 749 #define XIMAGE_INSTANCE_NAME(i) \ |
627 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i)) | 750 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i)) |
628 #define XIMAGE_INSTANCE_GLYPH(i) \ | 751 #define XIMAGE_INSTANCE_GLYPH(i) \ |
629 IMAGE_INSTANCE_GLYPH (XIMAGE_INSTANCE (i)) | 752 IMAGE_INSTANCE_GLYPH (XIMAGE_INSTANCE (i)) |
753 #define XIMAGE_INSTANCE_PARENT(i) \ | |
754 IMAGE_INSTANCE_PARENT (XIMAGE_INSTANCE (i)) | |
755 #define XIMAGE_INSTANCE_INSTANTIATOR(i) \ | |
756 IMAGE_INSTANCE_INSTANTIATOR (XIMAGE_INSTANCE (i)) | |
630 #define XIMAGE_INSTANCE_TYPE(i) \ | 757 #define XIMAGE_INSTANCE_TYPE(i) \ |
631 IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (i)) | 758 IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (i)) |
759 #define XIMAGE_INSTANCE_DISPLAY_HASH(i) \ | |
760 IMAGE_INSTANCE_DISPLAY_HASH (XIMAGE_INSTANCE (i)) | |
632 #define XIMAGE_INSTANCE_XOFFSET(i) \ | 761 #define XIMAGE_INSTANCE_XOFFSET(i) \ |
633 IMAGE_INSTANCE_XOFFSET (XIMAGE_INSTANCE (i)) | 762 IMAGE_INSTANCE_XOFFSET (XIMAGE_INSTANCE (i)) |
634 #define XIMAGE_INSTANCE_YOFFSET(i) \ | 763 #define XIMAGE_INSTANCE_YOFFSET(i) \ |
635 IMAGE_INSTANCE_YOFFSET (XIMAGE_INSTANCE (i)) | 764 IMAGE_INSTANCE_YOFFSET (XIMAGE_INSTANCE (i)) |
636 #define XIMAGE_INSTANCE_DIRTYP(i) \ | 765 #define XIMAGE_INSTANCE_DIRTYP(i) \ |
637 IMAGE_INSTANCE_DIRTYP (XIMAGE_INSTANCE (i)) | 766 IMAGE_INSTANCE_DIRTYP (XIMAGE_INSTANCE (i)) |
767 #define XIMAGE_INSTANCE_NEEDS_LAYOUT(i) \ | |
768 IMAGE_INSTANCE_NEEDS_LAYOUT (XIMAGE_INSTANCE (i)) | |
638 #define XIMAGE_INSTANCE_WIDTH(i) \ | 769 #define XIMAGE_INSTANCE_WIDTH(i) \ |
639 IMAGE_INSTANCE_WIDTH (XIMAGE_INSTANCE (i)) | 770 IMAGE_INSTANCE_WIDTH (XIMAGE_INSTANCE (i)) |
771 #define XIMAGE_INSTANCE_MARGIN_WIDTH(i) \ | |
772 IMAGE_INSTANCE_MARGIN_WIDTH (XIMAGE_INSTANCE (i)) | |
640 #define XIMAGE_INSTANCE_HEIGHT(i) \ | 773 #define XIMAGE_INSTANCE_HEIGHT(i) \ |
641 IMAGE_INSTANCE_HEIGHT (XIMAGE_INSTANCE (i)) | 774 IMAGE_INSTANCE_HEIGHT (XIMAGE_INSTANCE (i)) |
775 #define XIMAGE_INSTANCE_INITIALIZED(i) \ | |
776 IMAGE_INSTANCE_INITIALIZED (XIMAGE_INSTANCE (i)) | |
642 #define XIMAGE_INSTANCE_FACE(i) \ | 777 #define XIMAGE_INSTANCE_FACE(i) \ |
643 IMAGE_INSTANCE_FACE (XIMAGE_INSTANCE (i)) | 778 IMAGE_INSTANCE_FACE (XIMAGE_INSTANCE (i)) |
644 | 779 |
645 #define XIMAGE_INSTANCE_TEXT_STRING(i) \ | 780 #define XIMAGE_INSTANCE_TEXT_STRING(i) \ |
646 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i)) | 781 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i)) |
682 | 817 |
683 #define XIMAGE_INSTANCE_WIDGET_WIDTH(i) \ | 818 #define XIMAGE_INSTANCE_WIDGET_WIDTH(i) \ |
684 IMAGE_INSTANCE_WIDGET_WIDTH (XIMAGE_INSTANCE (i)) | 819 IMAGE_INSTANCE_WIDGET_WIDTH (XIMAGE_INSTANCE (i)) |
685 #define XIMAGE_INSTANCE_WIDGET_HEIGHT(i) \ | 820 #define XIMAGE_INSTANCE_WIDGET_HEIGHT(i) \ |
686 IMAGE_INSTANCE_WIDGET_HEIGHT (XIMAGE_INSTANCE (i)) | 821 IMAGE_INSTANCE_WIDGET_HEIGHT (XIMAGE_INSTANCE (i)) |
822 #define XIMAGE_INSTANCE_WIDGET_WIDTH_SUBR(i) \ | |
823 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (XIMAGE_INSTANCE (i)) | |
824 #define XIMAGE_INSTANCE_WIDGET_HEIGHT_SUBR(i) \ | |
825 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (XIMAGE_INSTANCE (i)) | |
687 #define XIMAGE_INSTANCE_WIDGET_TYPE(i) \ | 826 #define XIMAGE_INSTANCE_WIDGET_TYPE(i) \ |
688 IMAGE_INSTANCE_WIDGET_TYPE (XIMAGE_INSTANCE (i)) | 827 IMAGE_INSTANCE_WIDGET_TYPE (XIMAGE_INSTANCE (i)) |
689 #define XIMAGE_INSTANCE_WIDGET_PROPS(i) \ | 828 #define XIMAGE_INSTANCE_WIDGET_PROPS(i) \ |
690 IMAGE_INSTANCE_WIDGET_PROPS (XIMAGE_INSTANCE (i)) | 829 IMAGE_INSTANCE_WIDGET_PROPS (XIMAGE_INSTANCE (i)) |
691 #define XIMAGE_INSTANCE_WIDGET_FACE(i) \ | 830 #define XIMAGE_INSTANCE_WIDGET_FACE(i) \ |
694 SET_IMAGE_INSTANCE_WIDGET_FACE (XIMAGE_INSTANCE (i)) | 833 SET_IMAGE_INSTANCE_WIDGET_FACE (XIMAGE_INSTANCE (i)) |
695 #define XIMAGE_INSTANCE_WIDGET_ITEM(i) \ | 834 #define XIMAGE_INSTANCE_WIDGET_ITEM(i) \ |
696 IMAGE_INSTANCE_WIDGET_ITEM (XIMAGE_INSTANCE (i)) | 835 IMAGE_INSTANCE_WIDGET_ITEM (XIMAGE_INSTANCE (i)) |
697 #define XIMAGE_INSTANCE_WIDGET_ITEMS(i) \ | 836 #define XIMAGE_INSTANCE_WIDGET_ITEMS(i) \ |
698 IMAGE_INSTANCE_WIDGET_ITEMS (XIMAGE_INSTANCE (i)) | 837 IMAGE_INSTANCE_WIDGET_ITEMS (XIMAGE_INSTANCE (i)) |
838 #define XIMAGE_INSTANCE_WIDGET_PENDING_ITEMS(i) \ | |
839 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (XIMAGE_INSTANCE (i)) | |
699 #define XIMAGE_INSTANCE_WIDGET_TEXT(i) \ | 840 #define XIMAGE_INSTANCE_WIDGET_TEXT(i) \ |
700 IMAGE_INSTANCE_WIDGET_TEXT (XIMAGE_INSTANCE (i)) | 841 IMAGE_INSTANCE_WIDGET_TEXT (XIMAGE_INSTANCE (i)) |
842 #define XIMAGE_INSTANCE_WIDGET_ACTION_OCCURRED(i) \ | |
843 IMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (XIMAGE_INSTANCE (i)) | |
701 | 844 |
702 #define XIMAGE_INSTANCE_LAYOUT_CHILDREN(i) \ | 845 #define XIMAGE_INSTANCE_LAYOUT_CHILDREN(i) \ |
703 IMAGE_INSTANCE_LAYOUT_CHILDREN (XIMAGE_INSTANCE (i)) | 846 IMAGE_INSTANCE_LAYOUT_CHILDREN (XIMAGE_INSTANCE (i)) |
704 #define XIMAGE_INSTANCE_LAYOUT_BORDER(i) \ | 847 #define XIMAGE_INSTANCE_LAYOUT_BORDER(i) \ |
705 IMAGE_INSTANCE_LAYOUT_BORDER (XIMAGE_INSTANCE (i)) | 848 IMAGE_INSTANCE_LAYOUT_BORDER (XIMAGE_INSTANCE (i)) |
706 | 849 |
707 #define XIMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \ | |
708 IMAGE_INSTANCE_SUBWINDOW_WIDTH (XIMAGE_INSTANCE (i)) | |
709 #define XIMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \ | |
710 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (XIMAGE_INSTANCE (i)) | |
711 #define XIMAGE_INSTANCE_SUBWINDOW_ID(i) \ | 850 #define XIMAGE_INSTANCE_SUBWINDOW_ID(i) \ |
712 IMAGE_INSTANCE_SUBWINDOW_ID (XIMAGE_INSTANCE (i)) | 851 IMAGE_INSTANCE_SUBWINDOW_ID (XIMAGE_INSTANCE (i)) |
713 #define XIMAGE_INSTANCE_SUBWINDOW_FRAME(i) \ | 852 #define XIMAGE_INSTANCE_DISPLAY_X(i) \ |
714 IMAGE_INSTANCE_SUBWINDOW_FRAME (XIMAGE_INSTANCE (i)) | 853 IMAGE_INSTANCE_DISPLAY_X (XIMAGE_INSTANCE (i)) |
854 #define XIMAGE_INSTANCE_DISPLAY_Y(i) \ | |
855 IMAGE_INSTANCE_DISPLAY_Y (XIMAGE_INSTANCE (i)) | |
856 #define XIMAGE_INSTANCE_DISPLAY_WIDTH(i) \ | |
857 IMAGE_INSTANCE_DISPLAY_WIDTH (XIMAGE_INSTANCE (i)) | |
858 #define XIMAGE_INSTANCE_DISPLAY_HEIGHT(i) \ | |
859 IMAGE_INSTANCE_DISPLAY_HEIGHT (XIMAGE_INSTANCE (i)) | |
715 #define XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ | 860 #define XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ |
716 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (XIMAGE_INSTANCE (i)) | 861 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (XIMAGE_INSTANCE (i)) |
717 #define XIMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \ | 862 #define XIMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \ |
718 IMAGE_INSTANCE_SUBWINDOW_ORIENT (XIMAGE_INSTANCE (i)) | 863 IMAGE_INSTANCE_SUBWINDOW_ORIENT (XIMAGE_INSTANCE (i)) |
719 #define XIMAGE_INSTANCE_SUBWINDOW_JUSTIFY(i) \ | 864 #define XIMAGE_INSTANCE_SUBWINDOW_JUSTIFY(i) \ |
720 IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (XIMAGE_INSTANCE (i)) | 865 IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (XIMAGE_INSTANCE (i)) |
866 #define XIMAGE_INSTANCE_SUBWINDOW_FACE(i) \ | |
867 IMAGE_INSTANCE_SUBWINDOW_FACE (XIMAGE_INSTANCE (i)) | |
721 | 868 |
722 #define MARK_IMAGE_INSTANCE_CHANGED(i) \ | 869 #define MARK_IMAGE_INSTANCE_CHANGED(i) \ |
723 (IMAGE_INSTANCE_DIRTYP (i) = 1); | 870 (IMAGE_INSTANCE_DIRTYP (i) = 1); |
871 | |
872 Lisp_Object image_instance_device (Lisp_Object instance); | |
873 Lisp_Object image_instance_frame (Lisp_Object instance); | |
874 Lisp_Object image_instance_window (Lisp_Object instance); | |
875 int image_instance_live_p (Lisp_Object instance); | |
724 | 876 |
725 #ifdef HAVE_XPM | 877 #ifdef HAVE_XPM |
726 Lisp_Object evaluate_xpm_color_symbols (void); | 878 Lisp_Object evaluate_xpm_color_symbols (void); |
727 Lisp_Object pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid); | 879 Lisp_Object pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid); |
728 #endif /* HAVE_XPM */ | 880 #endif /* HAVE_XPM */ |
729 #ifdef HAVE_WINDOW_SYSTEM | 881 #ifdef HAVE_WINDOW_SYSTEM |
730 Lisp_Object bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot, | 882 Lisp_Object bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot, |
731 int ok_if_data_invalid); | 883 int ok_if_data_invalid); |
732 int read_bitmap_data_from_file (CONST char *filename, unsigned int *width, | 884 int read_bitmap_data_from_file (const char *filename, unsigned int *width, |
733 unsigned int *height, unsigned char **datap, | 885 unsigned int *height, unsigned char **datap, |
734 int *x_hot, int *y_hot); | 886 int *x_hot, int *y_hot); |
735 Lisp_Object xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file, | 887 Lisp_Object xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file, |
736 Lisp_Object mask_file, | 888 Lisp_Object mask_file, |
737 Lisp_Object console_type); | 889 Lisp_Object console_type); |
817 extern Lisp_Object Qxbm, Qedit_field, Qgroup, Qlabel, Qcombo_box, Qscrollbar; | 969 extern Lisp_Object Qxbm, Qedit_field, Qgroup, Qlabel, Qcombo_box, Qscrollbar; |
818 extern Lisp_Object Qtree_view, Qtab_control, Qprogress_gauge, Q_border; | 970 extern Lisp_Object Qtree_view, Qtab_control, Qprogress_gauge, Q_border; |
819 extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y; | 971 extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y; |
820 extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group; | 972 extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group; |
821 extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text; | 973 extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text; |
822 extern Lisp_Object Q_items, Q_properties, Q_image, Q_percent, Qimage_conversion_error; | 974 extern Lisp_Object Q_items, Q_properties, Q_image, Qimage_conversion_error; |
823 extern Lisp_Object Q_orientation; | 975 extern Lisp_Object Q_orientation, Q_margin_width; |
824 extern Lisp_Object Vcontinuation_glyph, Vcontrol_arrow_glyph, Vhscroll_glyph; | 976 extern Lisp_Object Vcontinuation_glyph, Vcontrol_arrow_glyph, Vhscroll_glyph; |
825 extern Lisp_Object Vinvisible_text_glyph, Voctal_escape_glyph, Vtruncation_glyph; | 977 extern Lisp_Object Vinvisible_text_glyph, Voctal_escape_glyph, Vtruncation_glyph; |
826 extern Lisp_Object Vxemacs_logo; | 978 extern Lisp_Object Vxemacs_logo; |
979 | |
827 | 980 |
828 unsigned short glyph_width (Lisp_Object glyph, Lisp_Object domain); | 981 unsigned short glyph_width (Lisp_Object glyph, Lisp_Object domain); |
829 unsigned short glyph_ascent (Lisp_Object glyph, Lisp_Object domain); | 982 unsigned short glyph_ascent (Lisp_Object glyph, Lisp_Object domain); |
830 unsigned short glyph_descent (Lisp_Object glyph, Lisp_Object domain); | 983 unsigned short glyph_descent (Lisp_Object glyph, Lisp_Object domain); |
831 unsigned short glyph_height (Lisp_Object glyph, Lisp_Object domain); | 984 unsigned short glyph_height (Lisp_Object glyph, Lisp_Object domain); |
841 Lisp_Object tagged_vector_to_alist (Lisp_Object vector); | 994 Lisp_Object tagged_vector_to_alist (Lisp_Object vector); |
842 Lisp_Object alist_to_tagged_vector (Lisp_Object tag, Lisp_Object alist); | 995 Lisp_Object alist_to_tagged_vector (Lisp_Object tag, Lisp_Object alist); |
843 void string_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 996 void string_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
844 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 997 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
845 int dest_mask, Lisp_Object domain); | 998 int dest_mask, Lisp_Object domain); |
999 int tab_control_order_only_changed (Lisp_Object image_instance); | |
846 Lisp_Object allocate_glyph (enum glyph_type type, | 1000 Lisp_Object allocate_glyph (enum glyph_type type, |
847 void (*after_change) (Lisp_Object glyph, | 1001 void (*after_change) (Lisp_Object glyph, |
848 Lisp_Object property, | 1002 Lisp_Object property, |
849 Lisp_Object locale)); | 1003 Lisp_Object locale)); |
1004 Lisp_Object normalize_image_instantiator (Lisp_Object instantiator, | |
1005 Lisp_Object contype, | |
1006 Lisp_Object dest_mask); | |
1007 void glyph_query_geometry (Lisp_Object glyph_or_image, int* width, int* height, | |
1008 enum image_instance_geometry disp, | |
1009 Lisp_Object domain); | |
1010 void glyph_do_layout (Lisp_Object glyph_or_image, int width, int height, | |
1011 int xoffset, int yoffset, | |
1012 Lisp_Object domain); | |
850 void query_string_geometry ( Lisp_Object string, Lisp_Object face, | 1013 void query_string_geometry ( Lisp_Object string, Lisp_Object face, |
851 unsigned int* width, unsigned int* height, | 1014 int* width, int* height, int* descent, |
852 unsigned int* descent, Lisp_Object domain); | 1015 Lisp_Object domain); |
853 Lisp_Object query_string_font (Lisp_Object string, | 1016 Lisp_Object query_string_font (Lisp_Object string, |
854 Lisp_Object face, Lisp_Object domain); | 1017 Lisp_Object face, Lisp_Object domain); |
855 Lisp_Object add_glyph_animated_timeout (EMACS_INT tickms, Lisp_Object device); | 1018 Lisp_Object add_glyph_animated_timeout (EMACS_INT tickms, Lisp_Object device); |
856 void disable_glyph_animated_timeout (int i); | 1019 void disable_glyph_animated_timeout (int i); |
857 | 1020 |
882 #define HSCROLL_GLYPH_INDEX (glyph_index) 2 | 1045 #define HSCROLL_GLYPH_INDEX (glyph_index) 2 |
883 #define CONTROL_GLYPH_INDEX (glyph_index) 3 | 1046 #define CONTROL_GLYPH_INDEX (glyph_index) 3 |
884 #define OCT_ESC_GLYPH_INDEX (glyph_index) 4 | 1047 #define OCT_ESC_GLYPH_INDEX (glyph_index) 4 |
885 #define INVIS_GLYPH_INDEX (glyph_index) 5 | 1048 #define INVIS_GLYPH_INDEX (glyph_index) 5 |
886 | 1049 |
887 #define GLYPH_CACHEL(window, index) \ | 1050 #ifdef ERROR_CHECK_GLYPHS |
888 Dynarr_atp (window->glyph_cachels, index) | 1051 |
889 #define GLYPH_CACHEL_GLYPH(window, index) \ | 1052 #include "window.h" |
890 Dynarr_atp (window->glyph_cachels, index)->glyph | 1053 |
891 #define GLYPH_CACHEL_WIDTH(window, index) \ | 1054 INLINE_HEADER int |
892 Dynarr_atp (window->glyph_cachels, index)->width | 1055 GLYPH_CACHEL_WIDTH (struct window *window, int ind); |
893 #define GLYPH_CACHEL_ASCENT(window, index) \ | 1056 INLINE_HEADER int |
894 Dynarr_atp (window->glyph_cachels, index)->ascent | 1057 GLYPH_CACHEL_WIDTH (struct window *window, int ind) |
895 #define GLYPH_CACHEL_DESCENT(window, index) \ | 1058 { |
896 Dynarr_atp (window->glyph_cachels, index)->descent | 1059 int wid = Dynarr_atp (window->glyph_cachels, ind)->width; |
897 #define GLYPH_CACHEL_DIRTYP(window, index) \ | 1060 assert (wid >= 0 && wid < 10000); |
898 Dynarr_atp (window->glyph_cachels, index)->dirty | 1061 return wid; |
1062 } | |
1063 INLINE_HEADER int | |
1064 GLYPH_CACHEL_ASCENT (struct window *window, int ind); | |
1065 INLINE_HEADER int | |
1066 GLYPH_CACHEL_ASCENT (struct window *window, int ind) | |
1067 { | |
1068 int wid = Dynarr_atp (window->glyph_cachels, ind)->ascent; | |
1069 assert (wid >= 0 && wid < 10000); | |
1070 return wid; | |
1071 } | |
1072 INLINE_HEADER int | |
1073 GLYPH_CACHEL_DESCENT (struct window *window, int ind); | |
1074 INLINE_HEADER int | |
1075 GLYPH_CACHEL_DESCENT (struct window *window, int ind) | |
1076 { | |
1077 int wid = Dynarr_atp (window->glyph_cachels, ind)->descent; | |
1078 assert (wid >= 0 && wid < 10000); | |
1079 return wid; | |
1080 } | |
1081 | |
1082 #else /* not ERROR_CHECK_GLYPHS */ | |
1083 | |
1084 #define GLYPH_CACHEL_WIDTH(window, ind) \ | |
1085 Dynarr_atp (window->glyph_cachels, ind)->width | |
1086 #define GLYPH_CACHEL_ASCENT(window, ind) \ | |
1087 Dynarr_atp (window->glyph_cachels, ind)->ascent | |
1088 #define GLYPH_CACHEL_DESCENT(window, ind) \ | |
1089 Dynarr_atp (window->glyph_cachels, ind)->descent | |
1090 | |
1091 #endif /* not ERROR_CHECK_GLYPHS */ | |
1092 | |
1093 #define GLYPH_CACHEL(window, ind) \ | |
1094 Dynarr_atp (window->glyph_cachels, ind) | |
1095 #define GLYPH_CACHEL_GLYPH(window, ind) \ | |
1096 Dynarr_atp (window->glyph_cachels, ind)->glyph | |
1097 #define GLYPH_CACHEL_DIRTYP(window, ind) \ | |
1098 Dynarr_atp (window->glyph_cachels, ind)->dirty | |
899 | 1099 |
900 void mark_glyph_cachels (glyph_cachel_dynarr *elements); | 1100 void mark_glyph_cachels (glyph_cachel_dynarr *elements); |
901 void mark_glyph_cachels_as_not_updated (struct window *w); | 1101 void mark_glyph_cachels_as_not_updated (struct window *w); |
902 void mark_glyph_cachels_as_clean (struct window *w); | 1102 void mark_glyph_cachels_as_clean (struct window *w); |
903 void reset_glyph_cachels (struct window *w); | 1103 void reset_glyph_cachels (struct window *w); |
918 | 1118 |
919 /**************************************************************************** | 1119 /**************************************************************************** |
920 * Subwindow Object * | 1120 * Subwindow Object * |
921 ****************************************************************************/ | 1121 ****************************************************************************/ |
922 | 1122 |
923 /* redisplay needs a per-frame cache of subwindows being displayed so | |
924 * that we known when to unmap them */ | |
925 typedef struct subwindow_cachel subwindow_cachel; | |
926 struct subwindow_cachel | |
927 { | |
928 Lisp_Object subwindow; | |
929 unsigned int x, y; | |
930 unsigned int width, height; | |
931 unsigned int being_displayed : 1; | |
932 unsigned int updated : 1; | |
933 }; | |
934 | |
935 typedef struct | |
936 { | |
937 Dynarr_declare (subwindow_cachel); | |
938 } subwindow_cachel_dynarr; | |
939 | |
940 void mark_subwindow_cachels (subwindow_cachel_dynarr *elements); | |
941 void mark_subwindow_cachels_as_not_updated (struct frame *f); | |
942 void reset_subwindow_cachels (struct frame *f); | |
943 void unmap_subwindow (Lisp_Object subwindow); | 1123 void unmap_subwindow (Lisp_Object subwindow); |
944 void map_subwindow (Lisp_Object subwindow, int x, int y, | 1124 void map_subwindow (Lisp_Object subwindow, int x, int y, |
945 struct display_glyph_area *dga); | 1125 struct display_glyph_area *dga); |
946 void update_frame_subwindows (struct frame *f); | |
947 int find_matching_subwindow (struct frame* f, int x, int y, int width, int height); | 1126 int find_matching_subwindow (struct frame* f, int x, int y, int width, int height); |
1127 void redisplay_widget (Lisp_Object widget); | |
1128 void update_widget_instances (Lisp_Object frame); | |
1129 void redisplay_subwindow (Lisp_Object subwindow); | |
1130 Lisp_Object image_instance_parent_glyph (struct Lisp_Image_Instance*); | |
1131 int image_instance_changed (Lisp_Object image); | |
1132 void free_frame_subwindow_instances (struct frame* f); | |
1133 void reset_frame_subwindow_instance_cache (struct frame* f); | |
1134 int unmap_subwindow_instance_cache_mapper (Lisp_Object key, | |
1135 Lisp_Object value, void* finalize); | |
948 | 1136 |
949 struct expose_ignore | 1137 struct expose_ignore |
950 { | 1138 { |
951 unsigned int x, y; | 1139 unsigned int x, y; |
952 unsigned int width, height; | 1140 unsigned int width, height; |