Mercurial > hg > xemacs-beta
comparison src/glyphs.h @ 408:501cfd01ee6d r21-2-34
Import from CVS: tag r21-2-34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:18:11 +0200 |
parents | b8cc9ab3f761 |
children | de805c49cfc1 |
comparison
equal
deleted
inserted
replaced
407:ed6218a7d4d3 | 408:501cfd01ee6d |
---|---|
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 |
94 }; | 96 }; |
95 | 97 |
96 #define WIDGET_BORDER_HEIGHT 4 | 98 #define WIDGET_BORDER_HEIGHT 4 |
97 #define WIDGET_BORDER_WIDTH 4 | 99 #define WIDGET_BORDER_WIDTH 4 |
98 | 100 |
101 enum governing_domain | |
102 { | |
103 GOVERNING_DOMAIN_WINDOW, | |
104 GOVERNING_DOMAIN_FRAME, | |
105 GOVERNING_DOMAIN_DEVICE | |
106 }; | |
107 | |
99 struct image_instantiator_methods | 108 struct image_instantiator_methods |
100 { | 109 { |
101 Lisp_Object symbol; | 110 Lisp_Object symbol; |
102 | 111 |
103 Lisp_Object device; /* sometimes used */ | 112 Lisp_Object device; /* sometimes used */ |
117 /* Normalize method: Given an instantiator, convert it to the form | 126 /* Normalize method: Given an instantiator, convert it to the form |
118 that should be used in a glyph, for devices of type CONSOLE_TYPE. | 127 that should be used in a glyph, for devices of type CONSOLE_TYPE. |
119 Signal an error if conversion fails. */ | 128 Signal an error if conversion fails. */ |
120 Lisp_Object (*normalize_method) (Lisp_Object instantiator, | 129 Lisp_Object (*normalize_method) (Lisp_Object instantiator, |
121 Lisp_Object console_type); | 130 Lisp_Object console_type); |
131 | |
132 /* Governing domain method: Return an int indicating what type of | |
133 domain an instance in this format is governed by. */ | |
134 int (*governing_domain_method) (void); | |
122 | 135 |
123 /* Possible-dest-types method: Return a mask indicating what dest types | 136 /* Possible-dest-types method: Return a mask indicating what dest types |
124 are compatible with this format. */ | 137 are compatible with this format. */ |
125 int (*possible_dest_types_method) (void); | 138 int (*possible_dest_types_method) (void); |
126 | 139 |
132 Lisp_Object instantiator, | 145 Lisp_Object instantiator, |
133 Lisp_Object pointer_fg, | 146 Lisp_Object pointer_fg, |
134 Lisp_Object pointer_bg, | 147 Lisp_Object pointer_bg, |
135 int dest_mask, | 148 int dest_mask, |
136 Lisp_Object domain); | 149 Lisp_Object domain); |
150 /* Post instantiate method: finish instantiation of the image | |
151 instance. */ | |
152 void (*post_instantiate_method) (Lisp_Object image_instance, | |
153 Lisp_Object instantiator, | |
154 Lisp_Object domain); | |
137 /* Property method: Given an image instance, return device specific | 155 /* Property method: Given an image instance, return device specific |
138 properties. */ | 156 properties. */ |
139 Lisp_Object (*property_method) (Lisp_Object image_instance, | 157 Lisp_Object (*property_method) (Lisp_Object image_instance, |
140 Lisp_Object property); | 158 Lisp_Object property); |
141 /* Set-property method: Given an image instance, set device specific | 159 /* Set-property method: Given an image instance, set device specific |
153 unsigned int* width, unsigned int* height, | 171 unsigned int* width, unsigned int* height, |
154 enum image_instance_geometry disp, | 172 enum image_instance_geometry disp, |
155 Lisp_Object domain); | 173 Lisp_Object domain); |
156 | 174 |
157 /* Layout the instance and its children bounded by the provided | 175 /* Layout the instance and its children bounded by the provided |
158 dimensions. */ | 176 dimensions. Returns success or failure. */ |
159 void (*layout_method) (Lisp_Object image_instance, | 177 int (*layout_method) (Lisp_Object image_instance, |
160 unsigned int width, unsigned int height, | 178 unsigned int width, unsigned int height, |
161 Lisp_Object domain); | 179 Lisp_Object domain); |
162 }; | 180 }; |
163 | 181 |
164 /***** Calling an image-instantiator method *****/ | 182 /***** Calling an image-instantiator method *****/ |
165 | 183 |
166 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0) | 184 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0) |
185 | 203 |
186 /* Call a specifier method, if it exists; otherwise return | 204 /* Call a specifier method, if it exists; otherwise return |
187 the specified value */ | 205 the specified value */ |
188 | 206 |
189 #define IIFORMAT_METH_OR_GIVEN(mstruc, m, args, given) \ | 207 #define IIFORMAT_METH_OR_GIVEN(mstruc, m, args, given) \ |
190 (HAS_IIFORMAT_METH_P (mstruc, m) ? \ | 208 ((mstruc && HAS_IIFORMAT_METH_P (mstruc, m)) ? \ |
191 IIFORMAT_METH (mstruc, m, args) : (given)) | 209 IIFORMAT_METH (mstruc, m, args) : (given)) |
192 | 210 |
193 /***** Defining new image-instantiator types *****/ | 211 /***** Defining new image-instantiator types *****/ |
194 | 212 |
195 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \ | 213 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \ |
334 | 352 |
335 void initialize_subwindow_image_instance (Lisp_Image_Instance*); | 353 void initialize_subwindow_image_instance (Lisp_Image_Instance*); |
336 void subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 354 void subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
337 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 355 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
338 int dest_mask, Lisp_Object domain); | 356 int dest_mask, Lisp_Object domain); |
357 int subwindow_governing_domain (void); | |
339 void widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 358 void widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
340 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 359 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
341 int dest_mask, Lisp_Object domain); | 360 int dest_mask, Lisp_Object domain); |
342 void image_instance_query_geometry (Lisp_Object image_instance, | 361 void image_instance_query_geometry (Lisp_Object image_instance, |
343 unsigned int* width, unsigned int* height, | 362 unsigned int* width, unsigned int* height, |
344 enum image_instance_geometry disp, | 363 enum image_instance_geometry disp, |
345 Lisp_Object domain); | 364 Lisp_Object domain); |
346 void image_instance_layout (Lisp_Object image_instance, | 365 void image_instance_layout (Lisp_Object image_instance, |
347 unsigned int width, unsigned int height, | 366 unsigned int width, unsigned int height, |
348 Lisp_Object domain); | 367 Lisp_Object domain); |
368 int layout_layout (Lisp_Object image_instance, | |
369 unsigned int width, unsigned int height, | |
370 Lisp_Object domain); | |
349 int invalidate_glyph_geometry_maybe (Lisp_Object glyph_or_ii, struct window* w); | 371 int invalidate_glyph_geometry_maybe (Lisp_Object glyph_or_ii, struct window* w); |
350 | 372 |
351 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator, | 373 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator, |
352 int given_dest_mask, | 374 int given_dest_mask, |
353 int desired_dest_mask)); | 375 int desired_dest_mask)); |
392 #define XIMAGE_INSTANCE(x) XRECORD (x, image_instance, Lisp_Image_Instance) | 414 #define XIMAGE_INSTANCE(x) XRECORD (x, image_instance, Lisp_Image_Instance) |
393 #define XSETIMAGE_INSTANCE(x, p) XSETRECORD (x, p, image_instance) | 415 #define XSETIMAGE_INSTANCE(x, p) XSETRECORD (x, p, image_instance) |
394 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance) | 416 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance) |
395 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance) | 417 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance) |
396 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance) | 418 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance) |
419 | |
420 #ifdef ERROR_CHECK_GLYPHS | |
421 void check_image_instance_structure (Lisp_Object instance); | |
422 void check_window_subwindow_cache (struct window* w); | |
423 #define ERROR_CHECK_IMAGE_INSTANCE(ii) \ | |
424 check_image_instance_structure (ii) | |
425 #define ERROR_CHECK_SUBWINDOW_CACHE(w) \ | |
426 check_window_subwindow_cache (w) | |
427 #else | |
428 #define ERROR_CHECK_IMAGE_INSTANCE(ii) | |
429 #define ERROR_CHECK_SUBWINDOW_CACHE(w) | |
430 #endif | |
397 | 431 |
398 enum image_instance_type | 432 enum image_instance_type |
399 { | 433 { |
400 IMAGE_UNKNOWN, | 434 IMAGE_UNKNOWN, |
401 IMAGE_NOTHING, | 435 IMAGE_NOTHING, |
402 IMAGE_TEXT, | 436 IMAGE_TEXT, |
403 IMAGE_MONO_PIXMAP, | 437 IMAGE_MONO_PIXMAP, |
404 IMAGE_COLOR_PIXMAP, | 438 IMAGE_COLOR_PIXMAP, |
405 IMAGE_POINTER, | 439 IMAGE_POINTER, |
406 IMAGE_SUBWINDOW, | 440 IMAGE_SUBWINDOW, |
407 IMAGE_WIDGET, | 441 IMAGE_WIDGET |
408 IMAGE_LAYOUT | |
409 }; | 442 }; |
410 | 443 |
411 #define IMAGE_NOTHING_MASK (1 << 0) | 444 #define IMAGE_NOTHING_MASK (1 << 0) |
412 #define IMAGE_TEXT_MASK (1 << 1) | 445 #define IMAGE_TEXT_MASK (1 << 1) |
413 #define IMAGE_MONO_PIXMAP_MASK (1 << 2) | 446 #define IMAGE_MONO_PIXMAP_MASK (1 << 2) |
414 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3) | 447 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3) |
415 #define IMAGE_POINTER_MASK (1 << 4) | 448 #define IMAGE_POINTER_MASK (1 << 4) |
416 #define IMAGE_SUBWINDOW_MASK (1 << 5) | 449 #define IMAGE_SUBWINDOW_MASK (1 << 5) |
417 #define IMAGE_WIDGET_MASK (1 << 6) | 450 #define IMAGE_WIDGET_MASK (1 << 6) |
418 #define IMAGE_LAYOUT_MASK (1 << 7) | 451 |
452 /* This depends on the fact that enums are assigned consecutive | |
453 integers starting at 0. (Remember that IMAGE_UNKNOWN is the | |
454 first enum.) I'm fairly sure this behavior is ANSI-mandated, | |
455 so there should be no portability problems here. */ | |
456 #define image_instance_type_to_mask(type) \ | |
457 ((int) (1 << ((int) (type) - 1))) | |
419 | 458 |
420 #define IMAGE_INSTANCE_TYPE_P(ii, type) \ | 459 #define IMAGE_INSTANCE_TYPE_P(ii, type) \ |
421 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type) | 460 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type) |
422 | 461 |
423 #define NOTHING_IMAGE_INSTANCEP(ii) \ | 462 #define NOTHING_IMAGE_INSTANCEP(ii) \ |
432 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER) | 471 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER) |
433 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \ | 472 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \ |
434 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW) | 473 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW) |
435 #define WIDGET_IMAGE_INSTANCEP(ii) \ | 474 #define WIDGET_IMAGE_INSTANCEP(ii) \ |
436 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_WIDGET) | 475 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_WIDGET) |
437 #define LAYOUT_IMAGE_INSTANCEP(ii) \ | |
438 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_LAYOUT) | |
439 | 476 |
440 #define CHECK_NOTHING_IMAGE_INSTANCE(x) do { \ | 477 #define CHECK_NOTHING_IMAGE_INSTANCE(x) do { \ |
441 CHECK_IMAGE_INSTANCE (x); \ | 478 CHECK_IMAGE_INSTANCE (x); \ |
442 if (!NOTHING_IMAGE_INSTANCEP (x)) \ | 479 if (!NOTHING_IMAGE_INSTANCEP (x)) \ |
443 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \ | 480 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \ |
478 CHECK_IMAGE_INSTANCE (x); \ | 515 CHECK_IMAGE_INSTANCE (x); \ |
479 if (!WIDGET_IMAGE_INSTANCEP (x)) \ | 516 if (!WIDGET_IMAGE_INSTANCEP (x)) \ |
480 x = wrong_type_argument (Qwidget_image_instance_p, (x)); \ | 517 x = wrong_type_argument (Qwidget_image_instance_p, (x)); \ |
481 } while (0) | 518 } while (0) |
482 | 519 |
483 #define CHECK_LAYOUT_IMAGE_INSTANCE(x) do { \ | |
484 CHECK_IMAGE_INSTANCE (x); \ | |
485 if (!LAYOUT_IMAGE_INSTANCEP (x)) \ | |
486 x = wrong_type_argument (Qlayout_image_instance_p, (x)); \ | |
487 } while (0) | |
488 | |
489 struct Lisp_Image_Instance | 520 struct Lisp_Image_Instance |
490 { | 521 { |
491 struct lcrecord_header header; | 522 struct lcrecord_header header; |
492 Lisp_Object device; | 523 Lisp_Object domain; /* The domain in which we were cached. */ |
524 Lisp_Object device; /* The device of the domain. Recorded | |
525 since the domain may get deleted | |
526 before us. */ | |
493 Lisp_Object name; | 527 Lisp_Object name; |
494 /* The glyph from which we were instantiated. This is a weak | 528 /* The glyph from which we were instantiated. This is a weak |
495 reference. */ | 529 reference. */ |
496 Lisp_Object parent; | 530 Lisp_Object parent; |
497 enum image_instance_type type; | 531 enum image_instance_type type; |
498 unsigned int x_offset, y_offset; /* for layout purposes */ | 532 unsigned int x_offset, y_offset; /* for layout purposes */ |
499 unsigned int width, height; | 533 unsigned int width, height, margin_width; |
500 unsigned long display_hash; /* Hash value representing the structure | 534 unsigned long display_hash; /* Hash value representing the structure |
501 of the image_instance when it was | 535 of the image_instance when it was |
502 last displayed. */ | 536 last displayed. */ |
503 unsigned int dirty : 1; | 537 unsigned int dirty : 1; |
504 unsigned int size_changed : 1; | 538 unsigned int size_changed : 1; |
505 unsigned int text_changed : 1; | 539 unsigned int text_changed : 1; |
506 unsigned int layout_changed : 1; | 540 unsigned int layout_changed : 1; |
507 unsigned int optimize_output : 1; /* For outputting layouts. */ | 541 unsigned int optimize_output : 1; /* For outputting layouts. */ |
542 unsigned int initialized : 1; /* When we're fully done. */ | |
508 | 543 |
509 union | 544 union |
510 { | 545 { |
511 struct | 546 struct |
512 { | 547 { |
527 to be seen from lisp */ | 562 to be seen from lisp */ |
528 void* mask; /* mask that can be seen from all windowing systems */ | 563 void* mask; /* mask that can be seen from all windowing systems */ |
529 } pixmap; /* used for pointers as well */ | 564 } pixmap; /* used for pointers as well */ |
530 struct | 565 struct |
531 { | 566 { |
532 Lisp_Object frame; | |
533 void* subwindow; /* specific devices can use this as necessary */ | 567 void* subwindow; /* specific devices can use this as necessary */ |
534 unsigned int being_displayed : 1; /* used to detect when needs to be unmapped */ | 568 struct |
569 { /* We need these so we can do without | |
570 subwindow_cachel */ | |
571 unsigned int x, y; | |
572 unsigned int width, height; | |
573 } display_data; | |
574 unsigned int being_displayed : 1; /* used to detect when needs | |
575 to be unmapped */ | |
535 unsigned int v_resize : 1; /* Whether the vsize is allowed to change. */ | 576 unsigned int v_resize : 1; /* Whether the vsize is allowed to change. */ |
536 unsigned int h_resize : 1; /* Whether the hsize is allowed to change. */ | 577 unsigned int h_resize : 1; /* Whether the hsize is allowed to change. */ |
537 unsigned int orientation : 1; /* Vertical or horizontal. */ | 578 unsigned int orientation : 1; /* Vertical or horizontal. */ |
538 unsigned int justification : 2; /* Left, right or center. */ | 579 unsigned int justification : 2; /* Left, right or center. */ |
539 /* Face for colors and font. We specify this here becuase we | 580 /* Face for colors and font. We specify this here because we |
540 want people to be able to put :face in the instantiator | 581 want people to be able to put :face in the instantiator |
541 spec. Using gyph-face is more inconvenient, although more | 582 spec. Using gyph-face is more inconvenient, although more |
542 general. */ | 583 general. */ |
543 Lisp_Object face; | 584 Lisp_Object face; |
544 Lisp_Object type; | 585 Lisp_Object type; |
545 Lisp_Object props; /* properties or border*/ | 586 Lisp_Object props; /* properties or border*/ |
546 Lisp_Object items; /* a list of gui_items or children */ | 587 Lisp_Object items; /* a list of displayed gui_items */ |
547 Lisp_Object pending_items; /* gui_items that should be displayed */ | 588 Lisp_Object pending_items; /* gui_items that should be displayed */ |
589 Lisp_Object children; /* a list of children */ | |
548 Lisp_Object width; /* dynamic width spec. */ | 590 Lisp_Object width; /* dynamic width spec. */ |
549 Lisp_Object height; /* dynamic height spec. */ | 591 Lisp_Object height; /* dynamic height spec. */ |
550 /* Change flags to augment dirty. */ | 592 /* Change flags to augment dirty. */ |
551 unsigned int face_changed : 1; | 593 unsigned int face_changed : 1; |
552 unsigned int items_changed : 1; | 594 unsigned int items_changed : 1; |
566 #define LAYOUT_JUSTIFY_CENTER 2 | 608 #define LAYOUT_JUSTIFY_CENTER 2 |
567 | 609 |
568 #define IMAGE_INSTANCE_HASH_DEPTH 0 | 610 #define IMAGE_INSTANCE_HASH_DEPTH 0 |
569 | 611 |
570 /* Accessor macros. */ | 612 /* Accessor macros. */ |
613 #define IMAGE_INSTANCE_DOMAIN(i) ((i)->domain) | |
614 #define IMAGE_INSTANCE_DOMAIN_LIVE_P(i) (DOMAIN_LIVE_P ((i)->domain)) | |
571 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device) | 615 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device) |
616 #define IMAGE_INSTANCE_FRAME(i) (DOMAIN_FRAME ((i)->domain)) | |
572 #define IMAGE_INSTANCE_NAME(i) ((i)->name) | 617 #define IMAGE_INSTANCE_NAME(i) ((i)->name) |
573 #define IMAGE_INSTANCE_PARENT(i) ((i)->parent) | 618 #define IMAGE_INSTANCE_PARENT(i) ((i)->parent) |
574 #define IMAGE_INSTANCE_GLYPH(i) (image_instance_parent_glyph(i)) | 619 #define IMAGE_INSTANCE_GLYPH(i) (image_instance_parent_glyph(i)) |
575 #define IMAGE_INSTANCE_TYPE(i) ((i)->type) | 620 #define IMAGE_INSTANCE_TYPE(i) ((i)->type) |
576 #define IMAGE_INSTANCE_XOFFSET(i) ((i)->x_offset) | 621 #define IMAGE_INSTANCE_XOFFSET(i) ((i)->x_offset) |
577 #define IMAGE_INSTANCE_YOFFSET(i) ((i)->y_offset) | 622 #define IMAGE_INSTANCE_YOFFSET(i) ((i)->y_offset) |
578 #define IMAGE_INSTANCE_WIDTH(i) ((i)->width) | 623 #define IMAGE_INSTANCE_WIDTH(i) ((i)->width) |
624 #define IMAGE_INSTANCE_MARGIN_WIDTH(i) ((i)->margin_width) | |
579 #define IMAGE_INSTANCE_HEIGHT(i) ((i)->height) | 625 #define IMAGE_INSTANCE_HEIGHT(i) ((i)->height) |
626 #define IMAGE_INSTANCE_INITIALIZED(i) ((i)->initialized) | |
580 #define IMAGE_INSTANCE_DISPLAY_HASH(i) ((i)->display_hash) | 627 #define IMAGE_INSTANCE_DISPLAY_HASH(i) ((i)->display_hash) |
581 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \ | 628 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \ |
582 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \ | 629 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \ |
583 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP)) | 630 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP)) |
584 #define IMAGE_INSTANCE_DIRTYP(i) ((i)->dirty) | 631 #define IMAGE_INSTANCE_DIRTYP(i) ((i)->dirty) |
585 #define IMAGE_INSTANCE_NEEDS_LAYOUT(i) \ | 632 #define IMAGE_INSTANCE_NEEDS_LAYOUT(i) \ |
586 (IMAGE_INSTANCE_DIRTYP (i) && IMAGE_INSTANCE_LAYOUT_CHANGED (i)) | 633 ((IMAGE_INSTANCE_DIRTYP (i) && IMAGE_INSTANCE_LAYOUT_CHANGED (i)) \ |
634 || (FRAMEP (IMAGE_INSTANCE_FRAME (i)) \ | |
635 && XFRAME (IMAGE_INSTANCE_FRAME (i))->size_changed)) | |
587 #define IMAGE_INSTANCE_FACE(i) \ | 636 #define IMAGE_INSTANCE_FACE(i) \ |
588 (GLYPHP (IMAGE_INSTANCE_GLYPH (i)) ? \ | 637 (GLYPHP (IMAGE_INSTANCE_GLYPH (i)) ? \ |
589 XGLYPH_FACE (IMAGE_INSTANCE_GLYPH (i)) : Qnil) | 638 XGLYPH_FACE (IMAGE_INSTANCE_GLYPH (i)) : Qnil) |
590 | 639 |
591 /* Changed flags */ | 640 /* Changed flags */ |
625 #define IMAGE_INSTANCE_PIXMAP_SLICE(i) ((i)->u.pixmap.slice) | 674 #define IMAGE_INSTANCE_PIXMAP_SLICE(i) ((i)->u.pixmap.slice) |
626 #define IMAGE_INSTANCE_PIXMAP_MAXSLICE(i) ((i)->u.pixmap.maxslice) | 675 #define IMAGE_INSTANCE_PIXMAP_MAXSLICE(i) ((i)->u.pixmap.maxslice) |
627 #define IMAGE_INSTANCE_PIXMAP_TIMEOUT(i) ((i)->u.pixmap.timeout) | 676 #define IMAGE_INSTANCE_PIXMAP_TIMEOUT(i) ((i)->u.pixmap.timeout) |
628 | 677 |
629 /* Subwindow properties */ | 678 /* Subwindow properties */ |
630 #define IMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \ | |
631 IMAGE_INSTANCE_WIDTH(i) | |
632 #define IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \ | |
633 IMAGE_INSTANCE_HEIGHT(i) | |
634 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow) | 679 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow) |
635 #define IMAGE_INSTANCE_SUBWINDOW_FRAME(i) ((i)->u.subwindow.frame) | 680 /* Display data. */ |
681 #define IMAGE_INSTANCE_DISPLAY_X(i) ((i)->u.subwindow.display_data.x) | |
682 #define IMAGE_INSTANCE_DISPLAY_Y(i) ((i)->u.subwindow.display_data.y) | |
683 #define IMAGE_INSTANCE_DISPLAY_WIDTH(i) \ | |
684 ((i)->u.subwindow.display_data.width) | |
685 #define IMAGE_INSTANCE_DISPLAY_HEIGHT(i) \ | |
686 ((i)->u.subwindow.display_data.height) | |
636 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ | 687 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ |
637 ((i)->u.subwindow.being_displayed) | 688 ((i)->u.subwindow.being_displayed) |
638 #define IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP(i) \ | 689 #define IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP(i) \ |
639 ((i)->u.subwindow.v_resize) | 690 ((i)->u.subwindow.v_resize) |
640 #define IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP(i) \ | 691 #define IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP(i) \ |
667 XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (i)) : \ | 718 XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (i)) : \ |
668 IMAGE_INSTANCE_WIDGET_ITEMS (i)) | 719 IMAGE_INSTANCE_WIDGET_ITEMS (i)) |
669 #define IMAGE_INSTANCE_WIDGET_TEXT(i) XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (i))->name | 720 #define IMAGE_INSTANCE_WIDGET_TEXT(i) XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (i))->name |
670 | 721 |
671 /* Layout properties */ | 722 /* Layout properties */ |
672 #define IMAGE_INSTANCE_LAYOUT_CHILDREN(i) ((i)->u.subwindow.items) | 723 #define IMAGE_INSTANCE_LAYOUT_CHILDREN(i) ((i)->u.subwindow.children) |
673 #define IMAGE_INSTANCE_LAYOUT_BORDER(i) ((i)->u.subwindow.props) | 724 #define IMAGE_INSTANCE_LAYOUT_BORDER(i) ((i)->u.subwindow.props) |
674 | 725 |
726 #define XIMAGE_INSTANCE_DOMAIN(i) \ | |
727 IMAGE_INSTANCE_DOMAIN (XIMAGE_INSTANCE (i)) | |
728 #define XIMAGE_INSTANCE_DOMAIN_LIVE_P(i) \ | |
729 IMAGE_INSTANCE_DOMAIN_LIVE_P (XIMAGE_INSTANCE (i)) | |
675 #define XIMAGE_INSTANCE_DEVICE(i) \ | 730 #define XIMAGE_INSTANCE_DEVICE(i) \ |
676 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i)) | 731 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i)) |
732 #define XIMAGE_INSTANCE_FRAME(i) \ | |
733 IMAGE_INSTANCE_FRAME (XIMAGE_INSTANCE (i)) | |
677 #define XIMAGE_INSTANCE_NAME(i) \ | 734 #define XIMAGE_INSTANCE_NAME(i) \ |
678 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i)) | 735 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i)) |
679 #define XIMAGE_INSTANCE_GLYPH(i) \ | 736 #define XIMAGE_INSTANCE_GLYPH(i) \ |
680 IMAGE_INSTANCE_GLYPH (XIMAGE_INSTANCE (i)) | 737 IMAGE_INSTANCE_GLYPH (XIMAGE_INSTANCE (i)) |
681 #define XIMAGE_INSTANCE_PARENT(i) \ | 738 #define XIMAGE_INSTANCE_PARENT(i) \ |
692 IMAGE_INSTANCE_DIRTYP (XIMAGE_INSTANCE (i)) | 749 IMAGE_INSTANCE_DIRTYP (XIMAGE_INSTANCE (i)) |
693 #define XIMAGE_INSTANCE_NEEDS_LAYOUT(i) \ | 750 #define XIMAGE_INSTANCE_NEEDS_LAYOUT(i) \ |
694 IMAGE_INSTANCE_NEEDS_LAYOUT (XIMAGE_INSTANCE (i)) | 751 IMAGE_INSTANCE_NEEDS_LAYOUT (XIMAGE_INSTANCE (i)) |
695 #define XIMAGE_INSTANCE_WIDTH(i) \ | 752 #define XIMAGE_INSTANCE_WIDTH(i) \ |
696 IMAGE_INSTANCE_WIDTH (XIMAGE_INSTANCE (i)) | 753 IMAGE_INSTANCE_WIDTH (XIMAGE_INSTANCE (i)) |
754 #define XIMAGE_INSTANCE_MARGIN_WIDTH(i) \ | |
755 IMAGE_INSTANCE_MARGIN_WIDTH (XIMAGE_INSTANCE (i)) | |
697 #define XIMAGE_INSTANCE_HEIGHT(i) \ | 756 #define XIMAGE_INSTANCE_HEIGHT(i) \ |
698 IMAGE_INSTANCE_HEIGHT (XIMAGE_INSTANCE (i)) | 757 IMAGE_INSTANCE_HEIGHT (XIMAGE_INSTANCE (i)) |
758 #define XIMAGE_INSTANCE_INITIALIZED(i) \ | |
759 IMAGE_INSTANCE_INITIALIZED (XIMAGE_INSTANCE (i)) | |
699 #define XIMAGE_INSTANCE_FACE(i) \ | 760 #define XIMAGE_INSTANCE_FACE(i) \ |
700 IMAGE_INSTANCE_FACE (XIMAGE_INSTANCE (i)) | 761 IMAGE_INSTANCE_FACE (XIMAGE_INSTANCE (i)) |
701 | 762 |
702 #define XIMAGE_INSTANCE_TEXT_STRING(i) \ | 763 #define XIMAGE_INSTANCE_TEXT_STRING(i) \ |
703 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i)) | 764 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i)) |
765 #define XIMAGE_INSTANCE_LAYOUT_CHILDREN(i) \ | 826 #define XIMAGE_INSTANCE_LAYOUT_CHILDREN(i) \ |
766 IMAGE_INSTANCE_LAYOUT_CHILDREN (XIMAGE_INSTANCE (i)) | 827 IMAGE_INSTANCE_LAYOUT_CHILDREN (XIMAGE_INSTANCE (i)) |
767 #define XIMAGE_INSTANCE_LAYOUT_BORDER(i) \ | 828 #define XIMAGE_INSTANCE_LAYOUT_BORDER(i) \ |
768 IMAGE_INSTANCE_LAYOUT_BORDER (XIMAGE_INSTANCE (i)) | 829 IMAGE_INSTANCE_LAYOUT_BORDER (XIMAGE_INSTANCE (i)) |
769 | 830 |
770 #define XIMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \ | |
771 IMAGE_INSTANCE_SUBWINDOW_WIDTH (XIMAGE_INSTANCE (i)) | |
772 #define XIMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \ | |
773 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (XIMAGE_INSTANCE (i)) | |
774 #define XIMAGE_INSTANCE_SUBWINDOW_ID(i) \ | 831 #define XIMAGE_INSTANCE_SUBWINDOW_ID(i) \ |
775 IMAGE_INSTANCE_SUBWINDOW_ID (XIMAGE_INSTANCE (i)) | 832 IMAGE_INSTANCE_SUBWINDOW_ID (XIMAGE_INSTANCE (i)) |
776 #define XIMAGE_INSTANCE_SUBWINDOW_FRAME(i) \ | 833 #define XIMAGE_INSTANCE_DISPLAY_X(i) \ |
777 IMAGE_INSTANCE_SUBWINDOW_FRAME (XIMAGE_INSTANCE (i)) | 834 IMAGE_INSTANCE_DISPLAY_X (XIMAGE_INSTANCE (i)) |
835 #define XIMAGE_INSTANCE_DISPLAY_Y(i) \ | |
836 IMAGE_INSTANCE_DISPLAY_Y (XIMAGE_INSTANCE (i)) | |
837 #define XIMAGE_INSTANCE_DISPLAY_WIDTH(i) \ | |
838 IMAGE_INSTANCE_DISPLAY_WIDTH (XIMAGE_INSTANCE (i)) | |
839 #define XIMAGE_INSTANCE_DISPLAY_HEIGHT(i) \ | |
840 IMAGE_INSTANCE_DISPLAY_HEIGHT (XIMAGE_INSTANCE (i)) | |
778 #define XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ | 841 #define XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ |
779 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (XIMAGE_INSTANCE (i)) | 842 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (XIMAGE_INSTANCE (i)) |
780 #define XIMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \ | 843 #define XIMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \ |
781 IMAGE_INSTANCE_SUBWINDOW_ORIENT (XIMAGE_INSTANCE (i)) | 844 IMAGE_INSTANCE_SUBWINDOW_ORIENT (XIMAGE_INSTANCE (i)) |
782 #define XIMAGE_INSTANCE_SUBWINDOW_JUSTIFY(i) \ | 845 #define XIMAGE_INSTANCE_SUBWINDOW_JUSTIFY(i) \ |
783 IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (XIMAGE_INSTANCE (i)) | 846 IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (XIMAGE_INSTANCE (i)) |
784 | 847 |
785 #define MARK_IMAGE_INSTANCE_CHANGED(i) \ | 848 #define MARK_IMAGE_INSTANCE_CHANGED(i) \ |
786 (IMAGE_INSTANCE_DIRTYP (i) = 1); | 849 (IMAGE_INSTANCE_DIRTYP (i) = 1); |
850 | |
851 Lisp_Object image_instance_device (Lisp_Object instance); | |
852 Lisp_Object image_instance_frame (Lisp_Object instance); | |
853 Lisp_Object image_instance_window (Lisp_Object instance); | |
854 int image_instance_live_p (Lisp_Object instance); | |
787 | 855 |
788 #ifdef HAVE_XPM | 856 #ifdef HAVE_XPM |
789 Lisp_Object evaluate_xpm_color_symbols (void); | 857 Lisp_Object evaluate_xpm_color_symbols (void); |
790 Lisp_Object pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid); | 858 Lisp_Object pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid); |
791 #endif /* HAVE_XPM */ | 859 #endif /* HAVE_XPM */ |
881 extern Lisp_Object Qtree_view, Qtab_control, Qprogress_gauge, Q_border; | 949 extern Lisp_Object Qtree_view, Qtab_control, Qprogress_gauge, Q_border; |
882 extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y; | 950 extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y; |
883 extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group; | 951 extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group; |
884 extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text; | 952 extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text; |
885 extern Lisp_Object Q_items, Q_properties, Q_image, Qimage_conversion_error; | 953 extern Lisp_Object Q_items, Q_properties, Q_image, Qimage_conversion_error; |
886 extern Lisp_Object Q_orientation, Qupdate_widget_instances; | 954 extern Lisp_Object Q_orientation, Q_margin_width; |
887 extern Lisp_Object Qwidget_callback_current_channel; | |
888 extern Lisp_Object Vcontinuation_glyph, Vcontrol_arrow_glyph, Vhscroll_glyph; | 955 extern Lisp_Object Vcontinuation_glyph, Vcontrol_arrow_glyph, Vhscroll_glyph; |
889 extern Lisp_Object Vinvisible_text_glyph, Voctal_escape_glyph, Vtruncation_glyph; | 956 extern Lisp_Object Vinvisible_text_glyph, Voctal_escape_glyph, Vtruncation_glyph; |
890 extern Lisp_Object Vxemacs_logo; | 957 extern Lisp_Object Vxemacs_logo; |
891 | 958 |
892 | 959 |
947 #define HSCROLL_GLYPH_INDEX (glyph_index) 2 | 1014 #define HSCROLL_GLYPH_INDEX (glyph_index) 2 |
948 #define CONTROL_GLYPH_INDEX (glyph_index) 3 | 1015 #define CONTROL_GLYPH_INDEX (glyph_index) 3 |
949 #define OCT_ESC_GLYPH_INDEX (glyph_index) 4 | 1016 #define OCT_ESC_GLYPH_INDEX (glyph_index) 4 |
950 #define INVIS_GLYPH_INDEX (glyph_index) 5 | 1017 #define INVIS_GLYPH_INDEX (glyph_index) 5 |
951 | 1018 |
952 #define GLYPH_CACHEL(window, index) \ | 1019 #ifdef ERROR_CHECK_GLYPHS |
953 Dynarr_atp (window->glyph_cachels, index) | 1020 |
954 #define GLYPH_CACHEL_GLYPH(window, index) \ | 1021 #include "window.h" |
955 Dynarr_atp (window->glyph_cachels, index)->glyph | 1022 |
956 #define GLYPH_CACHEL_WIDTH(window, index) \ | 1023 INLINE_HEADER int |
957 Dynarr_atp (window->glyph_cachels, index)->width | 1024 GLYPH_CACHEL_WIDTH (struct window *window, int ind); |
958 #define GLYPH_CACHEL_ASCENT(window, index) \ | 1025 INLINE_HEADER int |
959 Dynarr_atp (window->glyph_cachels, index)->ascent | 1026 GLYPH_CACHEL_WIDTH (struct window *window, int ind) |
960 #define GLYPH_CACHEL_DESCENT(window, index) \ | 1027 { |
961 Dynarr_atp (window->glyph_cachels, index)->descent | 1028 int wid = Dynarr_atp (window->glyph_cachels, ind)->width; |
962 #define GLYPH_CACHEL_DIRTYP(window, index) \ | 1029 assert (wid >= 0 && wid < 10000); |
963 Dynarr_atp (window->glyph_cachels, index)->dirty | 1030 return wid; |
1031 } | |
1032 INLINE_HEADER int | |
1033 GLYPH_CACHEL_ASCENT (struct window *window, int ind); | |
1034 INLINE_HEADER int | |
1035 GLYPH_CACHEL_ASCENT (struct window *window, int ind) | |
1036 { | |
1037 int wid = Dynarr_atp (window->glyph_cachels, ind)->ascent; | |
1038 assert (wid >= 0 && wid < 10000); | |
1039 return wid; | |
1040 } | |
1041 INLINE_HEADER int | |
1042 GLYPH_CACHEL_DESCENT (struct window *window, int ind); | |
1043 INLINE_HEADER int | |
1044 GLYPH_CACHEL_DESCENT (struct window *window, int ind) | |
1045 { | |
1046 int wid = Dynarr_atp (window->glyph_cachels, ind)->descent; | |
1047 assert (wid >= 0 && wid < 10000); | |
1048 return wid; | |
1049 } | |
1050 | |
1051 #else /* not ERROR_CHECK_GLYPHS */ | |
1052 | |
1053 #define GLYPH_CACHEL_WIDTH(window, ind) \ | |
1054 Dynarr_atp (window->glyph_cachels, ind)->width | |
1055 #define GLYPH_CACHEL_ASCENT(window, ind) \ | |
1056 Dynarr_atp (window->glyph_cachels, ind)->ascent | |
1057 #define GLYPH_CACHEL_DESCENT(window, ind) \ | |
1058 Dynarr_atp (window->glyph_cachels, ind)->descent | |
1059 | |
1060 #endif /* not ERROR_CHECK_GLYPHS */ | |
1061 | |
1062 #define GLYPH_CACHEL(window, ind) \ | |
1063 Dynarr_atp (window->glyph_cachels, ind) | |
1064 #define GLYPH_CACHEL_GLYPH(window, ind) \ | |
1065 Dynarr_atp (window->glyph_cachels, ind)->glyph | |
1066 #define GLYPH_CACHEL_DIRTYP(window, ind) \ | |
1067 Dynarr_atp (window->glyph_cachels, ind)->dirty | |
964 | 1068 |
965 void mark_glyph_cachels (glyph_cachel_dynarr *elements); | 1069 void mark_glyph_cachels (glyph_cachel_dynarr *elements); |
966 void mark_glyph_cachels_as_not_updated (struct window *w); | 1070 void mark_glyph_cachels_as_not_updated (struct window *w); |
967 void mark_glyph_cachels_as_clean (struct window *w); | 1071 void mark_glyph_cachels_as_clean (struct window *w); |
968 void reset_glyph_cachels (struct window *w); | 1072 void reset_glyph_cachels (struct window *w); |
983 | 1087 |
984 /**************************************************************************** | 1088 /**************************************************************************** |
985 * Subwindow Object * | 1089 * Subwindow Object * |
986 ****************************************************************************/ | 1090 ****************************************************************************/ |
987 | 1091 |
988 /* redisplay needs a per-frame cache of subwindows being displayed so | |
989 * that we known when to unmap them */ | |
990 typedef struct subwindow_cachel subwindow_cachel; | |
991 struct subwindow_cachel | |
992 { | |
993 Lisp_Object subwindow; | |
994 unsigned int x, y; | |
995 unsigned int width, height; | |
996 unsigned int being_displayed : 1; | |
997 unsigned int updated : 1; | |
998 }; | |
999 | |
1000 typedef struct | |
1001 { | |
1002 Dynarr_declare (subwindow_cachel); | |
1003 } subwindow_cachel_dynarr; | |
1004 | |
1005 void mark_subwindow_cachels (subwindow_cachel_dynarr *elements); | |
1006 void mark_subwindow_cachels_as_not_updated (struct frame *f); | |
1007 void reset_subwindow_cachels (struct frame *f); | |
1008 void unmap_subwindow (Lisp_Object subwindow); | 1092 void unmap_subwindow (Lisp_Object subwindow); |
1009 void map_subwindow (Lisp_Object subwindow, int x, int y, | 1093 void map_subwindow (Lisp_Object subwindow, int x, int y, |
1010 struct display_glyph_area *dga); | 1094 struct display_glyph_area *dga); |
1011 int find_matching_subwindow (struct frame* f, int x, int y, int width, int height); | 1095 int find_matching_subwindow (struct frame* f, int x, int y, int width, int height); |
1012 void update_widget (Lisp_Object widget); | 1096 void update_widget (Lisp_Object widget); |
1097 void update_widget_instances (Lisp_Object frame); | |
1013 void update_subwindow (Lisp_Object subwindow); | 1098 void update_subwindow (Lisp_Object subwindow); |
1014 Lisp_Object image_instance_parent_glyph (struct Lisp_Image_Instance*); | 1099 Lisp_Object image_instance_parent_glyph (struct Lisp_Image_Instance*); |
1015 int image_instance_changed (Lisp_Object image); | 1100 int image_instance_changed (Lisp_Object image); |
1101 void free_frame_subwindow_instance_cache (struct frame* f); | |
1102 void reset_frame_subwindow_instance_cache (struct frame* f); | |
1016 | 1103 |
1017 struct expose_ignore | 1104 struct expose_ignore |
1018 { | 1105 { |
1019 unsigned int x, y; | 1106 unsigned int x, y; |
1020 unsigned int width, height; | 1107 unsigned int width, height; |