Mercurial > hg > xemacs-beta
comparison src/glyphs.c @ 410:de805c49cfc1 r21-2-35
Import from CVS: tag r21-2-35
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:19:21 +0200 |
parents | 501cfd01ee6d |
children | 697ef44129c6 |
comparison
equal
deleted
inserted
replaced
409:301b9ebbdf3b | 410:de805c49cfc1 |
---|---|
722 IMAGE_INSTANCE_TEXT_CHANGED (p) = 0; | 722 IMAGE_INSTANCE_TEXT_CHANGED (p) = 0; |
723 IMAGE_INSTANCE_SIZE_CHANGED (p) = 0; | 723 IMAGE_INSTANCE_SIZE_CHANGED (p) = 0; |
724 IMAGE_INSTANCE_LAYOUT_CHANGED (p) = 0; | 724 IMAGE_INSTANCE_LAYOUT_CHANGED (p) = 0; |
725 IMAGE_INSTANCE_DIRTYP (p) = 0; | 725 IMAGE_INSTANCE_DIRTYP (p) = 0; |
726 | 726 |
727 assert ( XIMAGE_INSTANCE_HEIGHT (ii) | 727 assert ( XIMAGE_INSTANCE_HEIGHT (ii) >= 0 |
728 != IMAGE_UNSPECIFIED_GEOMETRY | 728 && XIMAGE_INSTANCE_WIDTH (ii) >= 0 ); |
729 && XIMAGE_INSTANCE_WIDTH (ii) | |
730 != IMAGE_UNSPECIFIED_GEOMETRY); | |
731 | 729 |
732 ERROR_CHECK_IMAGE_INSTANCE (ii); | 730 ERROR_CHECK_IMAGE_INSTANCE (ii); |
733 | 731 |
734 RETURN_UNGCPRO (ii); | 732 RETURN_UNGCPRO (ii); |
735 } | 733 } |
1893 | 1891 |
1894 /* Find out desired geometry of the image instance. If there is no | 1892 /* Find out desired geometry of the image instance. If there is no |
1895 special function then just return the width and / or height. */ | 1893 special function then just return the width and / or height. */ |
1896 void | 1894 void |
1897 image_instance_query_geometry (Lisp_Object image_instance, | 1895 image_instance_query_geometry (Lisp_Object image_instance, |
1898 unsigned int* width, unsigned int* height, | 1896 int* width, int* height, |
1899 enum image_instance_geometry disp, | 1897 enum image_instance_geometry disp, |
1900 Lisp_Object domain) | 1898 Lisp_Object domain) |
1901 { | 1899 { |
1902 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); | 1900 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); |
1903 Lisp_Object type; | 1901 Lisp_Object type; |
1928 approach is to consider separately the two cases, one where you | 1926 approach is to consider separately the two cases, one where you |
1929 don't mind what size you have (normal widgets) and one where you | 1927 don't mind what size you have (normal widgets) and one where you |
1930 want to specifiy something (layout widgets). */ | 1928 want to specifiy something (layout widgets). */ |
1931 void | 1929 void |
1932 image_instance_layout (Lisp_Object image_instance, | 1930 image_instance_layout (Lisp_Object image_instance, |
1933 unsigned int width, unsigned int height, | 1931 int width, int height, Lisp_Object domain) |
1934 Lisp_Object domain) | |
1935 { | 1932 { |
1936 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); | 1933 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); |
1937 Lisp_Object type; | 1934 Lisp_Object type; |
1938 struct image_instantiator_methods* meths; | 1935 struct image_instantiator_methods* meths; |
1939 | 1936 |
1949 /* If geometry is unspecified then get some reasonable values for it. */ | 1946 /* If geometry is unspecified then get some reasonable values for it. */ |
1950 if (width == IMAGE_UNSPECIFIED_GEOMETRY | 1947 if (width == IMAGE_UNSPECIFIED_GEOMETRY |
1951 || | 1948 || |
1952 height == IMAGE_UNSPECIFIED_GEOMETRY) | 1949 height == IMAGE_UNSPECIFIED_GEOMETRY) |
1953 { | 1950 { |
1954 unsigned int dwidth = IMAGE_UNSPECIFIED_GEOMETRY, | 1951 int dwidth = IMAGE_UNSPECIFIED_GEOMETRY; |
1955 dheight = IMAGE_UNSPECIFIED_GEOMETRY; | 1952 int dheight = IMAGE_UNSPECIFIED_GEOMETRY; |
1956 | 1953 |
1957 /* Get the desired geometry. */ | 1954 /* Get the desired geometry. */ |
1958 if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry)) | 1955 if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry)) |
1959 { | 1956 { |
1960 IIFORMAT_METH (meths, query_geometry, (image_instance, &dwidth, &dheight, | 1957 IIFORMAT_METH (meths, query_geometry, (image_instance, &dwidth, &dheight, |
2159 everything. Note that the following methods are for text not string | 2156 everything. Note that the following methods are for text not string |
2160 since that is what the instantiated type is. The first method is a | 2157 since that is what the instantiated type is. The first method is a |
2161 helper that is used elsewhere for calculating text geometry. */ | 2158 helper that is used elsewhere for calculating text geometry. */ |
2162 void | 2159 void |
2163 query_string_geometry (Lisp_Object string, Lisp_Object face, | 2160 query_string_geometry (Lisp_Object string, Lisp_Object face, |
2164 unsigned int* width, unsigned int* height, | 2161 int* width, int* height, int* descent, Lisp_Object domain) |
2165 unsigned int* descent, Lisp_Object domain) | |
2166 { | 2162 { |
2167 struct font_metric_info fm; | 2163 struct font_metric_info fm; |
2168 unsigned char charsets[NUM_LEADING_BYTES]; | 2164 unsigned char charsets[NUM_LEADING_BYTES]; |
2169 struct face_cachel frame_cachel; | 2165 struct face_cachel frame_cachel; |
2170 struct face_cachel *cachel; | 2166 struct face_cachel *cachel; |
2248 return Qnil; /* NOT REACHED */ | 2244 return Qnil; /* NOT REACHED */ |
2249 } | 2245 } |
2250 | 2246 |
2251 static void | 2247 static void |
2252 text_query_geometry (Lisp_Object image_instance, | 2248 text_query_geometry (Lisp_Object image_instance, |
2253 unsigned int* width, unsigned int* height, | 2249 int* width, int* height, |
2254 enum image_instance_geometry disp, Lisp_Object domain) | 2250 enum image_instance_geometry disp, Lisp_Object domain) |
2255 { | 2251 { |
2256 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 2252 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
2257 unsigned int descent = 0; | 2253 int descent = 0; |
2258 | 2254 |
2259 query_string_geometry (IMAGE_INSTANCE_TEXT_STRING (ii), | 2255 query_string_geometry (IMAGE_INSTANCE_TEXT_STRING (ii), |
2260 IMAGE_INSTANCE_FACE (ii), | 2256 IMAGE_INSTANCE_FACE (ii), |
2261 width, height, &descent, domain); | 2257 width, height, &descent, domain); |
2262 | 2258 |
3013 (Fget_face (XVECTOR_DATA (instantiator)[2]), | 3009 (Fget_face (XVECTOR_DATA (instantiator)[2]), |
3014 Qbackground_pixmap, domain, 0, depth)); | 3010 Qbackground_pixmap, domain, 0, depth)); |
3015 } | 3011 } |
3016 else | 3012 else |
3017 { | 3013 { |
3018 Lisp_Object instance; | 3014 Lisp_Object instance = Qnil; |
3019 Lisp_Object subtable; | 3015 Lisp_Object subtable = Qnil; |
3020 Lisp_Object ls3 = Qnil; | 3016 Lisp_Object ls3 = Qnil; |
3021 Lisp_Object pointer_fg = Qnil; | 3017 Lisp_Object pointer_fg = Qnil; |
3022 Lisp_Object pointer_bg = Qnil; | 3018 Lisp_Object pointer_bg = Qnil; |
3023 Lisp_Object governing_domain = | 3019 Lisp_Object governing_domain = |
3024 get_image_instantiator_governing_domain (instantiator, domain); | 3020 get_image_instantiator_governing_domain (instantiator, domain); |
3021 struct gcpro gcpro1; | |
3022 | |
3023 GCPRO1 (instance); | |
3025 | 3024 |
3026 /* We have to put subwindow, widget and text image instances in | 3025 /* We have to put subwindow, widget and text image instances in |
3027 a per-window cache so that we can see the same glyph in | 3026 a per-window cache so that we can see the same glyph in |
3028 different windows. We use governing_domain to determine the type | 3027 different windows. We use governing_domain to determine the type |
3029 of image_instance that will be created. */ | 3028 of image_instance that will be created. */ |
3144 & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK)) | 3143 & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK)) |
3145 assert (EQ (XIMAGE_INSTANCE_FRAME (instance), | 3144 assert (EQ (XIMAGE_INSTANCE_FRAME (instance), |
3146 DOMAIN_FRAME (domain))); | 3145 DOMAIN_FRAME (domain))); |
3147 #endif | 3146 #endif |
3148 ERROR_CHECK_IMAGE_INSTANCE (instance); | 3147 ERROR_CHECK_IMAGE_INSTANCE (instance); |
3149 return instance; | 3148 RETURN_UNGCPRO (instance); |
3150 } | 3149 } |
3151 | 3150 |
3152 abort (); | 3151 abort (); |
3153 return Qnil; /* not reached */ | 3152 return Qnil; /* not reached */ |
3154 } | 3153 } |
4148 removed automatically. */ | 4147 removed automatically. */ |
4149 static void | 4148 static void |
4150 cache_subwindow_instance_in_frame_maybe (Lisp_Object instance) | 4149 cache_subwindow_instance_in_frame_maybe (Lisp_Object instance) |
4151 { | 4150 { |
4152 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (instance); | 4151 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (instance); |
4153 if (image_instance_type_to_mask (IMAGE_INSTANCE_TYPE (ii)) | 4152 if (!NILP (DOMAIN_FRAME (IMAGE_INSTANCE_DOMAIN (ii)))) |
4154 & (IMAGE_WIDGET_MASK | IMAGE_SUBWINDOW_MASK)) | |
4155 { | 4153 { |
4156 struct frame* f = DOMAIN_XFRAME (IMAGE_INSTANCE_DOMAIN (ii)); | 4154 struct frame* f = DOMAIN_XFRAME (IMAGE_INSTANCE_DOMAIN (ii)); |
4157 XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)) | 4155 XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)) |
4158 = Fcons (instance, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))); | 4156 = Fcons (instance, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))); |
4159 } | 4157 } |
4529 } | 4527 } |
4530 | 4528 |
4531 /* This is just a backup in case no-one has assigned a suitable geometry. | 4529 /* This is just a backup in case no-one has assigned a suitable geometry. |
4532 #### It should really query the enclose window for geometry. */ | 4530 #### It should really query the enclose window for geometry. */ |
4533 static void | 4531 static void |
4534 subwindow_query_geometry (Lisp_Object image_instance, unsigned int* width, | 4532 subwindow_query_geometry (Lisp_Object image_instance, int* width, |
4535 unsigned int* height, enum image_instance_geometry disp, | 4533 int* height, enum image_instance_geometry disp, |
4536 Lisp_Object domain) | 4534 Lisp_Object domain) |
4537 { | 4535 { |
4538 if (width) *width = 20; | 4536 if (width) *width = 20; |
4539 if (height) *height = 20; | 4537 if (height) *height = 20; |
4540 } | 4538 } |