comparison src/glyphs.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents fdefd0186b75
children e38acbeb1cae
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
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, 2000 Ben Wing 4 Copyright (C) 1995, 1996, 2000, 2001 Ben Wing
5 Copyright (C) 1995 Sun Microsystems 5 Copyright (C) 1995 Sun Microsystems
6 Copyright (C) 1998, 1999, 2000 Andy Piper 6 Copyright (C) 1998, 1999, 2000 Andy Piper
7 7
8 This file is part of XEmacs. 8 This file is part of XEmacs.
9 9
43 #include "opaque.h" 43 #include "opaque.h"
44 #include "rangetab.h" 44 #include "rangetab.h"
45 #include "redisplay.h" 45 #include "redisplay.h"
46 #include "specifier.h" 46 #include "specifier.h"
47 #include "window.h" 47 #include "window.h"
48
49 #include "sysfile.h"
48 50
49 #if defined (HAVE_XPM) && !defined (HAVE_GTK) 51 #if defined (HAVE_XPM) && !defined (HAVE_GTK)
50 #include <X11/xpm.h> 52 #include <X11/xpm.h>
51 #endif 53 #endif
52 54
580 set_buffer_internal (XBUFFER (temp_buffer)); 582 set_buffer_internal (XBUFFER (temp_buffer));
581 Ferase_buffer (Qnil); 583 Ferase_buffer (Qnil);
582 specbind (intern ("format-alist"), Qnil); 584 specbind (intern ("format-alist"), Qnil);
583 Finsert_file_contents_internal (file, Qnil, Qnil, Qnil, Qnil, Qnil, Qnil); 585 Finsert_file_contents_internal (file, Qnil, Qnil, Qnil, Qnil, Qnil, Qnil);
584 data = Fbuffer_substring (Qnil, Qnil, Qnil); 586 data = Fbuffer_substring (Qnil, Qnil, Qnil);
585 unbind_to (count, Qnil); 587 unbind_to (count);
586 UNGCPRO; 588 UNGCPRO;
587 return data; 589 return data;
588 } 590 }
589 591
590 /* The following two functions are provided to make it easier for 592 /* The following two functions are provided to make it easier for
931 case IMAGE_MONO_PIXMAP: 933 case IMAGE_MONO_PIXMAP:
932 case IMAGE_COLOR_PIXMAP: 934 case IMAGE_COLOR_PIXMAP:
933 case IMAGE_POINTER: 935 case IMAGE_POINTER:
934 if (STRINGP (IMAGE_INSTANCE_PIXMAP_FILENAME (ii))) 936 if (STRINGP (IMAGE_INSTANCE_PIXMAP_FILENAME (ii)))
935 { 937 {
936 char *s; 938 Intbyte *s;
937 Lisp_Object filename = IMAGE_INSTANCE_PIXMAP_FILENAME (ii); 939 Lisp_Object filename = IMAGE_INSTANCE_PIXMAP_FILENAME (ii);
938 s = strrchr ((char *) XSTRING_DATA (filename), '/'); 940 s = qxestrrchr (XSTRING_DATA (filename), '/');
939 if (s) 941 if (s)
940 print_internal (build_string (s + 1), printcharfun, 1); 942 print_internal (build_intstring (s + 1), printcharfun, 1);
941 else 943 else
942 print_internal (filename, printcharfun, 1); 944 print_internal (filename, printcharfun, 1);
943 } 945 }
944 if (IMAGE_INSTANCE_PIXMAP_DEPTH (ii) > 1) 946 if (IMAGE_INSTANCE_PIXMAP_DEPTH (ii) > 1)
945 sprintf (buf, " %dx%dx%d", IMAGE_INSTANCE_PIXMAP_WIDTH (ii), 947 sprintf (buf, " %dx%dx%d", IMAGE_INSTANCE_PIXMAP_WIDTH (ii),
1378 int desired_dest_mask) 1380 int desired_dest_mask)
1379 { 1381 {
1380 signal_error_1 1382 signal_error_1
1381 (Qinvalid_argument, 1383 (Qinvalid_argument,
1382 list2 1384 list2
1383 (emacs_doprnt_string_lisp_2 1385 (emacs_sprintf_string_lisp
1384 ((const Intbyte *) 1386 ("No compatible image-instance types given: wanted one of %s, got %s",
1385 "No compatible image-instance types given: wanted one of %s, got %s", 1387 Qnil, 2, encode_image_instance_type_list (desired_dest_mask),
1386 Qnil, -1, 2,
1387 encode_image_instance_type_list (desired_dest_mask),
1388 encode_image_instance_type_list (given_dest_mask)), 1388 encode_image_instance_type_list (given_dest_mask)),
1389 instantiator)); 1389 instantiator));
1390 } 1390 }
1391 1391
1392 static int 1392 static int
2138 2138
2139 /************************************************************************/ 2139 /************************************************************************/
2140 /* error helpers */ 2140 /* error helpers */
2141 /************************************************************************/ 2141 /************************************************************************/
2142 DOESNT_RETURN 2142 DOESNT_RETURN
2143 signal_image_error (const char *reason, Lisp_Object frob) 2143 signal_image_error (const CIntbyte *reason, Lisp_Object frob)
2144 { 2144 {
2145 signal_error (Qimage_conversion_error, reason, frob); 2145 signal_error (Qimage_conversion_error, reason, frob);
2146 } 2146 }
2147 2147
2148 DOESNT_RETURN 2148 DOESNT_RETURN
2149 signal_image_error_2 (const char *reason, Lisp_Object frob0, Lisp_Object frob1) 2149 signal_image_error_2 (const CIntbyte *reason, Lisp_Object frob0, Lisp_Object frob1)
2150 { 2150 {
2151 signal_error_2 (Qimage_conversion_error, reason, frob0, frob1); 2151 signal_error_2 (Qimage_conversion_error, reason, frob0, frob1);
2152 } 2152 }
2153 2153
2154 DOESNT_RETURN 2154 DOESNT_RETURN
2155 signal_double_image_error (const char *string1, const char *string2, 2155 signal_double_image_error (const CIntbyte *string1, const CIntbyte *string2,
2156 Lisp_Object data) 2156 Lisp_Object data)
2157 { 2157 {
2158 signal_error_1 (Qimage_conversion_error, 2158 signal_error_1 (Qimage_conversion_error,
2159 list3 (build_translated_string (string1), 2159 list3 (build_msg_string (string1),
2160 build_translated_string (string2), 2160 build_msg_string (string2),
2161 data)); 2161 data));
2162 } 2162 }
2163 2163
2164 DOESNT_RETURN 2164 DOESNT_RETURN
2165 signal_double_image_error_2 (const char *string1, const char *string2, 2165 signal_double_image_error_2 (const CIntbyte *string1, const CIntbyte *string2,
2166 Lisp_Object data1, Lisp_Object data2) 2166 Lisp_Object data1, Lisp_Object data2)
2167 { 2167 {
2168 signal_error_1 (Qimage_conversion_error, 2168 signal_error_1 (Qimage_conversion_error,
2169 list4 (build_translated_string (string1), 2169 list4 (build_msg_string (string1),
2170 build_translated_string (string2), 2170 build_msg_string (string2),
2171 data1, data2)); 2171 data1, data2));
2172 } 2172 }
2173 2173
2174 /**************************************************************************** 2174 /****************************************************************************
2175 * nothing * 2175 * nothing *
2585 Lisp_Object 2585 Lisp_Object
2586 bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot, 2586 bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot,
2587 int ok_if_data_invalid) 2587 int ok_if_data_invalid)
2588 { 2588 {
2589 int w, h; 2589 int w, h;
2590 Extbyte *data; 2590 UChar_Binary *data;
2591 int result; 2591 int result;
2592 const char *filename_ext; 2592
2593 2593 result = read_bitmap_data_from_file (name, &w, &h, &data, xhot, yhot);
2594 LISP_STRING_TO_EXTERNAL (name, filename_ext, Qfile_name);
2595 result = read_bitmap_data_from_file (filename_ext, &w, &h,
2596 (unsigned char **) &data, xhot, yhot);
2597 2594
2598 if (result == BitmapSuccess) 2595 if (result == BitmapSuccess)
2599 { 2596 {
2600 Lisp_Object retval; 2597 Lisp_Object retval;
2601 int len = (w + 7) / 8 * h; 2598 int len = (w + 7) / 8 * h;
2602 2599
2603 retval = list3 (make_int (w), make_int (h), 2600 retval = list3 (make_int (w), make_int (h),
2604 make_ext_string (data, len, Qbinary)); 2601 make_ext_string ((Extbyte *) data, len, Qbinary));
2605 XFree (data); 2602 XFree (data);
2606 return retval; 2603 return retval;
2607 } 2604 }
2608 2605
2609 switch (result) 2606 switch (result)
2882 2879
2883 retval = Fbuffer_substring (Qnil, Qnil, Qnil); 2880 retval = Fbuffer_substring (Qnil, Qnil, Qnil);
2884 XpmFree (data); 2881 XpmFree (data);
2885 2882
2886 set_buffer_internal (old_buffer); 2883 set_buffer_internal (old_buffer);
2887 unbind_to (speccount, Qnil); 2884 unbind_to (speccount);
2888 2885
2889 RETURN_UNGCPRO (retval); 2886 RETURN_UNGCPRO (retval);
2890 } 2887 }
2891 2888
2892 switch (result) 2889 switch (result)
3290 if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance)) 3287 if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance))
3291 & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK)) 3288 & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK))
3292 assert (EQ (XIMAGE_INSTANCE_FRAME (instance), 3289 assert (EQ (XIMAGE_INSTANCE_FRAME (instance),
3293 DOMAIN_FRAME (domain))); 3290 DOMAIN_FRAME (domain)));
3294 #endif 3291 #endif
3295 unbind_to (speccount, Qnil); 3292 unbind_to (speccount);
3296 #ifdef ERROR_CHECK_GLYPHS 3293 #ifdef ERROR_CHECK_GLYPHS
3297 if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance)) 3294 if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance))
3298 & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK)) 3295 & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK))
3299 assert (EQ (Fgethash (hash_key, 3296 assert (EQ (Fgethash (hash_key,
3300 XWINDOW (governing_domain) 3297 XWINDOW (governing_domain)
4577 we might need. We can get better hashing by making the depth 4574 we might need. We can get better hashing by making the depth
4578 negative - currently it will recurse down 7 levels.*/ 4575 negative - currently it will recurse down 7 levels.*/
4579 IMAGE_INSTANCE_DISPLAY_HASH (ii) = internal_hash (subwindow, 4576 IMAGE_INSTANCE_DISPLAY_HASH (ii) = internal_hash (subwindow,
4580 IMAGE_INSTANCE_HASH_DEPTH); 4577 IMAGE_INSTANCE_HASH_DEPTH);
4581 4578
4582 unbind_to (count, Qnil); 4579 unbind_to (count);
4583 } 4580 }
4584 4581
4585 /* Determine whether an image_instance has changed structurally and 4582 /* Determine whether an image_instance has changed structurally and
4586 hence needs redisplaying in some way. 4583 hence needs redisplaying in some way.
4587 4584