Mercurial > hg > xemacs-beta
comparison src/glyphs.c @ 4226:9b4442ac18c7
[xemacs-hg @ 2007-10-15 09:55:43 by didierv]
Fix image specifiers related bugs
author | didierv |
---|---|
date | Mon, 15 Oct 2007 09:55:50 +0000 |
parents | 229bd619740a |
children | 8475ff9c49ea |
comparison
equal
deleted
inserted
replaced
4225:e358b6c40407 | 4226:9b4442ac18c7 |
---|---|
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, 2001, 2002, 2004, 2005 Ben Wing | 4 Copyright (C) 1995, 1996, 2000, 2001, 2002, 2004, 2005 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 Copyright (C) 2007 Didier Verna | |
7 | 8 |
8 This file is part of XEmacs. | 9 This file is part of XEmacs. |
9 | 10 |
10 XEmacs is free software; you can redistribute it and/or modify it | 11 XEmacs is free software; you can redistribute it and/or modify it |
11 under the terms of the GNU General Public License as published by the | 12 under the terms of the GNU General Public License as published by the |
2552 data = find_keyword_in_vector (instantiator, data_keyword); | 2553 data = find_keyword_in_vector (instantiator, data_keyword); |
2553 file = find_keyword_in_vector (instantiator, file_keyword); | 2554 file = find_keyword_in_vector (instantiator, file_keyword); |
2554 | 2555 |
2555 if (!NILP (file) && NILP (data)) | 2556 if (!NILP (file) && NILP (data)) |
2556 { | 2557 { |
2557 Lisp_Object retval = MAYBE_LISP_CONTYPE_METH | 2558 struct console_methods *meths |
2558 (decode_console_type(console_type, ERROR_ME), | 2559 = decode_console_type(console_type, ERROR_ME); |
2559 locate_pixmap_file, (file)); | 2560 |
2561 if (HAS_CONTYPE_METH_P (meths, locate_pixmap_file)) | |
2562 { | |
2563 Lisp_Object retval | |
2564 = CONTYPE_METH (meths, locate_pixmap_file, (file)); | |
2560 | 2565 |
2561 if (!NILP (retval)) | 2566 if (!NILP (retval)) |
2562 return retval; | 2567 return retval; |
2563 else | 2568 else |
2564 return Fcons (file, Qnil); /* should have been file */ | 2569 return Fcons (file, Qnil); /* should have been file */ |
2565 } | 2570 } |
2566 | 2571 else /* method unavailable */ |
2567 return Qnil; | 2572 return Qnil; |
2573 } | |
2574 | |
2575 return Qt; | |
2568 } | 2576 } |
2569 | 2577 |
2570 Lisp_Object | 2578 Lisp_Object |
2571 simple_image_type_normalize (Lisp_Object inst, Lisp_Object console_type, | 2579 simple_image_type_normalize (Lisp_Object inst, Lisp_Object console_type, |
2572 Lisp_Object image_type_tag) | 2580 Lisp_Object image_type_tag) |
2587 skip out. */ | 2595 skip out. */ |
2588 | 2596 |
2589 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 2597 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
2590 console_type); | 2598 console_type); |
2591 | 2599 |
2600 if (NILP (file)) /* normalization impossible for the console type */ | |
2601 RETURN_UNGCPRO (Qnil); | |
2602 | |
2592 if (CONSP (file)) /* failure locating filename */ | 2603 if (CONSP (file)) /* failure locating filename */ |
2593 signal_double_image_error ("Opening pixmap file", | 2604 signal_double_image_error ("Opening pixmap file", |
2594 "no such file or directory", | 2605 "no such file or directory", |
2595 Fcar (file)); | 2606 Fcar (file)); |
2596 | 2607 |
2597 if (NILP (file)) /* no conversion necessary */ | 2608 if (EQ (file, Qt)) /* no conversion necessary */ |
2598 RETURN_UNGCPRO (inst); | 2609 RETURN_UNGCPRO (inst); |
2599 | 2610 |
2600 alist = tagged_vector_to_alist (inst); | 2611 alist = tagged_vector_to_alist (inst); |
2601 | 2612 |
2602 { | 2613 { |
2791 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 2802 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
2792 console_type); | 2803 console_type); |
2793 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, | 2804 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, |
2794 Q_mask_data, console_type); | 2805 Q_mask_data, console_type); |
2795 | 2806 |
2807 if (NILP (file)) /* normalization impossible for the console type */ | |
2808 RETURN_UNGCPRO (Qnil); | |
2809 | |
2796 if (CONSP (file)) /* failure locating filename */ | 2810 if (CONSP (file)) /* failure locating filename */ |
2797 signal_double_image_error ("Opening bitmap file", | 2811 signal_double_image_error ("Opening bitmap file", |
2798 "no such file or directory", | 2812 "no such file or directory", |
2799 Fcar (file)); | 2813 Fcar (file)); |
2800 | 2814 |
2801 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */ | 2815 if (EQ (file, Qt) && EQ (mask_file, Qt)) /* no conversion necessary */ |
2802 RETURN_UNGCPRO (inst); | 2816 RETURN_UNGCPRO (inst); |
2803 | 2817 |
2804 alist = tagged_vector_to_alist (inst); | 2818 alist = tagged_vector_to_alist (inst); |
2805 | 2819 |
2806 if (!NILP (file)) | 2820 if (!EQ (file, Qt)) |
2807 { | 2821 { |
2808 int xhot, yhot; | 2822 int xhot, yhot; |
2809 Lisp_Object data = bitmap_to_lisp_data (file, &xhot, &yhot, 0); | 2823 Lisp_Object data = bitmap_to_lisp_data (file, &xhot, &yhot, 0); |
2810 alist = remassq_no_quit (Q_file, alist); | 2824 alist = remassq_no_quit (Q_file, alist); |
2811 /* there can't be a :data at this point. */ | 2825 /* there can't be a :data at this point. */ |
2818 if (yhot != -1 && NILP (assq_no_quit (Q_hotspot_y, alist))) | 2832 if (yhot != -1 && NILP (assq_no_quit (Q_hotspot_y, alist))) |
2819 alist = Fcons (Fcons (Q_hotspot_y, make_int (yhot)), | 2833 alist = Fcons (Fcons (Q_hotspot_y, make_int (yhot)), |
2820 alist); | 2834 alist); |
2821 } | 2835 } |
2822 | 2836 |
2837 /* #### FIXME: Hmmm... what about mask being Qt ?? -- dvl */ | |
2823 alist = xbm_mask_file_munging (alist, file, mask_file, console_type); | 2838 alist = xbm_mask_file_munging (alist, file, mask_file, console_type); |
2824 | 2839 |
2825 { | 2840 { |
2826 Lisp_Object result = alist_to_tagged_vector (Qxbm, alist); | 2841 Lisp_Object result = alist_to_tagged_vector (Qxbm, alist); |
2827 free_alist (alist); | 2842 free_alist (alist); |
2876 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 2891 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
2877 console_type); | 2892 console_type); |
2878 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, | 2893 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, |
2879 Q_mask_data, console_type); | 2894 Q_mask_data, console_type); |
2880 | 2895 |
2896 if (NILP (file)) /* normalization impossible for the console type */ | |
2897 RETURN_UNGCPRO (Qnil); | |
2898 | |
2881 if (CONSP (file)) /* failure locating filename */ | 2899 if (CONSP (file)) /* failure locating filename */ |
2882 signal_double_image_error ("Opening bitmap file", | 2900 signal_double_image_error ("Opening bitmap file", |
2883 "no such file or directory", | 2901 "no such file or directory", |
2884 Fcar (file)); | 2902 Fcar (file)); |
2885 | 2903 |
2886 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */ | 2904 if (EQ (file, Qt) && EQ (mask_file, Qt)) /* no conversion necessary */ |
2887 RETURN_UNGCPRO (inst); | 2905 RETURN_UNGCPRO (inst); |
2888 | 2906 |
2907 | |
2908 /* #### FIXME: and what about file / mask being Qt ? -- dvl */ | |
2889 alist = tagged_vector_to_alist (inst); | 2909 alist = tagged_vector_to_alist (inst); |
2890 | 2910 |
2891 { | 2911 { |
2892 Lisp_Object data = make_string_from_file (file); | 2912 Lisp_Object data = make_string_from_file (file); |
2893 alist = remassq_no_quit (Q_file, alist); | 2913 alist = remassq_no_quit (Q_file, alist); |
3092 skip out. */ | 3112 skip out. */ |
3093 | 3113 |
3094 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 3114 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
3095 console_type); | 3115 console_type); |
3096 | 3116 |
3117 if (NILP (file)) /* normalization impossible for the console type */ | |
3118 RETURN_UNGCPRO (Qnil); | |
3119 | |
3097 if (CONSP (file)) /* failure locating filename */ | 3120 if (CONSP (file)) /* failure locating filename */ |
3098 signal_double_image_error ("Opening pixmap file", | 3121 signal_double_image_error ("Opening pixmap file", |
3099 "no such file or directory", | 3122 "no such file or directory", |
3100 Fcar (file)); | 3123 Fcar (file)); |
3101 | 3124 |
3102 color_symbols = find_keyword_in_vector_or_given (inst, Q_color_symbols, | 3125 color_symbols = find_keyword_in_vector_or_given (inst, Q_color_symbols, |
3103 Qunbound); | 3126 Qunbound); |
3104 | 3127 |
3105 if (NILP (file) && !UNBOUNDP (color_symbols)) | 3128 if (EQ (file, Qt) && !UNBOUNDP (color_symbols)) |
3106 /* no conversion necessary */ | 3129 /* no conversion necessary */ |
3107 RETURN_UNGCPRO (inst); | 3130 RETURN_UNGCPRO (inst); |
3108 | 3131 |
3109 alist = tagged_vector_to_alist (inst); | 3132 alist = tagged_vector_to_alist (inst); |
3110 | 3133 |
3111 if (!NILP (file)) | 3134 if (!NILP (file) && !EQ (file, Qt)) |
3112 { | 3135 { |
3113 Lisp_Object data = pixmap_to_lisp_data (file, 0); | 3136 Lisp_Object data = pixmap_to_lisp_data (file, 0); |
3114 alist = remassq_no_quit (Q_file, alist); | 3137 alist = remassq_no_quit (Q_file, alist); |
3115 /* there can't be a :data at this point. */ | 3138 /* there can't be a :data at this point. */ |
3116 alist = Fcons (Fcons (Q_file, file), | 3139 alist = Fcons (Fcons (Q_file, file), |