Mercurial > hg > xemacs-beta
comparison src/glyphs.c @ 384:bbff43aa5eb7 r21-2-7
Import from CVS: tag r21-2-7
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:08:24 +0200 |
parents | 8626e4521993 |
children | aabb7f5b1c81 |
comparison
equal
deleted
inserted
replaced
383:6a50c6a581a5 | 384:bbff43aa5eb7 |
---|---|
1 /* Generic glyph/image implementation + display tables | 1 /* Generic glyph/image implementation + display tables |
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. | 2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. |
3 Copyright (C) 1995 Tinker Systems | 3 Copyright (C) 1995 Tinker Systems |
4 Copyright (C) 1995, 1996 Ben Wing | 4 Copyright (C) 1995, 1996 Ben Wing |
5 Copyright (C) 1995 Sun Microsystems | 5 Copyright (C) 1995 Sun Microsystems |
6 Copyright (C) 1998 Andy Piper | |
6 | 7 |
7 This file is part of XEmacs. | 8 This file is part of XEmacs. |
8 | 9 |
9 XEmacs is free software; you can redistribute it and/or modify it | 10 XEmacs is free software; you can redistribute it and/or modify it |
10 under the terms of the GNU General Public License as published by the | 11 under the terms of the GNU General Public License as published by the |
32 #include "device.h" | 33 #include "device.h" |
33 #include "elhash.h" | 34 #include "elhash.h" |
34 #include "faces.h" | 35 #include "faces.h" |
35 #include "frame.h" | 36 #include "frame.h" |
36 #include "insdel.h" | 37 #include "insdel.h" |
37 #include "glyphs.h" | 38 #include "opaque.h" |
38 #include "objects.h" | 39 #include "objects.h" |
39 #include "redisplay.h" | 40 #include "redisplay.h" |
40 #include "window.h" | 41 #include "window.h" |
42 #include "frame.h" | |
43 #include "chartab.h" | |
44 #include "rangetab.h" | |
41 | 45 |
42 #ifdef HAVE_XPM | 46 #ifdef HAVE_XPM |
43 #include <X11/xpm.h> | 47 #include <X11/xpm.h> |
44 #endif | 48 #endif |
45 | 49 |
50 Lisp_Object Qnothing_image_instance_p, Qtext_image_instance_p; | 54 Lisp_Object Qnothing_image_instance_p, Qtext_image_instance_p; |
51 Lisp_Object Qmono_pixmap_image_instance_p; | 55 Lisp_Object Qmono_pixmap_image_instance_p; |
52 Lisp_Object Qcolor_pixmap_image_instance_p; | 56 Lisp_Object Qcolor_pixmap_image_instance_p; |
53 Lisp_Object Qpointer_image_instance_p; | 57 Lisp_Object Qpointer_image_instance_p; |
54 Lisp_Object Qsubwindow_image_instance_p; | 58 Lisp_Object Qsubwindow_image_instance_p; |
59 Lisp_Object Qwidget_image_instance_p; | |
55 Lisp_Object Qconst_glyph_variable; | 60 Lisp_Object Qconst_glyph_variable; |
56 Lisp_Object Qmono_pixmap, Qcolor_pixmap, Qsubwindow; | 61 Lisp_Object Qmono_pixmap, Qcolor_pixmap, Qsubwindow; |
57 Lisp_Object Q_file, Q_data, Q_face; | 62 Lisp_Object Q_file, Q_data, Q_face, Q_pixel_width, Q_pixel_height; |
58 Lisp_Object Qformatted_string; | 63 Lisp_Object Qformatted_string; |
59 | |
60 Lisp_Object Vcurrent_display_table; | 64 Lisp_Object Vcurrent_display_table; |
61 Lisp_Object Vtruncation_glyph, Vcontinuation_glyph, Voctal_escape_glyph; | 65 Lisp_Object Vtruncation_glyph, Vcontinuation_glyph, Voctal_escape_glyph; |
62 Lisp_Object Vcontrol_arrow_glyph, Vinvisible_text_glyph, Vhscroll_glyph; | 66 Lisp_Object Vcontrol_arrow_glyph, Vinvisible_text_glyph, Vhscroll_glyph; |
63 Lisp_Object Vxemacs_logo; | 67 Lisp_Object Vxemacs_logo; |
64 Lisp_Object Vthe_nothing_vector; | 68 Lisp_Object Vthe_nothing_vector; |
68 | 72 |
69 DEFINE_IMAGE_INSTANTIATOR_FORMAT (nothing); | 73 DEFINE_IMAGE_INSTANTIATOR_FORMAT (nothing); |
70 DEFINE_IMAGE_INSTANTIATOR_FORMAT (inherit); | 74 DEFINE_IMAGE_INSTANTIATOR_FORMAT (inherit); |
71 DEFINE_IMAGE_INSTANTIATOR_FORMAT (string); | 75 DEFINE_IMAGE_INSTANTIATOR_FORMAT (string); |
72 DEFINE_IMAGE_INSTANTIATOR_FORMAT (formatted_string); | 76 DEFINE_IMAGE_INSTANTIATOR_FORMAT (formatted_string); |
77 DEFINE_IMAGE_INSTANTIATOR_FORMAT (subwindow); | |
73 | 78 |
74 #ifdef HAVE_WINDOW_SYSTEM | 79 #ifdef HAVE_WINDOW_SYSTEM |
75 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xbm); | 80 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xbm); |
76 Lisp_Object Qxbm; | 81 Lisp_Object Qxbm; |
77 | 82 |
93 | 98 |
94 typedef struct image_instantiator_format_entry image_instantiator_format_entry; | 99 typedef struct image_instantiator_format_entry image_instantiator_format_entry; |
95 struct image_instantiator_format_entry | 100 struct image_instantiator_format_entry |
96 { | 101 { |
97 Lisp_Object symbol; | 102 Lisp_Object symbol; |
103 Lisp_Object device; | |
98 struct image_instantiator_methods *meths; | 104 struct image_instantiator_methods *meths; |
99 }; | 105 }; |
100 | 106 |
101 typedef struct | 107 typedef struct |
102 { | 108 { |
117 | 123 |
118 /**************************************************************************** | 124 /**************************************************************************** |
119 * Image Instantiators * | 125 * Image Instantiators * |
120 ****************************************************************************/ | 126 ****************************************************************************/ |
121 | 127 |
122 static struct image_instantiator_methods * | 128 struct image_instantiator_methods * |
123 decode_image_instantiator_format (Lisp_Object format, Error_behavior errb) | 129 decode_device_ii_format (Lisp_Object device, Lisp_Object format, |
130 Error_behavior errb) | |
124 { | 131 { |
125 int i; | 132 int i; |
126 | 133 |
127 if (!SYMBOLP (format)) | 134 if (!SYMBOLP (format)) |
128 { | 135 { |
132 } | 139 } |
133 | 140 |
134 for (i = 0; i < Dynarr_length (the_image_instantiator_format_entry_dynarr); | 141 for (i = 0; i < Dynarr_length (the_image_instantiator_format_entry_dynarr); |
135 i++) | 142 i++) |
136 { | 143 { |
137 if (EQ (format, | 144 if ( EQ (format, |
138 Dynarr_at (the_image_instantiator_format_entry_dynarr, i). | 145 Dynarr_at (the_image_instantiator_format_entry_dynarr, i). |
139 symbol)) | 146 symbol) ) |
140 return Dynarr_at (the_image_instantiator_format_entry_dynarr, i).meths; | 147 { |
148 Lisp_Object d = Dynarr_at (the_image_instantiator_format_entry_dynarr, i). | |
149 device; | |
150 if ((NILP (d) && NILP (device)) | |
151 || | |
152 (!NILP (device) && | |
153 EQ (CONSOLE_TYPE (XCONSOLE | |
154 (DEVICE_CONSOLE (XDEVICE (device)))), d))) | |
155 return Dynarr_at (the_image_instantiator_format_entry_dynarr, i).meths; | |
156 } | |
141 } | 157 } |
142 | 158 |
143 maybe_signal_simple_error ("Invalid image-instantiator format", format, | 159 maybe_signal_simple_error ("Invalid image-instantiator format", format, |
144 Qimage, errb); | 160 Qimage, errb); |
145 | 161 |
146 return 0; | 162 return 0; |
163 } | |
164 | |
165 struct image_instantiator_methods * | |
166 decode_image_instantiator_format (Lisp_Object format, Error_behavior errb) | |
167 { | |
168 return decode_device_ii_format (Qnil, format, errb); | |
147 } | 169 } |
148 | 170 |
149 static int | 171 static int |
150 valid_image_instantiator_format_p (Lisp_Object format) | 172 valid_image_instantiator_format_p (Lisp_Object format) |
151 { | 173 { |
155 DEFUN ("valid-image-instantiator-format-p", Fvalid_image_instantiator_format_p, | 177 DEFUN ("valid-image-instantiator-format-p", Fvalid_image_instantiator_format_p, |
156 1, 1, 0, /* | 178 1, 1, 0, /* |
157 Given an IMAGE-INSTANTIATOR-FORMAT, return non-nil if it is valid. | 179 Given an IMAGE-INSTANTIATOR-FORMAT, return non-nil if it is valid. |
158 Valid formats are some subset of 'nothing, 'string, 'formatted-string, | 180 Valid formats are some subset of 'nothing, 'string, 'formatted-string, |
159 'xpm, 'xbm, 'xface, 'gif, 'jpeg, 'png, 'tiff, 'cursor-font, 'font, | 181 'xpm, 'xbm, 'xface, 'gif, 'jpeg, 'png, 'tiff, 'cursor-font, 'font, |
160 'autodetect, and 'subwindow, depending on how XEmacs was compiled. | 182 'autodetect, 'widget and 'subwindow, depending on how XEmacs was compiled. |
161 */ | 183 */ |
162 (image_instantiator_format)) | 184 (image_instantiator_format)) |
163 { | 185 { |
164 return valid_image_instantiator_format_p (image_instantiator_format) ? | 186 return valid_image_instantiator_format_p (image_instantiator_format) ? |
165 Qt : Qnil; | 187 Qt : Qnil; |
173 { | 195 { |
174 return Fcopy_sequence (Vimage_instantiator_format_list); | 196 return Fcopy_sequence (Vimage_instantiator_format_list); |
175 } | 197 } |
176 | 198 |
177 void | 199 void |
178 add_entry_to_image_instantiator_format_list (Lisp_Object symbol, | 200 add_entry_to_device_ii_format_list (Lisp_Object device, Lisp_Object symbol, |
179 struct | 201 struct image_instantiator_methods *meths) |
180 image_instantiator_methods *meths) | |
181 { | 202 { |
182 struct image_instantiator_format_entry entry; | 203 struct image_instantiator_format_entry entry; |
183 | 204 |
184 entry.symbol = symbol; | 205 entry.symbol = symbol; |
206 entry.device = device; | |
185 entry.meths = meths; | 207 entry.meths = meths; |
186 Dynarr_add (the_image_instantiator_format_entry_dynarr, entry); | 208 Dynarr_add (the_image_instantiator_format_entry_dynarr, entry); |
187 Vimage_instantiator_format_list = | 209 Vimage_instantiator_format_list = |
188 Fcons (symbol, Vimage_instantiator_format_list); | 210 Fcons (symbol, Vimage_instantiator_format_list); |
211 } | |
212 | |
213 void | |
214 add_entry_to_image_instantiator_format_list (Lisp_Object symbol, | |
215 struct | |
216 image_instantiator_methods *meths) | |
217 { | |
218 add_entry_to_device_ii_format_list (Qnil, symbol, meths); | |
189 } | 219 } |
190 | 220 |
191 static Lisp_Object * | 221 static Lisp_Object * |
192 get_image_conversion_list (Lisp_Object console_type) | 222 get_image_conversion_list (Lisp_Object console_type) |
193 { | 223 { |
353 check_valid_string (Lisp_Object data) | 383 check_valid_string (Lisp_Object data) |
354 { | 384 { |
355 CHECK_STRING (data); | 385 CHECK_STRING (data); |
356 } | 386 } |
357 | 387 |
358 static void | 388 void |
389 check_valid_vector (Lisp_Object data) | |
390 { | |
391 CHECK_VECTOR (data); | |
392 } | |
393 | |
394 void | |
359 check_valid_face (Lisp_Object data) | 395 check_valid_face (Lisp_Object data) |
360 { | 396 { |
361 Fget_face (data); | 397 Fget_face (data); |
362 } | 398 } |
363 | 399 |
479 do this because it is quite possible that we will need to | 515 do this because it is quite possible that we will need to |
480 instantiate a new instance of the pixmap and the file will no | 516 instantiate a new instance of the pixmap and the file will no |
481 longer exist (e.g. w3 pixmaps are almost always from temporary | 517 longer exist (e.g. w3 pixmaps are almost always from temporary |
482 files). */ | 518 files). */ |
483 { | 519 { |
484 struct image_instantiator_methods * meths = | 520 struct gcpro gcpro1; |
485 decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0], | 521 struct image_instantiator_methods *meths; |
486 ERROR_ME); | 522 |
487 return IIFORMAT_METH_OR_GIVEN (meths, normalize, | 523 GCPRO1 (instantiator); |
488 (instantiator, contype), | 524 |
489 instantiator); | 525 meths = decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0], |
526 ERROR_ME); | |
527 RETURN_UNGCPRO (IIFORMAT_METH_OR_GIVEN (meths, normalize, | |
528 (instantiator, contype), | |
529 instantiator)); | |
490 } | 530 } |
491 } | 531 } |
492 | 532 |
493 static Lisp_Object | 533 static Lisp_Object |
494 instantiate_image_instantiator (Lisp_Object device, Lisp_Object domain, | 534 instantiate_image_instantiator (Lisp_Object device, Lisp_Object domain, |
497 int dest_mask) | 537 int dest_mask) |
498 { | 538 { |
499 Lisp_Object ii = allocate_image_instance (device); | 539 Lisp_Object ii = allocate_image_instance (device); |
500 struct image_instantiator_methods *meths; | 540 struct image_instantiator_methods *meths; |
501 struct gcpro gcpro1; | 541 struct gcpro gcpro1; |
542 int methp = 0; | |
502 | 543 |
503 GCPRO1 (ii); | 544 GCPRO1 (ii); |
504 meths = decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0], | 545 meths = decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0], |
505 ERROR_ME); | 546 ERROR_ME); |
506 if (!HAS_IIFORMAT_METH_P (meths, instantiate)) | 547 methp = (int)HAS_IIFORMAT_METH_P (meths, instantiate); |
548 MAYBE_IIFORMAT_METH (meths, instantiate, (ii, instantiator, pointer_fg, | |
549 pointer_bg, dest_mask, domain)); | |
550 | |
551 /* now do device specific instantiation */ | |
552 meths = decode_device_ii_format (device, XVECTOR_DATA (instantiator)[0], | |
553 ERROR_ME_NOT); | |
554 | |
555 if (!methp && (!meths || !HAS_IIFORMAT_METH_P (meths, instantiate))) | |
507 signal_simple_error | 556 signal_simple_error |
508 ("Don't know how to instantiate this image instantiator?", | 557 ("Don't know how to instantiate this image instantiator?", |
509 instantiator); | 558 instantiator); |
510 IIFORMAT_METH (meths, instantiate, (ii, instantiator, pointer_fg, | 559 MAYBE_IIFORMAT_METH (meths, instantiate, (ii, instantiator, pointer_fg, |
511 pointer_bg, dest_mask, domain)); | 560 pointer_bg, dest_mask, domain)); |
512 UNGCPRO; | 561 UNGCPRO; |
513 | 562 |
514 return ii; | 563 return ii; |
515 } | 564 } |
516 | 565 |
539 markobj (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (i)); | 588 markobj (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (i)); |
540 markobj (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (i)); | 589 markobj (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (i)); |
541 markobj (IMAGE_INSTANCE_PIXMAP_FG (i)); | 590 markobj (IMAGE_INSTANCE_PIXMAP_FG (i)); |
542 markobj (IMAGE_INSTANCE_PIXMAP_BG (i)); | 591 markobj (IMAGE_INSTANCE_PIXMAP_BG (i)); |
543 break; | 592 break; |
593 | |
594 case IMAGE_WIDGET: | |
595 markobj (IMAGE_INSTANCE_WIDGET_TYPE (i)); | |
596 markobj (IMAGE_INSTANCE_WIDGET_PROPS (i)); | |
597 markobj (IMAGE_INSTANCE_WIDGET_FACE (i)); | |
598 mark_gui_item (&IMAGE_INSTANCE_WIDGET_ITEM (i), markobj); | |
544 case IMAGE_SUBWINDOW: | 599 case IMAGE_SUBWINDOW: |
545 /* #### implement me */ | 600 markobj (IMAGE_INSTANCE_SUBWINDOW_FRAME (i)); |
546 break; | 601 break; |
602 | |
547 default: | 603 default: |
548 break; | 604 break; |
549 } | 605 } |
550 | 606 |
551 MAYBE_DEVMETH (XDEVICE (i->device), mark_image_instance, (i, markobj)); | 607 MAYBE_DEVMETH (XDEVICE (i->device), mark_image_instance, (i, markobj)); |
643 } | 699 } |
644 write_c_string (")", printcharfun); | 700 write_c_string (")", printcharfun); |
645 } | 701 } |
646 break; | 702 break; |
647 | 703 |
704 case IMAGE_WIDGET: | |
705 if (!NILP (IMAGE_INSTANCE_WIDGET_CALLBACK (ii))) | |
706 { | |
707 print_internal (IMAGE_INSTANCE_WIDGET_CALLBACK (ii), printcharfun, 0); | |
708 write_c_string (", ", printcharfun); | |
709 } | |
710 if (!NILP (IMAGE_INSTANCE_WIDGET_FACE (ii))) | |
711 { | |
712 write_c_string (" (", printcharfun); | |
713 print_internal | |
714 (IMAGE_INSTANCE_WIDGET_FACE (ii), printcharfun, 0); | |
715 write_c_string (")", printcharfun); | |
716 } | |
717 | |
718 if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii))) | |
719 print_internal (IMAGE_INSTANCE_WIDGET_TEXT (ii), printcharfun, 0); | |
720 | |
648 case IMAGE_SUBWINDOW: | 721 case IMAGE_SUBWINDOW: |
649 /* #### implement me */ | 722 sprintf (buf, " %dx%d", IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii), |
723 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii)); | |
724 write_c_string (buf, printcharfun); | |
725 | |
726 /* This is stolen from frame.c. Subwindows are strange in that they | |
727 are specific to a particular frame so we want to print in their | |
728 description what that frame is. */ | |
729 | |
730 write_c_string (" on #<", printcharfun); | |
731 { | |
732 struct frame* f = XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii)); | |
733 | |
734 if (!FRAME_LIVE_P (f)) | |
735 write_c_string ("dead", printcharfun); | |
736 else | |
737 write_c_string (DEVICE_TYPE_NAME (XDEVICE (FRAME_DEVICE (f))), | |
738 printcharfun); | |
739 | |
740 write_c_string ("-frame ", printcharfun); | |
741 } | |
742 write_c_string (">", printcharfun); | |
743 sprintf (buf, " 0x%p", IMAGE_INSTANCE_SUBWINDOW_ID (ii)); | |
744 write_c_string (buf, printcharfun); | |
745 | |
650 break; | 746 break; |
651 | 747 |
652 default: | 748 default: |
653 abort (); | 749 abort (); |
654 } | 750 } |
666 | 762 |
667 if (IMAGE_INSTANCE_TYPE (i) == IMAGE_NOTHING) | 763 if (IMAGE_INSTANCE_TYPE (i) == IMAGE_NOTHING) |
668 /* objects like this exist at dump time, so don't bomb out. */ | 764 /* objects like this exist at dump time, so don't bomb out. */ |
669 return; | 765 return; |
670 if (for_disksave) finalose (i); | 766 if (for_disksave) finalose (i); |
767 | |
768 /* do this so that the cachels get reset */ | |
769 if (IMAGE_INSTANCE_TYPE (i) == IMAGE_WIDGET | |
770 || | |
771 IMAGE_INSTANCE_TYPE (i) == IMAGE_SUBWINDOW) | |
772 { | |
773 MARK_FRAME_GLYPHS_CHANGED | |
774 (XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (i))); | |
775 } | |
671 | 776 |
672 MAYBE_DEVMETH (XDEVICE (i->device), finalize_image_instance, (i)); | 777 MAYBE_DEVMETH (XDEVICE (i->device), finalize_image_instance, (i)); |
673 } | 778 } |
674 | 779 |
675 static int | 780 static int |
720 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (i2), | 825 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (i2), |
721 depth + 1))) | 826 depth + 1))) |
722 return 0; | 827 return 0; |
723 break; | 828 break; |
724 | 829 |
830 case IMAGE_WIDGET: | |
831 if (!(EQ (IMAGE_INSTANCE_WIDGET_TYPE (i1), | |
832 IMAGE_INSTANCE_WIDGET_TYPE (i2)) && | |
833 EQ (IMAGE_INSTANCE_WIDGET_CALLBACK (i1), | |
834 IMAGE_INSTANCE_WIDGET_CALLBACK (i2)) | |
835 && internal_equal (IMAGE_INSTANCE_WIDGET_PROPS (i1), | |
836 IMAGE_INSTANCE_WIDGET_PROPS (i2), | |
837 depth + 1) | |
838 && internal_equal (IMAGE_INSTANCE_WIDGET_TEXT (i1), | |
839 IMAGE_INSTANCE_WIDGET_TEXT (i2), | |
840 depth + 1))) | |
841 return 0; | |
725 case IMAGE_SUBWINDOW: | 842 case IMAGE_SUBWINDOW: |
726 /* #### implement me */ | 843 if (!(IMAGE_INSTANCE_SUBWINDOW_WIDTH (i1) == |
844 IMAGE_INSTANCE_SUBWINDOW_WIDTH (i2) && | |
845 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (i1) == | |
846 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (i2) && | |
847 IMAGE_INSTANCE_SUBWINDOW_ID (i1) == | |
848 IMAGE_INSTANCE_SUBWINDOW_ID (i2))) | |
849 return 0; | |
727 break; | 850 break; |
728 | 851 |
729 default: | 852 default: |
730 abort (); | 853 abort (); |
731 } | 854 } |
758 IMAGE_INSTANCE_PIXMAP_DEPTH (i), | 881 IMAGE_INSTANCE_PIXMAP_DEPTH (i), |
759 internal_hash (IMAGE_INSTANCE_PIXMAP_FILENAME (i), | 882 internal_hash (IMAGE_INSTANCE_PIXMAP_FILENAME (i), |
760 depth + 1)); | 883 depth + 1)); |
761 break; | 884 break; |
762 | 885 |
886 case IMAGE_WIDGET: | |
887 hash = HASH4 (hash, | |
888 internal_hash (IMAGE_INSTANCE_WIDGET_TYPE (i), depth + 1), | |
889 internal_hash (IMAGE_INSTANCE_WIDGET_PROPS (i), depth + 1), | |
890 internal_hash (IMAGE_INSTANCE_WIDGET_CALLBACK (i), depth + 1)); | |
763 case IMAGE_SUBWINDOW: | 891 case IMAGE_SUBWINDOW: |
764 /* #### implement me */ | 892 hash = HASH4 (hash, IMAGE_INSTANCE_SUBWINDOW_WIDTH (i), |
893 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (i), | |
894 (int) IMAGE_INSTANCE_SUBWINDOW_ID (i)); | |
765 break; | 895 break; |
766 | 896 |
767 default: | 897 default: |
768 abort (); | 898 abort (); |
769 } | 899 } |
803 if (EQ (type, Qtext)) return IMAGE_TEXT; | 933 if (EQ (type, Qtext)) return IMAGE_TEXT; |
804 if (EQ (type, Qmono_pixmap)) return IMAGE_MONO_PIXMAP; | 934 if (EQ (type, Qmono_pixmap)) return IMAGE_MONO_PIXMAP; |
805 if (EQ (type, Qcolor_pixmap)) return IMAGE_COLOR_PIXMAP; | 935 if (EQ (type, Qcolor_pixmap)) return IMAGE_COLOR_PIXMAP; |
806 if (EQ (type, Qpointer)) return IMAGE_POINTER; | 936 if (EQ (type, Qpointer)) return IMAGE_POINTER; |
807 if (EQ (type, Qsubwindow)) return IMAGE_SUBWINDOW; | 937 if (EQ (type, Qsubwindow)) return IMAGE_SUBWINDOW; |
938 if (EQ (type, Qwidget)) return IMAGE_WIDGET; | |
808 | 939 |
809 maybe_signal_simple_error ("Invalid image-instance type", type, | 940 maybe_signal_simple_error ("Invalid image-instance type", type, |
810 Qimage, errb); | 941 Qimage, errb); |
811 | 942 |
812 return IMAGE_UNKNOWN; /* not reached */ | 943 return IMAGE_UNKNOWN; /* not reached */ |
821 case IMAGE_TEXT: return Qtext; | 952 case IMAGE_TEXT: return Qtext; |
822 case IMAGE_MONO_PIXMAP: return Qmono_pixmap; | 953 case IMAGE_MONO_PIXMAP: return Qmono_pixmap; |
823 case IMAGE_COLOR_PIXMAP: return Qcolor_pixmap; | 954 case IMAGE_COLOR_PIXMAP: return Qcolor_pixmap; |
824 case IMAGE_POINTER: return Qpointer; | 955 case IMAGE_POINTER: return Qpointer; |
825 case IMAGE_SUBWINDOW: return Qsubwindow; | 956 case IMAGE_SUBWINDOW: return Qsubwindow; |
957 case IMAGE_WIDGET: return Qwidget; | |
826 default: | 958 default: |
827 abort (); | 959 abort (); |
828 } | 960 } |
829 | 961 |
830 return Qnil; /* not reached */ | 962 return Qnil; /* not reached */ |
1067 return XIMAGE_INSTANCE_NAME (image_instance); | 1199 return XIMAGE_INSTANCE_NAME (image_instance); |
1068 } | 1200 } |
1069 | 1201 |
1070 DEFUN ("image-instance-string", Fimage_instance_string, 1, 1, 0, /* | 1202 DEFUN ("image-instance-string", Fimage_instance_string, 1, 1, 0, /* |
1071 Return the string of the given image instance. | 1203 Return the string of the given image instance. |
1072 This will only be non-nil for text image instances. | 1204 This will only be non-nil for text image instances and widgets. |
1073 */ | 1205 */ |
1074 (image_instance)) | 1206 (image_instance)) |
1075 { | 1207 { |
1076 CHECK_IMAGE_INSTANCE (image_instance); | 1208 CHECK_IMAGE_INSTANCE (image_instance); |
1077 if (XIMAGE_INSTANCE_TYPE (image_instance) == IMAGE_TEXT) | 1209 if (XIMAGE_INSTANCE_TYPE (image_instance) == IMAGE_TEXT) |
1078 return XIMAGE_INSTANCE_TEXT_STRING (image_instance); | 1210 return XIMAGE_INSTANCE_TEXT_STRING (image_instance); |
1211 else if (XIMAGE_INSTANCE_TYPE (image_instance) == IMAGE_WIDGET) | |
1212 return XIMAGE_INSTANCE_WIDGET_TEXT (image_instance); | |
1079 else | 1213 else |
1080 return Qnil; | 1214 return Qnil; |
1215 } | |
1216 | |
1217 DEFUN ("image-instance-property", Fimage_instance_property, 2, 2, 0, /* | |
1218 Return the given property of the given image instance. | |
1219 Returns nil if the property or the property method do not exist for | |
1220 the image instance in the domain. | |
1221 */ | |
1222 (image_instance, prop)) | |
1223 { | |
1224 struct Lisp_Image_Instance* ii; | |
1225 Lisp_Object type, ret; | |
1226 struct image_instantiator_methods* meths; | |
1227 | |
1228 CHECK_IMAGE_INSTANCE (image_instance); | |
1229 CHECK_SYMBOL (prop); | |
1230 ii = XIMAGE_INSTANCE (image_instance); | |
1231 | |
1232 /* ... then try device specific methods ... */ | |
1233 type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii)); | |
1234 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii), | |
1235 type, ERROR_ME_NOT); | |
1236 if (meths && HAS_IIFORMAT_METH_P (meths, property) | |
1237 && | |
1238 !UNBOUNDP (ret = IIFORMAT_METH (meths, property, (image_instance, prop)))) | |
1239 { | |
1240 return ret; | |
1241 } | |
1242 /* ... then format specific methods ... */ | |
1243 meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT); | |
1244 if (meths && HAS_IIFORMAT_METH_P (meths, property) | |
1245 && | |
1246 !UNBOUNDP (ret = IIFORMAT_METH (meths, property, (image_instance, prop)))) | |
1247 { | |
1248 return ret; | |
1249 } | |
1250 /* ... then fail */ | |
1251 return Qnil; | |
1252 } | |
1253 | |
1254 DEFUN ("set-image-instance-property", Fset_image_instance_property, 3, 3, 0, /* | |
1255 Set the given property of the given image instance. | |
1256 Does nothing if the property or the property method do not exist for | |
1257 the image instance in the domain. | |
1258 */ | |
1259 (image_instance, prop, val)) | |
1260 { | |
1261 struct Lisp_Image_Instance* ii; | |
1262 Lisp_Object type, ret; | |
1263 struct image_instantiator_methods* meths; | |
1264 | |
1265 CHECK_IMAGE_INSTANCE (image_instance); | |
1266 CHECK_SYMBOL (prop); | |
1267 ii = XIMAGE_INSTANCE (image_instance); | |
1268 type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii)); | |
1269 /* try device specific methods first ... */ | |
1270 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii), | |
1271 type, ERROR_ME_NOT); | |
1272 if (meths && HAS_IIFORMAT_METH_P (meths, set_property) | |
1273 && | |
1274 !UNBOUNDP (ret = | |
1275 IIFORMAT_METH (meths, set_property, (image_instance, prop, val)))) | |
1276 { | |
1277 return ret; | |
1278 } | |
1279 /* ... then format specific methods ... */ | |
1280 meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT); | |
1281 if (meths && HAS_IIFORMAT_METH_P (meths, set_property) | |
1282 && | |
1283 !UNBOUNDP (ret = | |
1284 IIFORMAT_METH (meths, set_property, (image_instance, prop, val)))) | |
1285 { | |
1286 return ret; | |
1287 } | |
1288 | |
1289 return val; | |
1081 } | 1290 } |
1082 | 1291 |
1083 DEFUN ("image-instance-file-name", Fimage_instance_file_name, 1, 1, 0, /* | 1292 DEFUN ("image-instance-file-name", Fimage_instance_file_name, 1, 1, 0, /* |
1084 Return the file name from which IMAGE-INSTANCE was read, if known. | 1293 Return the file name from which IMAGE-INSTANCE was read, if known. |
1085 */ | 1294 */ |
1150 case IMAGE_MONO_PIXMAP: | 1359 case IMAGE_MONO_PIXMAP: |
1151 case IMAGE_COLOR_PIXMAP: | 1360 case IMAGE_COLOR_PIXMAP: |
1152 case IMAGE_POINTER: | 1361 case IMAGE_POINTER: |
1153 return make_int (XIMAGE_INSTANCE_PIXMAP_HEIGHT (image_instance)); | 1362 return make_int (XIMAGE_INSTANCE_PIXMAP_HEIGHT (image_instance)); |
1154 | 1363 |
1364 case IMAGE_SUBWINDOW: | |
1365 case IMAGE_WIDGET: | |
1366 return make_int (XIMAGE_INSTANCE_SUBWINDOW_HEIGHT (image_instance)); | |
1367 | |
1155 default: | 1368 default: |
1156 return Qnil; | 1369 return Qnil; |
1157 } | 1370 } |
1158 } | 1371 } |
1159 | 1372 |
1168 { | 1381 { |
1169 case IMAGE_MONO_PIXMAP: | 1382 case IMAGE_MONO_PIXMAP: |
1170 case IMAGE_COLOR_PIXMAP: | 1383 case IMAGE_COLOR_PIXMAP: |
1171 case IMAGE_POINTER: | 1384 case IMAGE_POINTER: |
1172 return make_int (XIMAGE_INSTANCE_PIXMAP_WIDTH (image_instance)); | 1385 return make_int (XIMAGE_INSTANCE_PIXMAP_WIDTH (image_instance)); |
1386 | |
1387 case IMAGE_SUBWINDOW: | |
1388 case IMAGE_WIDGET: | |
1389 return make_int (XIMAGE_INSTANCE_SUBWINDOW_WIDTH (image_instance)); | |
1173 | 1390 |
1174 default: | 1391 default: |
1175 return Qnil; | 1392 return Qnil; |
1176 } | 1393 } |
1177 } | 1394 } |
1238 case IMAGE_MONO_PIXMAP: | 1455 case IMAGE_MONO_PIXMAP: |
1239 case IMAGE_COLOR_PIXMAP: | 1456 case IMAGE_COLOR_PIXMAP: |
1240 case IMAGE_POINTER: | 1457 case IMAGE_POINTER: |
1241 return XIMAGE_INSTANCE_PIXMAP_FG (image_instance); | 1458 return XIMAGE_INSTANCE_PIXMAP_FG (image_instance); |
1242 | 1459 |
1460 case IMAGE_WIDGET: | |
1461 return FACE_FOREGROUND ( | |
1462 XIMAGE_INSTANCE_WIDGET_FACE (image_instance), | |
1463 XIMAGE_INSTANCE_SUBWINDOW_FRAME | |
1464 (image_instance)); | |
1465 | |
1243 default: | 1466 default: |
1244 return Qnil; | 1467 return Qnil; |
1245 } | 1468 } |
1246 } | 1469 } |
1247 | 1470 |
1258 { | 1481 { |
1259 case IMAGE_MONO_PIXMAP: | 1482 case IMAGE_MONO_PIXMAP: |
1260 case IMAGE_COLOR_PIXMAP: | 1483 case IMAGE_COLOR_PIXMAP: |
1261 case IMAGE_POINTER: | 1484 case IMAGE_POINTER: |
1262 return XIMAGE_INSTANCE_PIXMAP_BG (image_instance); | 1485 return XIMAGE_INSTANCE_PIXMAP_BG (image_instance); |
1486 | |
1487 case IMAGE_WIDGET: | |
1488 return FACE_BACKGROUND ( | |
1489 XIMAGE_INSTANCE_WIDGET_FACE (image_instance), | |
1490 XIMAGE_INSTANCE_SUBWINDOW_FRAME | |
1491 (image_instance)); | |
1263 | 1492 |
1264 default: | 1493 default: |
1265 return Qnil; | 1494 return Qnil; |
1266 } | 1495 } |
1267 } | 1496 } |
1767 IMAGE_MONO_PIXMAP_MASK | | 1996 IMAGE_MONO_PIXMAP_MASK | |
1768 IMAGE_COLOR_PIXMAP_MASK | | 1997 IMAGE_COLOR_PIXMAP_MASK | |
1769 IMAGE_POINTER_MASK; | 1998 IMAGE_POINTER_MASK; |
1770 } | 1999 } |
1771 | 2000 |
1772 static void | |
1773 xbm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | |
1774 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | |
1775 int dest_mask, Lisp_Object domain) | |
1776 { | |
1777 Lisp_Object device= IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (image_instance)); | |
1778 | |
1779 MAYBE_DEVMETH (XDEVICE (device), | |
1780 xbm_instantiate, | |
1781 (image_instance, instantiator, pointer_fg, | |
1782 pointer_bg, dest_mask, domain)); | |
1783 } | |
1784 | |
1785 #endif | 2001 #endif |
1786 | 2002 |
1787 | 2003 |
1788 #ifdef HAVE_XPM | 2004 #ifdef HAVE_XPM |
1789 | 2005 |
1794 Lisp_Object | 2010 Lisp_Object |
1795 pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid) | 2011 pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid) |
1796 { | 2012 { |
1797 char **data; | 2013 char **data; |
1798 int result; | 2014 int result; |
1799 | 2015 char *fname = 0; |
1800 result = XpmReadFileToData ((char *) XSTRING_DATA (name), &data); | 2016 |
2017 GET_C_STRING_FILENAME_DATA_ALLOCA (name, fname); | |
2018 result = XpmReadFileToData (fname, &data); | |
1801 | 2019 |
1802 if (result == XpmSuccess) | 2020 if (result == XpmSuccess) |
1803 { | 2021 { |
1804 Lisp_Object retval = Qnil; | 2022 Lisp_Object retval = Qnil; |
1805 struct buffer *old_buffer = current_buffer; | 2023 struct buffer *old_buffer = current_buffer; |
1992 IMAGE_MONO_PIXMAP_MASK | | 2210 IMAGE_MONO_PIXMAP_MASK | |
1993 IMAGE_COLOR_PIXMAP_MASK | | 2211 IMAGE_COLOR_PIXMAP_MASK | |
1994 IMAGE_POINTER_MASK; | 2212 IMAGE_POINTER_MASK; |
1995 } | 2213 } |
1996 | 2214 |
1997 static void | |
1998 xpm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | |
1999 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | |
2000 int dest_mask, Lisp_Object domain) | |
2001 { | |
2002 Lisp_Object device= IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (image_instance)); | |
2003 | |
2004 MAYBE_DEVMETH (XDEVICE (device), | |
2005 xpm_instantiate, | |
2006 (image_instance, instantiator, pointer_fg, | |
2007 pointer_bg, dest_mask, domain)); | |
2008 } | |
2009 | |
2010 #endif /* HAVE_XPM */ | 2215 #endif /* HAVE_XPM */ |
2011 | 2216 |
2012 | 2217 |
2013 /**************************************************************************** | 2218 /**************************************************************************** |
2014 * Image Specifier Object * | 2219 * Image Specifier Object * |
2107 if (UNBOUNDP (subtable)) | 2312 if (UNBOUNDP (subtable)) |
2108 { | 2313 { |
2109 /* For the image instance cache, we do comparisons with EQ rather | 2314 /* For the image instance cache, we do comparisons with EQ rather |
2110 than with EQUAL, as we do for color and font names. | 2315 than with EQUAL, as we do for color and font names. |
2111 The reasons are: | 2316 The reasons are: |
2112 | 2317 |
2113 1) pixmap data can be very long, and thus the hashing and | 2318 1) pixmap data can be very long, and thus the hashing and |
2114 comparing will take awhile. | 2319 comparing will take awhile. |
2115 2) It's not so likely that we'll run into things that are EQUAL | 2320 2) It's not so likely that we'll run into things that are EQUAL |
2116 but not EQ (that can happen a lot with faces, because their | 2321 but not EQ (that can happen a lot with faces, because their |
2117 specifiers are copied around); but pixmaps tend not to be | 2322 specifiers are copied around); but pixmaps tend not to be |
2131 Fputhash (make_int (dest_mask), subtable, | 2336 Fputhash (make_int (dest_mask), subtable, |
2132 d->image_instance_cache); | 2337 d->image_instance_cache); |
2133 instance = Qunbound; | 2338 instance = Qunbound; |
2134 } | 2339 } |
2135 else | 2340 else |
2136 instance = Fgethash (pointerp ? ls3 : instantiator, | 2341 { |
2137 subtable, Qunbound); | 2342 instance = Fgethash (pointerp ? ls3 : instantiator, |
2343 subtable, Qunbound); | |
2344 /* subwindows have a per-window cache and have to be treated | |
2345 differently. dest_mask can be a bitwise OR of all image | |
2346 types so we will only catch someone possibly trying to | |
2347 instantiate a subwindow type thing. Unfortunately, this | |
2348 will occur most of the time so this probably slows things | |
2349 down. But with the current design I don't see anyway | |
2350 round it. */ | |
2351 if (UNBOUNDP (instance) | |
2352 && | |
2353 dest_mask & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK)) | |
2354 { | |
2355 if (!WINDOWP (domain)) | |
2356 signal_simple_error ("Can't instantiate subwindow outside a window", | |
2357 instantiator); | |
2358 instance = Fgethash (instantiator, | |
2359 XWINDOW (domain)->subwindow_instance_cache, | |
2360 Qunbound); | |
2361 } | |
2362 } | |
2138 | 2363 |
2139 if (UNBOUNDP (instance)) | 2364 if (UNBOUNDP (instance)) |
2140 { | 2365 { |
2141 Lisp_Object locative = | 2366 Lisp_Object locative = |
2142 noseeum_cons (Qnil, | 2367 noseeum_cons (Qnil, |
2143 noseeum_cons (pointerp ? ls3 : instantiator, | 2368 noseeum_cons (pointerp ? ls3 : instantiator, |
2144 subtable)); | 2369 subtable)); |
2145 int speccount = specpdl_depth (); | 2370 int speccount = specpdl_depth (); |
2146 | 2371 |
2147 /* make sure we cache the failures, too. | 2372 /* make sure we cache the failures, too. |
2148 Use an unwind-protect to catch such errors. | 2373 Use an unwind-protect to catch such errors. |
2149 If we fail, the unwind-protect records nil in | 2374 If we fail, the unwind-protect records nil in |
2150 the hash table. If we succeed, we change the | 2375 the hash table. If we succeed, we change the |
2151 car of the locative to the resulting instance, | 2376 car of the locative to the resulting instance, |
2155 instance = instantiate_image_instantiator (device, | 2380 instance = instantiate_image_instantiator (device, |
2156 domain, | 2381 domain, |
2157 instantiator, | 2382 instantiator, |
2158 pointer_fg, pointer_bg, | 2383 pointer_fg, pointer_bg, |
2159 dest_mask); | 2384 dest_mask); |
2385 | |
2160 Fsetcar (locative, instance); | 2386 Fsetcar (locative, instance); |
2387 /* only after the image has been instantiated do we know | |
2388 whether we need to put it in the per-window image instance | |
2389 cache. */ | |
2390 if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance)) | |
2391 & | |
2392 (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK)) | |
2393 { | |
2394 if (!WINDOWP (domain)) | |
2395 signal_simple_error ("Can't instantiate subwindow outside a window", | |
2396 instantiator); | |
2397 | |
2398 Fsetcdr (XCDR (locative), XWINDOW (domain)->subwindow_instance_cache ); | |
2399 } | |
2161 unbind_to (speccount, Qnil); | 2400 unbind_to (speccount, Qnil); |
2162 } | 2401 } |
2163 else | 2402 else |
2164 free_list (ls3); | 2403 free_list (ls3); |
2165 | 2404 |
2355 should be added.) | 2594 should be added.) |
2356 'formatted-string | 2595 'formatted-string |
2357 (Display this image as a text string, with replaceable fields; | 2596 (Display this image as a text string, with replaceable fields; |
2358 not currently implemented.) | 2597 not currently implemented.) |
2359 'xbm | 2598 'xbm |
2360 (An X bitmap; only if X support was compiled into this XEmacs. | 2599 (An X bitmap; only if X or Windows support was compiled into this XEmacs. |
2361 Can be instanced as `mono-pixmap', `color-pixmap', or `pointer'.) | 2600 Can be instanced as `mono-pixmap', `color-pixmap', or `pointer'.) |
2362 'xpm | 2601 'xpm |
2363 (An XPM pixmap; only if XPM support was compiled into this XEmacs. | 2602 (An XPM pixmap; only if XPM support was compiled into this XEmacs. |
2364 Can be instanced as `color-pixmap', `mono-pixmap', or `pointer'.) | 2603 Can be instanced as `color-pixmap', `mono-pixmap', or `pointer'.) |
2365 'xface | 2604 'xface |
2391 of the form "FONT fontname index [[mask-font] mask-index]". | 2630 of the form "FONT fontname index [[mask-font] mask-index]". |
2392 Currently can only be instanced as `pointer', although this should | 2631 Currently can only be instanced as `pointer', although this should |
2393 probably be fixed.) | 2632 probably be fixed.) |
2394 'subwindow | 2633 'subwindow |
2395 (An embedded X window; not currently implemented.) | 2634 (An embedded X window; not currently implemented.) |
2635 'widget | |
2636 (A widget control, for instance text field or radio button.) | |
2396 'autodetect | 2637 'autodetect |
2397 (XEmacs tries to guess what format the data is in. If X support | 2638 (XEmacs tries to guess what format the data is in. If X support |
2398 exists, the data string will be checked to see if it names a filename. | 2639 exists, the data string will be checked to see if it names a filename. |
2399 If so, and this filename contains XBM or XPM data, the appropriate | 2640 If so, and this filename contains XBM or XPM data, the appropriate |
2400 sort of pixmap or pointer will be created. [This includes picking up | 2641 sort of pixmap or pointer will be created. [This includes picking up |
2421 the resulting image-instance. This keyword is not valid for | 2662 the resulting image-instance. This keyword is not valid for |
2422 instantiator formats `nothing', `string', `formatted-string', | 2663 instantiator formats `nothing', `string', `formatted-string', |
2423 `cursor-font', `font', `autodetect', and `inherit'.) | 2664 `cursor-font', `font', `autodetect', and `inherit'.) |
2424 :foreground | 2665 :foreground |
2425 :background | 2666 :background |
2426 (For `xbm', `xface', `cursor-font', and `font'. These keywords | 2667 (For `xbm', `xface', `cursor-font', `widget' and `font'. These keywords |
2427 allow you to explicitly specify foreground and background colors. | 2668 allow you to explicitly specify foreground and background colors. |
2428 The argument should be anything acceptable to `make-color-instance'. | 2669 The argument should be anything acceptable to `make-color-instance'. |
2429 This will cause what would be a `mono-pixmap' to instead be colorized | 2670 This will cause what would be a `mono-pixmap' to instead be colorized |
2430 as a two-color color-pixmap, and specifies the foreground and/or | 2671 as a two-color color-pixmap, and specifies the foreground and/or |
2431 background colors for a pointer instead of black and white.) | 2672 background colors for a pointer instead of black and white.) |
2626 g->image = Fmake_specifier (Qimage); /* This function can GC */ | 2867 g->image = Fmake_specifier (Qimage); /* This function can GC */ |
2627 switch (g->type) | 2868 switch (g->type) |
2628 { | 2869 { |
2629 case GLYPH_BUFFER: | 2870 case GLYPH_BUFFER: |
2630 XIMAGE_SPECIFIER_ALLOWED (g->image) = | 2871 XIMAGE_SPECIFIER_ALLOWED (g->image) = |
2631 IMAGE_NOTHING_MASK | IMAGE_TEXT_MASK | IMAGE_MONO_PIXMAP_MASK | | 2872 IMAGE_NOTHING_MASK | IMAGE_TEXT_MASK |
2632 IMAGE_COLOR_PIXMAP_MASK | IMAGE_SUBWINDOW_MASK; | 2873 | IMAGE_MONO_PIXMAP_MASK | IMAGE_COLOR_PIXMAP_MASK |
2874 | IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK; | |
2633 break; | 2875 break; |
2634 case GLYPH_POINTER: | 2876 case GLYPH_POINTER: |
2635 XIMAGE_SPECIFIER_ALLOWED (g->image) = | 2877 XIMAGE_SPECIFIER_ALLOWED (g->image) = |
2636 IMAGE_NOTHING_MASK | IMAGE_POINTER_MASK; | 2878 IMAGE_NOTHING_MASK | IMAGE_POINTER_MASK; |
2637 break; | 2879 break; |
2823 | 3065 |
2824 case IMAGE_NOTHING: | 3066 case IMAGE_NOTHING: |
2825 return 0; | 3067 return 0; |
2826 | 3068 |
2827 case IMAGE_SUBWINDOW: | 3069 case IMAGE_SUBWINDOW: |
2828 /* #### implement me */ | 3070 case IMAGE_WIDGET: |
2829 return 0; | 3071 return XIMAGE_INSTANCE_SUBWINDOW_WIDTH (instance); |
2830 | 3072 |
2831 default: | 3073 default: |
2832 abort (); | 3074 abort (); |
2833 return 0; | 3075 return 0; |
2834 } | 3076 } |
2927 | 3169 |
2928 case IMAGE_NOTHING: | 3170 case IMAGE_NOTHING: |
2929 return 0; | 3171 return 0; |
2930 | 3172 |
2931 case IMAGE_SUBWINDOW: | 3173 case IMAGE_SUBWINDOW: |
2932 /* #### implement me */ | 3174 case IMAGE_WIDGET: |
2933 return 0; | 3175 /* #### Ugh ugh ugh -- temporary crap */ |
3176 if (function == RETURN_ASCENT || function == RETURN_HEIGHT) | |
3177 return XIMAGE_INSTANCE_SUBWINDOW_HEIGHT (instance); | |
3178 else | |
3179 return 0; | |
2934 | 3180 |
2935 default: | 3181 default: |
2936 abort (); | 3182 abort (); |
2937 return 0; | 3183 return 0; |
2938 } | 3184 } |
3198 return total; | 3444 return total; |
3199 } | 3445 } |
3200 | 3446 |
3201 #endif /* MEMORY_USAGE_STATS */ | 3447 #endif /* MEMORY_USAGE_STATS */ |
3202 | 3448 |
3449 | |
3450 | |
3451 /***************************************************************************** | |
3452 * subwindow cachel functions * | |
3453 *****************************************************************************/ | |
3454 /* subwindows are curious in that you have to physically unmap them to | |
3455 not display them. It is problematic deciding what to do in | |
3456 redisplay. We have two caches - a per-window instance cache that | |
3457 keeps track of subwindows on a window, these are linked to their | |
3458 instantiator in the hashtable and when the instantiator goes away | |
3459 we want the instance to go away also. However we also have a | |
3460 per-frame instance cache that we use to determine if a subwindow is | |
3461 obscuring an area that we want to clear. We need to be able to flip | |
3462 through this quickly so a hashtable is not suitable hence the | |
3463 subwindow_cachels. The question is should we just not mark | |
3464 instances in the subwindow_cachelsnor should we try and invalidate | |
3465 the cache at suitable points in redisplay? If we don't invalidate | |
3466 the cache it will fill up with crud that will only get removed when | |
3467 the frame is deleted. So invalidation is good, the question is when | |
3468 and whether we mark as well. Go for the simple option - don't mark, | |
3469 MARK_SUBWINDOWS_CHANGED when a subwindow gets deleted. */ | |
3470 | |
3471 void | |
3472 mark_subwindow_cachels (subwindow_cachel_dynarr *elements, | |
3473 void (*markobj) (Lisp_Object)) | |
3474 { | |
3475 int elt; | |
3476 | |
3477 if (!elements) | |
3478 return; | |
3479 | |
3480 for (elt = 0; elt < Dynarr_length (elements); elt++) | |
3481 { | |
3482 struct subwindow_cachel *cachel = Dynarr_atp (elements, elt); | |
3483 markobj (cachel->subwindow); | |
3484 } | |
3485 } | |
3486 | |
3487 static void | |
3488 update_subwindow_cachel_data (struct frame *f, Lisp_Object subwindow, | |
3489 struct subwindow_cachel *cachel) | |
3490 { | |
3491 if (NILP (cachel->subwindow) || !EQ (cachel->subwindow, subwindow)) | |
3492 { | |
3493 cachel->subwindow = subwindow; | |
3494 cachel->width = XIMAGE_INSTANCE_SUBWINDOW_WIDTH (subwindow); | |
3495 cachel->height = XIMAGE_INSTANCE_SUBWINDOW_HEIGHT (subwindow); | |
3496 } | |
3497 | |
3498 cachel->updated = 1; | |
3499 } | |
3500 | |
3501 static void | |
3502 add_subwindow_cachel (struct frame *f, Lisp_Object subwindow) | |
3503 { | |
3504 struct subwindow_cachel new_cachel; | |
3505 | |
3506 xzero (new_cachel); | |
3507 new_cachel.subwindow = Qnil; | |
3508 new_cachel.x=0; | |
3509 new_cachel.y=0; | |
3510 new_cachel.being_displayed=0; | |
3511 | |
3512 update_subwindow_cachel_data (f, subwindow, &new_cachel); | |
3513 Dynarr_add (f->subwindow_cachels, new_cachel); | |
3514 } | |
3515 | |
3516 static int | |
3517 get_subwindow_cachel_index (struct frame *f, Lisp_Object subwindow) | |
3518 { | |
3519 int elt; | |
3520 | |
3521 if (noninteractive) | |
3522 return 0; | |
3523 | |
3524 for (elt = 0; elt < Dynarr_length (f->subwindow_cachels); elt++) | |
3525 { | |
3526 struct subwindow_cachel *cachel = | |
3527 Dynarr_atp (f->subwindow_cachels, elt); | |
3528 | |
3529 if (EQ (cachel->subwindow, subwindow) && !NILP (subwindow)) | |
3530 { | |
3531 if (!cachel->updated) | |
3532 update_subwindow_cachel_data (f, subwindow, cachel); | |
3533 return elt; | |
3534 } | |
3535 } | |
3536 | |
3537 /* If we didn't find the glyph, add it and then return its index. */ | |
3538 add_subwindow_cachel (f, subwindow); | |
3539 return elt; | |
3540 } | |
3541 | |
3542 void | |
3543 reset_subwindow_cachels (struct frame *f) | |
3544 { | |
3545 Dynarr_reset (f->subwindow_cachels); | |
3546 } | |
3547 | |
3548 void | |
3549 mark_subwindow_cachels_as_not_updated (struct frame *f) | |
3550 { | |
3551 int elt; | |
3552 | |
3553 for (elt = 0; elt < Dynarr_length (f->subwindow_cachels); elt++) | |
3554 Dynarr_atp (f->subwindow_cachels, elt)->updated = 0; | |
3555 } | |
3556 | |
3557 | |
3558 /***************************************************************************** | |
3559 * subwindow functions * | |
3560 *****************************************************************************/ | |
3561 | |
3562 /* update the displayed characteristics of a subwindow */ | |
3563 static void | |
3564 update_subwindow (Lisp_Object subwindow) | |
3565 { | |
3566 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow); | |
3567 | |
3568 if (!IMAGE_INSTANCE_TYPE (ii) == IMAGE_WIDGET | |
3569 || | |
3570 NILP (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii))) | |
3571 return; | |
3572 | |
3573 MAYBE_DEVMETH (XDEVICE (ii->device), update_subwindow, (ii)); | |
3574 } | |
3575 | |
3576 void | |
3577 update_frame_subwindows (struct frame *f) | |
3578 { | |
3579 int elt; | |
3580 | |
3581 if (f->subwindows_changed || f->glyphs_changed) | |
3582 for (elt = 0; elt < Dynarr_length (f->subwindow_cachels); elt++) | |
3583 { | |
3584 struct subwindow_cachel *cachel = | |
3585 Dynarr_atp (f->subwindow_cachels, elt); | |
3586 | |
3587 if (cachel->being_displayed) | |
3588 { | |
3589 update_subwindow (cachel->subwindow); | |
3590 } | |
3591 } | |
3592 } | |
3593 | |
3594 /* remove a subwindow from its frame */ | |
3595 void unmap_subwindow (Lisp_Object subwindow) | |
3596 { | |
3597 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow); | |
3598 int elt; | |
3599 struct subwindow_cachel* cachel; | |
3600 struct frame* f; | |
3601 | |
3602 if (!(IMAGE_INSTANCE_TYPE (ii) == IMAGE_WIDGET | |
3603 || | |
3604 IMAGE_INSTANCE_TYPE (ii) == IMAGE_SUBWINDOW) | |
3605 || | |
3606 NILP (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii))) | |
3607 return; | |
3608 | |
3609 f = XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii)); | |
3610 elt = get_subwindow_cachel_index (f, subwindow); | |
3611 cachel = Dynarr_atp (f->subwindow_cachels, elt); | |
3612 | |
3613 cachel->x = -1; | |
3614 cachel->y = -1; | |
3615 cachel->being_displayed = 0; | |
3616 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0; | |
3617 | |
3618 MAYBE_DEVMETH (XDEVICE (ii->device), unmap_subwindow, (ii)); | |
3619 } | |
3620 | |
3621 /* show a subwindow in its frame */ | |
3622 void map_subwindow (Lisp_Object subwindow, int x, int y) | |
3623 { | |
3624 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow); | |
3625 int elt; | |
3626 struct subwindow_cachel* cachel; | |
3627 struct frame* f; | |
3628 | |
3629 if (!(IMAGE_INSTANCE_TYPE (ii) == IMAGE_WIDGET | |
3630 || | |
3631 IMAGE_INSTANCE_TYPE (ii) == IMAGE_SUBWINDOW) | |
3632 || | |
3633 NILP (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii))) | |
3634 return; | |
3635 | |
3636 f = XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii)); | |
3637 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 1; | |
3638 elt = get_subwindow_cachel_index (f, subwindow); | |
3639 cachel = Dynarr_atp (f->subwindow_cachels, elt); | |
3640 cachel->x = x; | |
3641 cachel->y = y; | |
3642 cachel->being_displayed = 1; | |
3643 | |
3644 MAYBE_DEVMETH (XDEVICE (ii->device), map_subwindow, (ii, x, y)); | |
3645 } | |
3646 | |
3647 static int | |
3648 subwindow_possible_dest_types (void) | |
3649 { | |
3650 return IMAGE_SUBWINDOW_MASK; | |
3651 } | |
3652 | |
3653 /* Partially instantiate a subwindow. */ | |
3654 void | |
3655 subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | |
3656 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | |
3657 int dest_mask, Lisp_Object domain) | |
3658 { | |
3659 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | |
3660 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | |
3661 Lisp_Object frame = FW_FRAME (domain); | |
3662 Lisp_Object width = find_keyword_in_vector (instantiator, Q_pixel_width); | |
3663 Lisp_Object height = find_keyword_in_vector (instantiator, Q_pixel_height); | |
3664 | |
3665 if (NILP (frame)) | |
3666 signal_simple_error ("No selected frame", device); | |
3667 | |
3668 if (!(dest_mask & IMAGE_SUBWINDOW_MASK)) | |
3669 incompatible_image_types (instantiator, dest_mask, IMAGE_SUBWINDOW_MASK); | |
3670 | |
3671 ii->data = 0; | |
3672 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = 0; | |
3673 IMAGE_INSTANCE_SUBWINDOW_FRAME (ii) = Qnil; | |
3674 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0; | |
3675 IMAGE_INSTANCE_SUBWINDOW_FRAME (ii) = frame; | |
3676 | |
3677 /* this stuff may get overidden by the widget code */ | |
3678 if (NILP (width)) | |
3679 IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii) = 20; | |
3680 else | |
3681 { | |
3682 int w = 1; | |
3683 CHECK_INT (width); | |
3684 if (XINT (width) > 1) | |
3685 w = XINT (width); | |
3686 IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii) = w; | |
3687 } | |
3688 if (NILP (height)) | |
3689 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii) = 20; | |
3690 else | |
3691 { | |
3692 int h = 1; | |
3693 CHECK_INT (height); | |
3694 if (XINT (height) > 1) | |
3695 h = XINT (height); | |
3696 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii) = h; | |
3697 } | |
3698 } | |
3699 | |
3700 DEFUN ("subwindowp", Fsubwindowp, 1, 1, 0, /* | |
3701 Return non-nil if OBJECT is a subwindow. | |
3702 */ | |
3703 (object)) | |
3704 { | |
3705 CHECK_IMAGE_INSTANCE (object); | |
3706 return (XIMAGE_INSTANCE_TYPE (object) == IMAGE_SUBWINDOW) ? Qt : Qnil; | |
3707 } | |
3708 | |
3709 DEFUN ("image-instance-subwindow-id", Fimage_instance_subwindow_id, 1, 1, 0, /* | |
3710 Return the window id of SUBWINDOW as a number. | |
3711 */ | |
3712 (subwindow)) | |
3713 { | |
3714 CHECK_SUBWINDOW_IMAGE_INSTANCE (subwindow); | |
3715 return make_int ((int) (XIMAGE_INSTANCE_SUBWINDOW_ID (subwindow))); | |
3716 } | |
3717 | |
3718 DEFUN ("resize-subwindow", Fresize_subwindow, 1, 3, 0, /* | |
3719 Resize SUBWINDOW to WIDTH x HEIGHT. | |
3720 If a value is nil that parameter is not changed. | |
3721 */ | |
3722 (subwindow, width, height)) | |
3723 { | |
3724 int neww, newh; | |
3725 | |
3726 CHECK_SUBWINDOW_IMAGE_INSTANCE (subwindow); | |
3727 | |
3728 if (NILP (width)) | |
3729 neww = XIMAGE_INSTANCE_SUBWINDOW_WIDTH (subwindow); | |
3730 else | |
3731 neww = XINT (width); | |
3732 | |
3733 if (NILP (height)) | |
3734 newh = XIMAGE_INSTANCE_SUBWINDOW_HEIGHT (subwindow); | |
3735 else | |
3736 newh = XINT (height); | |
3737 | |
3738 | |
3739 MAYBE_DEVMETH (XDEVICE (XIMAGE_INSTANCE_DEVICE (subwindow)), | |
3740 resize_subwindow, (XIMAGE_INSTANCE (subwindow), neww, newh)); | |
3741 | |
3742 XIMAGE_INSTANCE_SUBWINDOW_HEIGHT (subwindow) = newh; | |
3743 XIMAGE_INSTANCE_SUBWINDOW_WIDTH (subwindow) = neww; | |
3744 | |
3745 return subwindow; | |
3746 } | |
3747 | |
3748 DEFUN ("force-subwindow-map", Fforce_subwindow_map, 1, 1, 0, /* | |
3749 Generate a Map event for SUBWINDOW. | |
3750 */ | |
3751 (subwindow)) | |
3752 { | |
3753 CHECK_SUBWINDOW_IMAGE_INSTANCE (subwindow); | |
3754 | |
3755 map_subwindow (subwindow, 0, 0); | |
3756 | |
3757 return subwindow; | |
3758 } | |
3759 | |
3203 | 3760 |
3204 /***************************************************************************** | 3761 /***************************************************************************** |
3205 * display tables * | 3762 * display tables * |
3206 *****************************************************************************/ | 3763 *****************************************************************************/ |
3207 | 3764 |
3208 /* Get the display table for use currently on window W with face FACE. | 3765 /* Get the display tables for use currently on window W with face |
3209 Precedence: | 3766 FACE. #### This will have to be redone. */ |
3210 | 3767 |
3211 -- FACE's display table | 3768 void |
3212 -- W's display table (comes from specifier `current-display-table') | 3769 get_display_tables (struct window *w, face_index findex, |
3213 | 3770 Lisp_Object *face_table, Lisp_Object *window_table) |
3214 Ignore the specified tables if they are not valid; | |
3215 if no valid table is specified, return 0. */ | |
3216 | |
3217 struct Lisp_Vector * | |
3218 get_display_table (struct window *w, face_index findex) | |
3219 { | 3771 { |
3220 Lisp_Object tem; | 3772 Lisp_Object tem; |
3221 | |
3222 tem = WINDOW_FACE_CACHEL_DISPLAY_TABLE (w, findex); | 3773 tem = WINDOW_FACE_CACHEL_DISPLAY_TABLE (w, findex); |
3223 if (VECTORP (tem) && XVECTOR_LENGTH (tem) == DISP_TABLE_SIZE) | 3774 if (UNBOUNDP (tem)) |
3224 return XVECTOR (tem); | 3775 tem = Qnil; |
3225 | 3776 if (!LISTP (tem)) |
3777 tem = noseeum_cons (tem, Qnil); | |
3778 *face_table = tem; | |
3226 tem = w->display_table; | 3779 tem = w->display_table; |
3227 if (VECTORP (tem) && XVECTOR_LENGTH (tem) == DISP_TABLE_SIZE) | 3780 if (UNBOUNDP (tem)) |
3228 return XVECTOR (tem); | 3781 tem = Qnil; |
3229 | 3782 if (!LISTP (tem)) |
3230 return 0; | 3783 tem = noseeum_cons (tem, Qnil); |
3231 } | 3784 *window_table = tem; |
3232 | 3785 } |
3786 | |
3787 Lisp_Object | |
3788 display_table_entry (Emchar ch, Lisp_Object face_table, | |
3789 Lisp_Object window_table) | |
3790 { | |
3791 Lisp_Object tail; | |
3792 | |
3793 /* Loop over FACE_TABLE, and then over WINDOW_TABLE. */ | |
3794 for (tail = face_table; 1; tail = XCDR (tail)) | |
3795 { | |
3796 Lisp_Object table; | |
3797 if (NILP (tail)) | |
3798 { | |
3799 if (!NILP (window_table)) | |
3800 { | |
3801 tail = window_table; | |
3802 window_table = Qnil; | |
3803 } | |
3804 else | |
3805 return Qnil; | |
3806 } | |
3807 table = XCAR (tail); | |
3808 | |
3809 if (VECTORP (table)) | |
3810 { | |
3811 if (ch < XVECTOR_LENGTH (table) && !NILP (XVECTOR_DATA (table)[ch])) | |
3812 return XVECTOR_DATA (table)[ch]; | |
3813 else | |
3814 continue; | |
3815 } | |
3816 else if (CHAR_TABLEP (table) | |
3817 && XCHAR_TABLE_TYPE (table) == CHAR_TABLE_TYPE_CHAR) | |
3818 { | |
3819 return get_char_table (ch, XCHAR_TABLE (table)); | |
3820 } | |
3821 else if (CHAR_TABLEP (table) | |
3822 && XCHAR_TABLE_TYPE (table) == CHAR_TABLE_TYPE_GENERIC) | |
3823 { | |
3824 Lisp_Object gotit = get_char_table (ch, XCHAR_TABLE (table)); | |
3825 if (!NILP (gotit)) | |
3826 return gotit; | |
3827 else | |
3828 continue; | |
3829 } | |
3830 else if (RANGE_TABLEP (table)) | |
3831 { | |
3832 Lisp_Object gotit = Fget_range_table (make_char (ch), table, Qnil); | |
3833 if (!NILP (gotit)) | |
3834 return gotit; | |
3835 else | |
3836 continue; | |
3837 } | |
3838 else | |
3839 abort (); | |
3840 } | |
3841 } | |
3233 | 3842 |
3234 /***************************************************************************** | 3843 /***************************************************************************** |
3235 * initialization * | 3844 * initialization * |
3236 *****************************************************************************/ | 3845 *****************************************************************************/ |
3237 | 3846 |
3246 DEFSUBR (Fconsole_type_image_conversion_list); | 3855 DEFSUBR (Fconsole_type_image_conversion_list); |
3247 | 3856 |
3248 defkeyword (&Q_file, ":file"); | 3857 defkeyword (&Q_file, ":file"); |
3249 defkeyword (&Q_data, ":data"); | 3858 defkeyword (&Q_data, ":data"); |
3250 defkeyword (&Q_face, ":face"); | 3859 defkeyword (&Q_face, ":face"); |
3860 defkeyword (&Q_pixel_height, ":pixel-height"); | |
3861 defkeyword (&Q_pixel_width, ":pixel-width"); | |
3251 | 3862 |
3252 #ifdef HAVE_XPM | 3863 #ifdef HAVE_XPM |
3253 defkeyword (&Q_color_symbols, ":color-symbols"); | 3864 defkeyword (&Q_color_symbols, ":color-symbols"); |
3254 #endif | 3865 #endif |
3255 #ifdef HAVE_WINDOW_SYSTEM | 3866 #ifdef HAVE_WINDOW_SYSTEM |
3272 defsymbol (&Qnothing_image_instance_p, "nothing-image-instance-p"); | 3883 defsymbol (&Qnothing_image_instance_p, "nothing-image-instance-p"); |
3273 defsymbol (&Qtext_image_instance_p, "text-image-instance-p"); | 3884 defsymbol (&Qtext_image_instance_p, "text-image-instance-p"); |
3274 defsymbol (&Qmono_pixmap_image_instance_p, "mono-pixmap-image-instance-p"); | 3885 defsymbol (&Qmono_pixmap_image_instance_p, "mono-pixmap-image-instance-p"); |
3275 defsymbol (&Qcolor_pixmap_image_instance_p, "color-pixmap-image-instance-p"); | 3886 defsymbol (&Qcolor_pixmap_image_instance_p, "color-pixmap-image-instance-p"); |
3276 defsymbol (&Qpointer_image_instance_p, "pointer-image-instance-p"); | 3887 defsymbol (&Qpointer_image_instance_p, "pointer-image-instance-p"); |
3888 defsymbol (&Qwidget_image_instance_p, "widget-image-instance-p"); | |
3277 defsymbol (&Qsubwindow_image_instance_p, "subwindow-image-instance-p"); | 3889 defsymbol (&Qsubwindow_image_instance_p, "subwindow-image-instance-p"); |
3278 | 3890 |
3279 DEFSUBR (Fmake_image_instance); | 3891 DEFSUBR (Fmake_image_instance); |
3280 DEFSUBR (Fimage_instance_p); | 3892 DEFSUBR (Fimage_instance_p); |
3281 DEFSUBR (Fimage_instance_type); | 3893 DEFSUBR (Fimage_instance_type); |
3290 DEFSUBR (Fimage_instance_width); | 3902 DEFSUBR (Fimage_instance_width); |
3291 DEFSUBR (Fimage_instance_hotspot_x); | 3903 DEFSUBR (Fimage_instance_hotspot_x); |
3292 DEFSUBR (Fimage_instance_hotspot_y); | 3904 DEFSUBR (Fimage_instance_hotspot_y); |
3293 DEFSUBR (Fimage_instance_foreground); | 3905 DEFSUBR (Fimage_instance_foreground); |
3294 DEFSUBR (Fimage_instance_background); | 3906 DEFSUBR (Fimage_instance_background); |
3907 DEFSUBR (Fimage_instance_property); | |
3908 DEFSUBR (Fset_image_instance_property); | |
3295 DEFSUBR (Fcolorize_image_instance); | 3909 DEFSUBR (Fcolorize_image_instance); |
3910 /* subwindows */ | |
3911 DEFSUBR (Fsubwindowp); | |
3912 DEFSUBR (Fimage_instance_subwindow_id); | |
3913 DEFSUBR (Fresize_subwindow); | |
3914 DEFSUBR (Fforce_subwindow_map); | |
3296 | 3915 |
3297 /* Qnothing defined as part of the "nothing" image-instantiator | 3916 /* Qnothing defined as part of the "nothing" image-instantiator |
3298 type. */ | 3917 type. */ |
3299 /* Qtext defined in general.c */ | 3918 /* Qtext defined in general.c */ |
3300 defsymbol (&Qmono_pixmap, "mono-pixmap"); | 3919 defsymbol (&Qmono_pixmap, "mono-pixmap"); |
3301 defsymbol (&Qcolor_pixmap, "color-pixmap"); | 3920 defsymbol (&Qcolor_pixmap, "color-pixmap"); |
3302 /* Qpointer defined in general.c */ | 3921 /* Qpointer defined in general.c */ |
3303 defsymbol (&Qsubwindow, "subwindow"); | |
3304 | 3922 |
3305 /* glyphs */ | 3923 /* glyphs */ |
3306 | 3924 |
3307 defsymbol (&Qglyphp, "glyphp"); | 3925 defsymbol (&Qglyphp, "glyphp"); |
3308 defsymbol (&Qcontrib_p, "contrib-p"); | 3926 defsymbol (&Qcontrib_p, "contrib-p"); |
3388 IIFORMAT_HAS_METHOD (formatted_string, possible_dest_types); | 4006 IIFORMAT_HAS_METHOD (formatted_string, possible_dest_types); |
3389 IIFORMAT_HAS_METHOD (formatted_string, instantiate); | 4007 IIFORMAT_HAS_METHOD (formatted_string, instantiate); |
3390 | 4008 |
3391 IIFORMAT_VALID_KEYWORD (formatted_string, Q_data, check_valid_string); | 4009 IIFORMAT_VALID_KEYWORD (formatted_string, Q_data, check_valid_string); |
3392 | 4010 |
4011 /* subwindows */ | |
4012 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (subwindow, "subwindow"); | |
4013 IIFORMAT_HAS_METHOD (subwindow, possible_dest_types); | |
4014 IIFORMAT_HAS_METHOD (subwindow, instantiate); | |
4015 IIFORMAT_VALID_KEYWORD (subwindow, Q_pixel_width, check_valid_int); | |
4016 IIFORMAT_VALID_KEYWORD (subwindow, Q_pixel_height, check_valid_int); | |
4017 | |
3393 #ifdef HAVE_WINDOW_SYSTEM | 4018 #ifdef HAVE_WINDOW_SYSTEM |
3394 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xbm, "xbm"); | 4019 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xbm, "xbm"); |
3395 | 4020 |
3396 IIFORMAT_HAS_METHOD (xbm, validate); | 4021 IIFORMAT_HAS_METHOD (xbm, validate); |
3397 IIFORMAT_HAS_METHOD (xbm, normalize); | 4022 IIFORMAT_HAS_METHOD (xbm, normalize); |
3398 IIFORMAT_HAS_METHOD (xbm, possible_dest_types); | 4023 IIFORMAT_HAS_METHOD (xbm, possible_dest_types); |
3399 IIFORMAT_HAS_METHOD (xbm, instantiate); | |
3400 | 4024 |
3401 IIFORMAT_VALID_KEYWORD (xbm, Q_data, check_valid_xbm_inline); | 4025 IIFORMAT_VALID_KEYWORD (xbm, Q_data, check_valid_xbm_inline); |
3402 IIFORMAT_VALID_KEYWORD (xbm, Q_file, check_valid_string); | 4026 IIFORMAT_VALID_KEYWORD (xbm, Q_file, check_valid_string); |
3403 IIFORMAT_VALID_KEYWORD (xbm, Q_mask_data, check_valid_xbm_inline); | 4027 IIFORMAT_VALID_KEYWORD (xbm, Q_mask_data, check_valid_xbm_inline); |
3404 IIFORMAT_VALID_KEYWORD (xbm, Q_mask_file, check_valid_string); | 4028 IIFORMAT_VALID_KEYWORD (xbm, Q_mask_file, check_valid_string); |
3412 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xpm, "xpm"); | 4036 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xpm, "xpm"); |
3413 | 4037 |
3414 IIFORMAT_HAS_METHOD (xpm, validate); | 4038 IIFORMAT_HAS_METHOD (xpm, validate); |
3415 IIFORMAT_HAS_METHOD (xpm, normalize); | 4039 IIFORMAT_HAS_METHOD (xpm, normalize); |
3416 IIFORMAT_HAS_METHOD (xpm, possible_dest_types); | 4040 IIFORMAT_HAS_METHOD (xpm, possible_dest_types); |
3417 IIFORMAT_HAS_METHOD (xpm, instantiate); | |
3418 | 4041 |
3419 IIFORMAT_VALID_KEYWORD (xpm, Q_data, check_valid_string); | 4042 IIFORMAT_VALID_KEYWORD (xpm, Q_data, check_valid_string); |
3420 IIFORMAT_VALID_KEYWORD (xpm, Q_file, check_valid_string); | 4043 IIFORMAT_VALID_KEYWORD (xpm, Q_file, check_valid_string); |
3421 IIFORMAT_VALID_KEYWORD (xpm, Q_color_symbols, check_valid_xpm_color_symbols); | 4044 IIFORMAT_VALID_KEYWORD (xpm, Q_color_symbols, check_valid_xpm_color_symbols); |
3422 #endif /* HAVE_XPM */ | 4045 #endif /* HAVE_XPM */ |
3428 Vthe_nothing_vector = vector1 (Qnothing); | 4051 Vthe_nothing_vector = vector1 (Qnothing); |
3429 staticpro (&Vthe_nothing_vector); | 4052 staticpro (&Vthe_nothing_vector); |
3430 | 4053 |
3431 /* image instances */ | 4054 /* image instances */ |
3432 | 4055 |
3433 Vimage_instance_type_list = list6 (Qnothing, Qtext, Qmono_pixmap, | 4056 Vimage_instance_type_list = Fcons (Qnothing, |
3434 Qcolor_pixmap, Qpointer, Qsubwindow); | 4057 list6 (Qtext, Qmono_pixmap, Qcolor_pixmap, |
4058 Qpointer, Qsubwindow, Qwidget)); | |
3435 staticpro (&Vimage_instance_type_list); | 4059 staticpro (&Vimage_instance_type_list); |
3436 | 4060 |
3437 /* glyphs */ | 4061 /* glyphs */ |
3438 | 4062 |
3439 Vglyph_type_list = list3 (Qbuffer, Qpointer, Qicon); | 4063 Vglyph_type_list = list3 (Qbuffer, Qpointer, Qicon); |
3465 /* Partially initialized in glyphs.el */ | 4089 /* Partially initialized in glyphs.el */ |
3466 DEFVAR_LISP ("hscroll-glyph", &Vhscroll_glyph /* | 4090 DEFVAR_LISP ("hscroll-glyph", &Vhscroll_glyph /* |
3467 What to display at the beginning of horizontally scrolled lines. | 4091 What to display at the beginning of horizontally scrolled lines. |
3468 */); | 4092 */); |
3469 Vhscroll_glyph = allocate_glyph (GLYPH_BUFFER, redisplay_glyph_changed); | 4093 Vhscroll_glyph = allocate_glyph (GLYPH_BUFFER, redisplay_glyph_changed); |
3470 | 4094 #ifdef HAVE_WINDOW_SYSTEM |
4095 Fprovide (Qxbm); | |
4096 #endif | |
3471 #ifdef HAVE_XPM | 4097 #ifdef HAVE_XPM |
3472 Fprovide (Qxpm); | 4098 Fprovide (Qxpm); |
3473 | 4099 |
3474 DEFVAR_LISP ("xpm-color-symbols", &Vxpm_color_symbols /* | 4100 DEFVAR_LISP ("xpm-color-symbols", &Vxpm_color_symbols /* |
3475 Definitions of logical color-names used when reading XPM files. | 4101 Definitions of logical color-names used when reading XPM files. |