annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Generic glyph/image implementation + display tables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Tinker Systems
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4 Copyright (C) 1995, 1996, 2000 Ben Wing
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 Copyright (C) 1995 Sun Microsystems
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
6 Copyright (C) 1998, 1999, 2000 Andy Piper
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
7
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
27 /* Written by Ben Wing and Chuck Thompson. Heavily modified /
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
28 rewritten by Andy Piper. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #include "lisp.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
33 #include "blocktype.h"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #include "buffer.h"
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
35 #include "chartab.h"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include "device.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #include "elhash.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #include "faces.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #include "frame.h"
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
40 #include "glyphs.h"
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
41 #include "insdel.h"
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
42 #include "objects.h"
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
43 #include "opaque.h"
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
44 #include "rangetab.h"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #include "redisplay.h"
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
46 #include "specifier.h"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 #include "window.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
49 #ifdef HAVE_XPM
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
50 #include <X11/xpm.h>
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
51 #endif
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
52
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
53 Lisp_Object Qimage_conversion_error;
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
54
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 Lisp_Object Qglyphp, Qcontrib_p, Qbaseline;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 Lisp_Object Qbuffer_glyph_p, Qpointer_glyph_p, Qicon_glyph_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 Lisp_Object Qnothing_image_instance_p, Qtext_image_instance_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 Lisp_Object Qmono_pixmap_image_instance_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 Lisp_Object Qcolor_pixmap_image_instance_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 Lisp_Object Qpointer_image_instance_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 Lisp_Object Qsubwindow_image_instance_p;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
62 Lisp_Object Qwidget_image_instance_p;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 Lisp_Object Qconst_glyph_variable;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 Lisp_Object Qmono_pixmap, Qcolor_pixmap, Qsubwindow;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
65 Lisp_Object Q_file, Q_data, Q_face, Q_pixel_width, Q_pixel_height;
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
66 Lisp_Object Qformatted_string;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 Lisp_Object Vcurrent_display_table;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 Lisp_Object Vtruncation_glyph, Vcontinuation_glyph, Voctal_escape_glyph;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 Lisp_Object Vcontrol_arrow_glyph, Vinvisible_text_glyph, Vhscroll_glyph;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 Lisp_Object Vxemacs_logo;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 Lisp_Object Vthe_nothing_vector;
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
72 Lisp_Object Vimage_instantiator_format_list;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
73 Lisp_Object Vimage_instance_type_list;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
74 Lisp_Object Vglyph_type_list;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
75
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
76 int disable_animated_pixmaps;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
77
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 DEFINE_IMAGE_INSTANTIATOR_FORMAT (nothing);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 DEFINE_IMAGE_INSTANTIATOR_FORMAT (inherit);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 DEFINE_IMAGE_INSTANTIATOR_FORMAT (string);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 DEFINE_IMAGE_INSTANTIATOR_FORMAT (formatted_string);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
82 DEFINE_IMAGE_INSTANTIATOR_FORMAT (subwindow);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
83 DEFINE_IMAGE_INSTANTIATOR_FORMAT (text);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
84 DEFINE_IMAGE_INSTANTIATOR_FORMAT (pointer);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
86 #ifdef HAVE_WINDOW_SYSTEM
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
87 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xbm);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
88 Lisp_Object Qxbm;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
89
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
90 Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
91 Lisp_Object Q_foreground, Q_background;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
92 #ifndef BitmapSuccess
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
93 #define BitmapSuccess 0
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
94 #define BitmapOpenFailed 1
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
95 #define BitmapFileInvalid 2
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
96 #define BitmapNoMemory 3
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
97 #endif
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
98 #endif
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
99
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
100 #ifdef HAVE_XFACE
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
101 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xface);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
102 Lisp_Object Qxface;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
103 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
104
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
105 #ifdef HAVE_XPM
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
106 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xpm);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
107 Lisp_Object Qxpm;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
108 Lisp_Object Q_color_symbols;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
109 #endif
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
110
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
111 typedef struct image_instantiator_format_entry image_instantiator_format_entry;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 struct image_instantiator_format_entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 Lisp_Object symbol;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
115 Lisp_Object device;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 struct image_instantiator_methods *meths;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
119 typedef struct
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 Dynarr_declare (struct image_instantiator_format_entry);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 } image_instantiator_format_entry_dynarr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
124 /* This contains one entry per format, per device it's defined on. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 image_instantiator_format_entry_dynarr *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 the_image_instantiator_format_entry_dynarr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
128 static Lisp_Object allocate_image_instance (Lisp_Object governing_domain,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
129 Lisp_Object glyph);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 static void image_validate (Lisp_Object instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 static void glyph_property_was_changed (Lisp_Object glyph,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 Lisp_Object property,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 Lisp_Object locale);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
134 static void set_image_instance_dirty_p (Lisp_Object instance, int dirty);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
135 static void register_ignored_expose (struct frame* f, int x, int y, int width, int height);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
136 static void cache_subwindow_instance_in_frame_maybe (Lisp_Object instance);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
137 /* Unfortunately windows and X are different. In windows BeginPaint()
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
138 will prevent WM_PAINT messages being generated so it is unnecessary
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
139 to register exposures as they will not occur. Under X they will
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
140 always occur. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
141 int hold_ignored_expose_registration;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
142
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
143 EXFUN (Fimage_instance_type, 1);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
144 EXFUN (Fglyph_type, 1);
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
145 EXFUN (Fnext_window, 4);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 * Image Instantiators *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
152 struct image_instantiator_methods *
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
153 decode_device_ii_format (Lisp_Object device, Lisp_Object format,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
154 Error_behavior errb)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 if (!SYMBOLP (format))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 if (ERRB_EQ (errb, ERROR_ME))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 CHECK_SYMBOL (format);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 for (i = 0; i < Dynarr_length (the_image_instantiator_format_entry_dynarr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
168 if ( EQ (format,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
169 Dynarr_at (the_image_instantiator_format_entry_dynarr, i).
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
170 symbol) )
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
171 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
172 Lisp_Object d = Dynarr_at (the_image_instantiator_format_entry_dynarr, i).
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
173 device;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
174 if ((NILP (d) && NILP (device))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
175 ||
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
176 (!NILP (device) &&
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
177 EQ (CONSOLE_TYPE (XCONSOLE
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
178 (DEVICE_CONSOLE (XDEVICE (device)))), d)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
179 return Dynarr_at (the_image_instantiator_format_entry_dynarr, i).meths;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
180 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 maybe_signal_simple_error ("Invalid image-instantiator format", format,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 Qimage, errb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
189 struct image_instantiator_methods *
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
190 decode_image_instantiator_format (Lisp_Object format, Error_behavior errb)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
191 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
192 return decode_device_ii_format (Qnil, format, errb);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
193 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
194
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 static int
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
196 valid_image_instantiator_format_p (Lisp_Object format, Lisp_Object locale)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
198 int i;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
199 struct image_instantiator_methods* meths =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
200 decode_image_instantiator_format (format, ERROR_ME_NOT);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
201 Lisp_Object contype = Qnil;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
202 /* mess with the locale */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
203 if (!NILP (locale) && SYMBOLP (locale))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
204 contype = locale;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
205 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
206 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
207 struct console* console = decode_console (locale);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
208 contype = console ? CONSOLE_TYPE (console) : locale;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
209 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
210 /* nothing is valid in all locales */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
211 if (EQ (format, Qnothing))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
212 return 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
213 /* reject unknown formats */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
214 else if (NILP (contype) || !meths)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
215 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
216
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
217 for (i = 0; i < Dynarr_length (meths->consoles); i++)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
218 if (EQ (contype, Dynarr_at (meths->consoles, i).symbol))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
219 return 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
220 return 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 280
diff changeset
223 DEFUN ("valid-image-instantiator-format-p", Fvalid_image_instantiator_format_p,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
224 1, 2, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 Given an IMAGE-INSTANTIATOR-FORMAT, return non-nil if it is valid.
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
226 If LOCALE is non-nil then the format is checked in that domain.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
227 If LOCALE is nil the current console is used.
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
228
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
229 Valid formats are some subset of 'nothing, 'string, 'formatted-string,
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
230 'xpm, 'xbm, 'xface, 'gif, 'jpeg, 'png, 'tiff, 'cursor-font, 'font,
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
231 'autodetect, 'subwindow, 'inherit, 'mswindows-resource, 'bmp,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
232 'native-layout, 'layout, 'label, 'tab-control, 'tree-view,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
233 'progress-gauge, 'scrollbar, 'combo-box, 'edit-field, 'button,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
234 'widget, 'pointer, and 'text, depending on how XEmacs was compiled.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
235 */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
236 (image_instantiator_format, locale))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
238 return valid_image_instantiator_format_p (image_instantiator_format,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
239 locale) ?
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
240 Qt : Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 280
diff changeset
243 DEFUN ("image-instantiator-format-list", Fimage_instantiator_format_list,
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 280
diff changeset
244 0, 0, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 Return a list of valid image-instantiator formats.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
246 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
247 ())
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 return Fcopy_sequence (Vimage_instantiator_format_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 void
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
253 add_entry_to_device_ii_format_list (Lisp_Object device, Lisp_Object symbol,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
254 struct image_instantiator_methods *meths)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
255 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
256 struct image_instantiator_format_entry entry;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
257
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
258 entry.symbol = symbol;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
259 entry.device = device;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
260 entry.meths = meths;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
261 Dynarr_add (the_image_instantiator_format_entry_dynarr, entry);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
262 if (NILP (memq_no_quit (symbol, Vimage_instantiator_format_list)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
263 Vimage_instantiator_format_list =
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
264 Fcons (symbol, Vimage_instantiator_format_list);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
265 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
266
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
267 void
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 add_entry_to_image_instantiator_format_list (Lisp_Object symbol,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 struct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 image_instantiator_methods *meths)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
272 add_entry_to_device_ii_format_list (Qnil, symbol, meths);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 static Lisp_Object *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 get_image_conversion_list (Lisp_Object console_type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 return &decode_console_type (console_type, ERROR_ME)->image_conversion_list;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 280
diff changeset
281 DEFUN ("set-console-type-image-conversion-list", Fset_console_type_image_conversion_list,
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 280
diff changeset
282 2, 2, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 Set the image-conversion-list for consoles of the given TYPE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 The image-conversion-list specifies how image instantiators that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 are strings should be interpreted. Each element of the list should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 a list of two elements (a regular expression string and a vector) or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 a list of three elements (the preceding two plus an integer index into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 the vector). The string is converted to the vector associated with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 first matching regular expression. If a vector index is specified, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 string itself is substituted into that position in the vector.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 Note: The conversion above is applied when the image instantiator is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 added to an image specifier, not when the specifier is actually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 instantiated. Therefore, changing the image-conversion-list only affects
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 newly-added instantiators. Existing instantiators in glyphs and image
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 specifiers will not be affected.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
297 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
298 (console_type, list))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 Lisp_Object tail;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 Lisp_Object *imlist = get_image_conversion_list (console_type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 /* Check the list to make sure that it only has valid entries. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 EXTERNAL_LIST_LOOP (tail, list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 Lisp_Object mapping = XCAR (tail);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 /* Mapping form should be (STRING VECTOR) or (STRING VECTOR INTEGER) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 if (!CONSP (mapping) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 !CONSP (XCDR (mapping)) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (!NILP (XCDR (XCDR (mapping))) &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (!CONSP (XCDR (XCDR (mapping))) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 !NILP (XCDR (XCDR (XCDR (mapping)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 signal_simple_error ("Invalid mapping form", mapping);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 Lisp_Object exp = XCAR (mapping);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 Lisp_Object typevec = XCAR (XCDR (mapping));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 Lisp_Object pos = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 Lisp_Object newvec;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 struct gcpro gcpro1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 CHECK_STRING (exp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 CHECK_VECTOR (typevec);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 if (!NILP (XCDR (XCDR (mapping))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 pos = XCAR (XCDR (XCDR (mapping)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 CHECK_INT (pos);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 if (XINT (pos) < 0 ||
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
331 XINT (pos) >= XVECTOR_LENGTH (typevec))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 args_out_of_range_3
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
333 (pos, Qzero, make_int (XVECTOR_LENGTH (typevec) - 1));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 }
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
335
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 newvec = Fcopy_sequence (typevec);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 if (INTP (pos))
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
338 XVECTOR_DATA (newvec)[XINT (pos)] = exp;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 GCPRO1 (newvec);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 image_validate (newvec);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 UNGCPRO;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 *imlist = Fcopy_tree (list, Qt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 return list;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 280
diff changeset
349 DEFUN ("console-type-image-conversion-list", Fconsole_type_image_conversion_list,
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 280
diff changeset
350 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 Return the image-conversion-list for devices of the given TYPE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 The image-conversion-list specifies how to interpret image string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 instantiators for the specified console type. See
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 `set-console-type-image-conversion-list' for a description of its syntax.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
355 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
356 (console_type))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 return Fcopy_tree (*get_image_conversion_list (console_type), Qt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
361 /* Process a string instantiator according to the image-conversion-list for
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 CONSOLE_TYPE. Returns a vector. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 process_image_string_instantiator (Lisp_Object data,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 Lisp_Object console_type,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 int dest_mask)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 Lisp_Object tail;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 LIST_LOOP (tail, *get_image_conversion_list (console_type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 Lisp_Object mapping = XCAR (tail);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 Lisp_Object exp = XCAR (mapping);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 Lisp_Object typevec = XCAR (XCDR (mapping));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 /* if the result is of a type that can't be instantiated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (e.g. a string when we're dealing with a pointer glyph),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 skip it. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 if (!(dest_mask &
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 IIFORMAT_METH (decode_image_instantiator_format
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
382 (XVECTOR_DATA (typevec)[0], ERROR_ME),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 possible_dest_types, ())))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 continue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 if (fast_string_match (exp, 0, data, 0, -1, 0, ERROR_ME, 0) >= 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 if (!NILP (XCDR (XCDR (mapping))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 int pos = XINT (XCAR (XCDR (XCDR (mapping))));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 Lisp_Object newvec = Fcopy_sequence (typevec);
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
391 XVECTOR_DATA (newvec)[pos] = data;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 return newvec;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 return typevec;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 /* Oh well. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 signal_simple_error ("Unable to interpret glyph instantiator",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 data);
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
402
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 find_keyword_in_vector_or_given (Lisp_Object vector, Lisp_Object keyword,
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
408 Lisp_Object default_)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 Lisp_Object *elt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 int instantiator_len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
413 elt = XVECTOR_DATA (vector);
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
414 instantiator_len = XVECTOR_LENGTH (vector);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 elt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 instantiator_len--;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 while (instantiator_len > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 if (EQ (elt[0], keyword))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 return elt[1];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 elt += 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 instantiator_len -= 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
427 return default_;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 find_keyword_in_vector (Lisp_Object vector, Lisp_Object keyword)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 return find_keyword_in_vector_or_given (vector, keyword, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 check_valid_string (Lisp_Object data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 CHECK_STRING (data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
442 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
443 check_valid_vector (Lisp_Object data)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
444 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
445 CHECK_VECTOR (data);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
446 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
447
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
448 void
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 check_valid_face (Lisp_Object data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 Fget_face (data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 check_valid_int (Lisp_Object data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 CHECK_INT (data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 file_or_data_must_be_present (Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 if (NILP (find_keyword_in_vector (instantiator, Q_file)) &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 NILP (find_keyword_in_vector (instantiator, Q_data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 signal_simple_error ("Must supply either :file or :data",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 data_must_be_present (Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 if (NILP (find_keyword_in_vector (instantiator, Q_data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 signal_simple_error ("Must supply :data", instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 face_must_be_present (Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 if (NILP (find_keyword_in_vector (instantiator, Q_face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 signal_simple_error ("Must supply :face", instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 /* utility function useful in retrieving data from a file. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 make_string_from_file (Lisp_Object file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 {
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 84
diff changeset
488 /* This function can call lisp */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 int count = specpdl_depth ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 Lisp_Object temp_buffer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 struct gcpro gcpro1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 Lisp_Object data;
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
493
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 specbind (Qinhibit_quit, Qt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 temp_buffer = Fget_buffer_create (build_string (" *pixmap conversion*"));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 GCPRO1 (temp_buffer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 set_buffer_internal (XBUFFER (temp_buffer));
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 185
diff changeset
499 Ferase_buffer (Qnil);
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 124
diff changeset
500 specbind (intern ("format-alist"), Qnil);
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 48
diff changeset
501 Finsert_file_contents_internal (file, Qnil, Qnil, Qnil, Qnil, Qnil, Qnil);
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 185
diff changeset
502 data = Fbuffer_substring (Qnil, Qnil, Qnil);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 unbind_to (count, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 UNGCPRO;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 return data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 /* The following two functions are provided to make it easier for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 the normalize methods to work with keyword-value vectors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 Hash tables are kind of heavyweight for this purpose.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (If vectors were resizable, we could avoid this problem;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 but they're not.) An alternative approach that might be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 more efficient but require more work is to use a type of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 assoc-Dynarr and provide primitives for deleting elements out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 of it. (However, you'd also have to add an unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 to make sure the Dynarr got freed in case of an error in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 the normalization process.) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 tagged_vector_to_alist (Lisp_Object vector)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 {
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
522 Lisp_Object *elt = XVECTOR_DATA (vector);
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
523 int len = XVECTOR_LENGTH (vector);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 Lisp_Object result = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 assert (len & 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 for (len -= 2; len >= 1; len -= 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 result = Fcons (Fcons (elt[len], elt[len+1]), result);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 alist_to_tagged_vector (Lisp_Object tag, Lisp_Object alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 int len = 1 + 2 * XINT (Flength (alist));
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
537 Lisp_Object *elt = alloca_array (Lisp_Object, len);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 Lisp_Object rest;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 i = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 elt[i++] = tag;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 LIST_LOOP (rest, alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 Lisp_Object pair = XCAR (rest);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 elt[i] = XCAR (pair);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 elt[i+1] = XCDR (pair);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 i += 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 return Fvector (len, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
554 #ifdef ERROR_CHECK_GLYPHS
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
555 static int
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
556 check_instance_cache_mapper (Lisp_Object key, Lisp_Object value,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
557 void *flag_closure)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
558 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
559 /* This function can GC */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
560 /* value can be nil; we cache failures as well as successes */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
561 if (!NILP (value))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
562 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
563 Lisp_Object window;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
564 VOID_TO_LISP (window, flag_closure);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
565 assert (EQ (XIMAGE_INSTANCE_DOMAIN (value), window));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
566 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
567
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
568 return 0;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
569 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
570
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
571 void
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
572 check_window_subwindow_cache (struct window* w)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
573 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
574 Lisp_Object window;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
575
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
576 XSETWINDOW (window, w);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
577
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
578 assert (!NILP (w->subwindow_instance_cache));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
579 elisp_maphash (check_instance_cache_mapper,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
580 w->subwindow_instance_cache,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
581 LISP_TO_VOID (window));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
582 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
583
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
584 void
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
585 check_image_instance_structure (Lisp_Object instance)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
586 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
587 /* Weird nothing images exist at startup when the console is
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
588 deleted. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
589 if (!NOTHING_IMAGE_INSTANCEP (instance))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
590 assert (DOMAIN_LIVE_P (instance));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
591 if (WINDOWP (XIMAGE_INSTANCE_DOMAIN (instance)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
592 check_window_subwindow_cache
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
593 (XWINDOW (XIMAGE_INSTANCE_DOMAIN (instance)));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
594 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
595 #endif
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
596
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
597 /* Determine what kind of domain governs the image instance.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
598 Verify that the given domain is at least as specific, and extract
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
599 the governing domain from it. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
600 static Lisp_Object
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
601 get_image_instantiator_governing_domain (Lisp_Object instantiator,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
602 Lisp_Object domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
603 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
604 int governing_domain;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
605
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
606 struct image_instantiator_methods *meths =
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
607 decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0],
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
608 ERROR_ME);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
609 governing_domain = IIFORMAT_METH_OR_GIVEN (meths, governing_domain, (),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
610 GOVERNING_DOMAIN_DEVICE);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
611
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
612 if (governing_domain == GOVERNING_DOMAIN_WINDOW
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
613 && NILP (DOMAIN_WINDOW (domain)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
614 signal_simple_error_2 ("Domain for this instantiator must be resolvable to a window",
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
615 instantiator, domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
616 else if (governing_domain == GOVERNING_DOMAIN_FRAME
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
617 && NILP (DOMAIN_FRAME (domain)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
618 signal_simple_error_2
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
619 ("Domain for this instantiator must be resolvable to a frame",
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
620 instantiator, domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
621
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
622 if (governing_domain == GOVERNING_DOMAIN_WINDOW)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
623 domain = DOMAIN_WINDOW (domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
624 else if (governing_domain == GOVERNING_DOMAIN_FRAME)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
625 domain = DOMAIN_FRAME (domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
626 else if (governing_domain == GOVERNING_DOMAIN_DEVICE)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
627 domain = DOMAIN_DEVICE (domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
628 else
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
629 abort ();
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
630
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
631 return domain;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
632 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
633
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 normalize_image_instantiator (Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 Lisp_Object contype,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 Lisp_Object dest_mask)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 if (IMAGE_INSTANCEP (instantiator))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 361
diff changeset
640 return instantiator;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 if (STRINGP (instantiator))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 instantiator = process_image_string_instantiator (instantiator, contype,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 XINT (dest_mask));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 assert (VECTORP (instantiator));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 /* We have to always store the actual pixmap data and not the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 filename even though this is a potential memory pig. We have to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 do this because it is quite possible that we will need to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 instantiate a new instance of the pixmap and the file will no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 longer exist (e.g. w3 pixmaps are almost always from temporary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 files). */
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
653 {
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
654 struct gcpro gcpro1;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
655 struct image_instantiator_methods *meths;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
656
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
657 GCPRO1 (instantiator);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
658
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
659 meths = decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0],
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
660 ERROR_ME);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
661 RETURN_UNGCPRO (IIFORMAT_METH_OR_GIVEN (meths, normalize,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
662 (instantiator, contype),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
663 instantiator));
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
664 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 static Lisp_Object
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
668 instantiate_image_instantiator (Lisp_Object governing_domain,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
669 Lisp_Object domain,
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
670 Lisp_Object instantiator,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
672 int dest_mask, Lisp_Object glyph)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
674 Lisp_Object ii = allocate_image_instance (governing_domain, glyph);
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
675 Lisp_Image_Instance* p = XIMAGE_INSTANCE (ii);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
676 struct image_instantiator_methods *meths, *device_meths;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 struct gcpro gcpro1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 GCPRO1 (ii);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
680 if (!valid_image_instantiator_format_p (XVECTOR_DATA (instantiator)[0],
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
681 DOMAIN_DEVICE (governing_domain)))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
682 signal_simple_error
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
683 ("Image instantiator format is invalid in this locale.",
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
684 instantiator);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
685
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
686 meths = decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0],
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
687 ERROR_ME);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
688 MAYBE_IIFORMAT_METH (meths, instantiate, (ii, instantiator, pointer_fg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
689 pointer_bg, dest_mask, domain));
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
690
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
691 /* Now do device specific instantiation. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
692 device_meths = decode_device_ii_format (DOMAIN_DEVICE (governing_domain),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
693 XVECTOR_DATA (instantiator)[0],
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
694 ERROR_ME_NOT);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
695
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
696 if (!HAS_IIFORMAT_METH_P (meths, instantiate)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
697 && (!device_meths || !HAS_IIFORMAT_METH_P (device_meths, instantiate)))
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
698 signal_simple_error
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
699 ("Don't know how to instantiate this image instantiator?",
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
700 instantiator);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
701
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
702 /* In general native window system methods will require sane
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
703 geometry values, thus the instance needs to have been laid-out
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
704 before they get called. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
705 image_instance_layout (ii, XIMAGE_INSTANCE_WIDTH (ii),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
706 XIMAGE_INSTANCE_HEIGHT (ii), domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
707
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
708 MAYBE_IIFORMAT_METH (device_meths, instantiate, (ii, instantiator, pointer_fg,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
709 pointer_bg, dest_mask, domain));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
710 /* Do post instantiation. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
711 MAYBE_IIFORMAT_METH (meths, post_instantiate, (ii, instantiator, domain));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
712 MAYBE_IIFORMAT_METH (device_meths, post_instantiate, (ii, instantiator, domain));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
713
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
714 /* We're done. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
715 IMAGE_INSTANCE_INITIALIZED (p) = 1;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
716 /* Now that we're done verify that we really are laid out. */
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
717 if (IMAGE_INSTANCE_LAYOUT_CHANGED (p))
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
718 image_instance_layout (ii, XIMAGE_INSTANCE_WIDTH (ii),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
719 XIMAGE_INSTANCE_HEIGHT (ii), domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
720
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
721 /* We *must* have a clean image at this point. */
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
722 IMAGE_INSTANCE_TEXT_CHANGED (p) = 0;
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
723 IMAGE_INSTANCE_SIZE_CHANGED (p) = 0;
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
724 IMAGE_INSTANCE_LAYOUT_CHANGED (p) = 0;
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
725 IMAGE_INSTANCE_DIRTYP (p) = 0;
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
726
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
727 assert ( XIMAGE_INSTANCE_HEIGHT (ii) >= 0
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
728 && XIMAGE_INSTANCE_WIDTH (ii) >= 0 );
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
729
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
730 ERROR_CHECK_IMAGE_INSTANCE (ii);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
731
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
732 RETURN_UNGCPRO (ii);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 * Image-Instance Object *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 Lisp_Object Qimage_instancep;
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
741
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 static Lisp_Object
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
743 mark_image_instance (Lisp_Object obj)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
745 Lisp_Image_Instance *i = XIMAGE_INSTANCE (obj);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
746
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
747 /* #### I want to check the instance here, but there are way too
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
748 many instances of the instance being marked while the domain is
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
749 dead. For instance you can get marked through an event when using
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
750 callback_ex.*/
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
751 #if 0
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
752 ERROR_CHECK_IMAGE_INSTANCE (obj);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
753 #endif
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
754
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
755 mark_object (i->name);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
756 /* Is this legal in marking? We may get in the situation where the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
757 domain has been deleted - making the instance unusable. It seems
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
758 better to remove the domain so that it can be finalized. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
759 if (!DOMAIN_LIVE_P (i->domain))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
760 i->domain = Qnil;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
761 else
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
762 mark_object (i->domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
763
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
764 /* We don't mark the glyph reference since that would create a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
765 circularity preventing GC. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 switch (IMAGE_INSTANCE_TYPE (i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 case IMAGE_TEXT:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
769 mark_object (IMAGE_INSTANCE_TEXT_STRING (i));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 case IMAGE_COLOR_PIXMAP:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
773 mark_object (IMAGE_INSTANCE_PIXMAP_FILENAME (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
774 mark_object (IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
775 mark_object (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
776 mark_object (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
777 mark_object (IMAGE_INSTANCE_PIXMAP_FG (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
778 mark_object (IMAGE_INSTANCE_PIXMAP_BG (i));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 break;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
780
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
781 case IMAGE_WIDGET:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
782 mark_object (IMAGE_INSTANCE_WIDGET_TYPE (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
783 mark_object (IMAGE_INSTANCE_WIDGET_PROPS (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
784 mark_object (IMAGE_INSTANCE_WIDGET_FACE (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
785 mark_object (IMAGE_INSTANCE_WIDGET_ITEMS (i));
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
786 mark_object (IMAGE_INSTANCE_LAYOUT_CHILDREN (i));
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
787 mark_object (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (i));
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
788 mark_object (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (i));
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
789 mark_object (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (i));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 case IMAGE_SUBWINDOW:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 break;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
792
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
797 /* The image may have been previously finalized (yes that's wierd,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
798 see Fdelete_frame() and mark_window_as_deleted()), in which case
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
799 the domain will be nil, so cope with this. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
800 if (!NILP (IMAGE_INSTANCE_DEVICE (i)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
801 MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (i)),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
802 mark_image_instance, (i));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
804 return i->device;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 print_image_instance (Lisp_Object obj, Lisp_Object printcharfun,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 int escapeflag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 char buf[100];
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
812 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (obj);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 if (print_readably)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 error ("printing unreadable object #<image-instance 0x%x>",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 ii->header.uid);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 write_c_string ("#<image-instance (", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 print_internal (Fimage_instance_type (obj), printcharfun, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 write_c_string (") ", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 if (!NILP (ii->name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 print_internal (ii->name, printcharfun, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 write_c_string (" ", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 write_c_string ("on ", printcharfun);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
826 print_internal (ii->domain, printcharfun, 0);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 write_c_string (" ", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 switch (IMAGE_INSTANCE_TYPE (ii))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 case IMAGE_NOTHING:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 case IMAGE_TEXT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 print_internal (IMAGE_INSTANCE_TEXT_STRING (ii), printcharfun, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 if (STRINGP (IMAGE_INSTANCE_PIXMAP_FILENAME (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 char *s;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 Lisp_Object filename = IMAGE_INSTANCE_PIXMAP_FILENAME (ii);
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 0
diff changeset
844 s = strrchr ((char *) XSTRING_DATA (filename), '/');
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 if (s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 print_internal (build_string (s + 1), printcharfun, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 print_internal (filename, printcharfun, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 if (IMAGE_INSTANCE_PIXMAP_DEPTH (ii) > 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 sprintf (buf, " %dx%dx%d", IMAGE_INSTANCE_PIXMAP_WIDTH (ii),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 IMAGE_INSTANCE_PIXMAP_DEPTH (ii));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 sprintf (buf, " %dx%d", IMAGE_INSTANCE_PIXMAP_WIDTH (ii),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 write_c_string (buf, printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 !NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 write_c_string (" @", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 {
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
864 long_to_string (buf, XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 write_c_string (buf, printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 write_c_string ("??", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 write_c_string (",", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 {
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
872 long_to_string (buf, XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii)));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 write_c_string (buf, printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 write_c_string ("??", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 if (!NILP (IMAGE_INSTANCE_PIXMAP_FG (ii)) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 !NILP (IMAGE_INSTANCE_PIXMAP_BG (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 write_c_string (" (", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 if (!NILP (IMAGE_INSTANCE_PIXMAP_FG (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 print_internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (XCOLOR_INSTANCE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 (IMAGE_INSTANCE_PIXMAP_FG (ii))->name, printcharfun, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 write_c_string ("/", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 if (!NILP (IMAGE_INSTANCE_PIXMAP_BG (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 print_internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (XCOLOR_INSTANCE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (IMAGE_INSTANCE_PIXMAP_BG (ii))->name, printcharfun, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 write_c_string (")", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
899 case IMAGE_WIDGET:
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
900 print_internal (IMAGE_INSTANCE_WIDGET_TYPE (ii), printcharfun, 0);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
901
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
902 if (GUI_ITEMP (IMAGE_INSTANCE_WIDGET_ITEM (ii)))
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
903 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
904 write_c_string (" ", printcharfun);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
905 print_internal (IMAGE_INSTANCE_WIDGET_TEXT (ii), printcharfun, 1);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
906 }
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
907
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
908 if (!NILP (IMAGE_INSTANCE_WIDGET_FACE (ii)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
909 {
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
910 write_c_string (" face=", printcharfun);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
911 print_internal
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
912 (IMAGE_INSTANCE_WIDGET_FACE (ii), printcharfun, 0);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
913 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
914
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
915
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 case IMAGE_SUBWINDOW:
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
917 sprintf (buf, " %dx%d", IMAGE_INSTANCE_WIDTH (ii),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
918 IMAGE_INSTANCE_HEIGHT (ii));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
919 write_c_string (buf, printcharfun);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
920
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
921 /* This is stolen from frame.c. Subwindows are strange in that they
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
922 are specific to a particular frame so we want to print in their
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
923 description what that frame is. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
924
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
925 write_c_string (" on #<", printcharfun);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
926 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
927 struct frame* f = XFRAME (IMAGE_INSTANCE_FRAME (ii));
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
928
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
929 if (!FRAME_LIVE_P (f))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
930 write_c_string ("dead", printcharfun);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
931 else
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
932 write_c_string (DEVICE_TYPE_NAME (XDEVICE (FRAME_DEVICE (f))),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
933 printcharfun);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
934 }
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
935 write_c_string ("-frame>", printcharfun);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
936 sprintf (buf, " 0x%p", IMAGE_INSTANCE_SUBWINDOW_ID (ii));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
937 write_c_string (buf, printcharfun);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
938
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
945 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), print_image_instance,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (ii, printcharfun, escapeflag));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 sprintf (buf, " 0x%x>", ii->header.uid);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 write_c_string (buf, printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 finalize_image_instance (void *header, int for_disksave)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
954 Lisp_Image_Instance *i = (Lisp_Image_Instance *) header;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
956 /* objects like this exist at dump time, so don't bomb out. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
957 if (IMAGE_INSTANCE_TYPE (i) == IMAGE_NOTHING
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
958 ||
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
959 NILP (IMAGE_INSTANCE_DEVICE (i)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 if (for_disksave) finalose (i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
963 /* We can't use the domain here, because it might have
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
964 disappeared. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
965 MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (i)),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
966 finalize_image_instance, (i));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
967
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
968 /* Make sure we don't try this twice. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
969 IMAGE_INSTANCE_DEVICE (i) = Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 static int
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
973 image_instance_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
975 Lisp_Image_Instance *i1 = XIMAGE_INSTANCE (obj1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
976 Lisp_Image_Instance *i2 = XIMAGE_INSTANCE (obj2);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
977
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
978 ERROR_CHECK_IMAGE_INSTANCE (obj1);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
979 ERROR_CHECK_IMAGE_INSTANCE (obj2);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
980
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
981 if (!EQ (IMAGE_INSTANCE_DOMAIN (i1),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
982 IMAGE_INSTANCE_DOMAIN (i2))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
983 || IMAGE_INSTANCE_TYPE (i1) != IMAGE_INSTANCE_TYPE (i2)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
984 || IMAGE_INSTANCE_WIDTH (i1) != IMAGE_INSTANCE_WIDTH (i2)
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
985 || IMAGE_INSTANCE_MARGIN_WIDTH (i1) !=
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
986 IMAGE_INSTANCE_MARGIN_WIDTH (i2)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
987 || IMAGE_INSTANCE_HEIGHT (i1) != IMAGE_INSTANCE_HEIGHT (i2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
988 || IMAGE_INSTANCE_XOFFSET (i1) != IMAGE_INSTANCE_XOFFSET (i2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
989 || IMAGE_INSTANCE_YOFFSET (i1) != IMAGE_INSTANCE_YOFFSET (i2))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 if (!internal_equal (IMAGE_INSTANCE_NAME (i1), IMAGE_INSTANCE_NAME (i2),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 depth + 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 switch (IMAGE_INSTANCE_TYPE (i1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 case IMAGE_NOTHING:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 case IMAGE_TEXT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 if (!internal_equal (IMAGE_INSTANCE_TEXT_STRING (i1),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 IMAGE_INSTANCE_TEXT_STRING (i2),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 depth + 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 case IMAGE_POINTER:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1010 if (!(IMAGE_INSTANCE_PIXMAP_DEPTH (i1) ==
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 IMAGE_INSTANCE_PIXMAP_DEPTH (i2) &&
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1012 IMAGE_INSTANCE_PIXMAP_SLICE (i1) ==
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1013 IMAGE_INSTANCE_PIXMAP_SLICE (i2) &&
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 EQ (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (i1),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (i2)) &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 EQ (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (i1),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (i2)) &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 internal_equal (IMAGE_INSTANCE_PIXMAP_FILENAME (i1),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 IMAGE_INSTANCE_PIXMAP_FILENAME (i2),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 depth + 1) &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 internal_equal (IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (i1),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (i2),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 depth + 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1027 case IMAGE_WIDGET:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1028 if (!(EQ (IMAGE_INSTANCE_WIDGET_TYPE (i1),
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1029 IMAGE_INSTANCE_WIDGET_TYPE (i2))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1030 && IMAGE_INSTANCE_SUBWINDOW_ID (i1) ==
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1031 IMAGE_INSTANCE_SUBWINDOW_ID (i2)
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1032 &&
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1033 EQ (IMAGE_INSTANCE_WIDGET_FACE (i1),
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1034 IMAGE_INSTANCE_WIDGET_TYPE (i2))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1035 && internal_equal (IMAGE_INSTANCE_WIDGET_ITEMS (i1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1036 IMAGE_INSTANCE_WIDGET_ITEMS (i2),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1037 depth + 1)
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1038 && internal_equal (IMAGE_INSTANCE_LAYOUT_CHILDREN (i1),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1039 IMAGE_INSTANCE_LAYOUT_CHILDREN (i2),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1040 depth + 1)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1041 && internal_equal (IMAGE_INSTANCE_WIDGET_PROPS (i1),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1042 IMAGE_INSTANCE_WIDGET_PROPS (i2),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1043 depth + 1)
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1044 && internal_equal (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (i1),
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1045 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (i2),
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1046 depth + 1)
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1047 && internal_equal (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (i1),
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1048 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (i2),
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1049 depth + 1)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1050 ))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1051 return 0;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1052 break;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1053
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 case IMAGE_SUBWINDOW:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1055 if (!(IMAGE_INSTANCE_SUBWINDOW_ID (i1) ==
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1056 IMAGE_INSTANCE_SUBWINDOW_ID (i2)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1057 return 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1064 return DEVMETH_OR_GIVEN (DOMAIN_XDEVICE (i1->domain),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1065 image_instance_equal, (i1, i2, depth), 1);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1066 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1067
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1068 /* Image instance domain manipulators. We can't error check in these
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1069 otherwise we get into infinite recursion. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1070 Lisp_Object
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1071 image_instance_device (Lisp_Object instance)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1072 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1073 return XIMAGE_INSTANCE_DEVICE (instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1074 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1075
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1076 Lisp_Object
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1077 image_instance_frame (Lisp_Object instance)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1078 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1079 return XIMAGE_INSTANCE_FRAME (instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1080 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1081
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1082 Lisp_Object
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1083 image_instance_window (Lisp_Object instance)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1084 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1085 return DOMAIN_WINDOW (XIMAGE_INSTANCE_DOMAIN (instance));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1086 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1087
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1088 int
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1089 image_instance_live_p (Lisp_Object instance)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1090 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1091 return DOMAIN_LIVE_P (XIMAGE_INSTANCE_DOMAIN (instance));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1092 }
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1093
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1094 static unsigned long
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 image_instance_hash (Lisp_Object obj, int depth)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1097 Lisp_Image_Instance *i = XIMAGE_INSTANCE (obj);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1098 unsigned long hash = HASH4 (LISP_HASH (IMAGE_INSTANCE_DOMAIN (i)),
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1099 IMAGE_INSTANCE_WIDTH (i),
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1100 IMAGE_INSTANCE_MARGIN_WIDTH (i),
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1101 IMAGE_INSTANCE_HEIGHT (i));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1103 ERROR_CHECK_IMAGE_INSTANCE (obj);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1104
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 switch (IMAGE_INSTANCE_TYPE (i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 case IMAGE_NOTHING:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 case IMAGE_TEXT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 hash = HASH2 (hash, internal_hash (IMAGE_INSTANCE_TEXT_STRING (i),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 depth + 1));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 case IMAGE_POINTER:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1118 hash = HASH4 (hash, IMAGE_INSTANCE_PIXMAP_DEPTH (i),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1119 IMAGE_INSTANCE_PIXMAP_SLICE (i),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 internal_hash (IMAGE_INSTANCE_PIXMAP_FILENAME (i),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 depth + 1));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1124 case IMAGE_WIDGET:
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1125 /* We need the hash to be equivalent to what should be
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1126 displayed. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1127 hash = HASH5 (hash,
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1128 LISP_HASH (IMAGE_INSTANCE_WIDGET_TYPE (i)),
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1129 internal_hash (IMAGE_INSTANCE_WIDGET_PROPS (i), depth + 1),
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1130 internal_hash (IMAGE_INSTANCE_WIDGET_ITEMS (i), depth + 1),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1131 internal_hash (IMAGE_INSTANCE_LAYOUT_CHILDREN (i),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1132 depth + 1));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 case IMAGE_SUBWINDOW:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1134 hash = HASH2 (hash, (int) IMAGE_INSTANCE_SUBWINDOW_ID (i));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1141 return HASH2 (hash, DEVMETH_OR_GIVEN
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1142 (XDEVICE (image_instance_device (obj)),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1143 image_instance_hash, (i, depth),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1144 0));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1147 DEFINE_LRECORD_IMPLEMENTATION ("image-instance", image_instance,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1148 mark_image_instance, print_image_instance,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1149 finalize_image_instance, image_instance_equal,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1150 image_instance_hash, 0,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1151 Lisp_Image_Instance);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1152
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 static Lisp_Object
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1154 allocate_image_instance (Lisp_Object governing_domain, Lisp_Object glyph)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1156 Lisp_Image_Instance *lp =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1157 alloc_lcrecord_type (Lisp_Image_Instance, &lrecord_image_instance);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1158 Lisp_Object val;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 zero_lcrecord (lp);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1161 /* It's not possible to simply keep a record of the domain in which
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1162 the instance was instantiated. This is because caching may mean
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1163 that the domain becomes invalid but the instance remains
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1164 valid. However, the only truly relevant domain is the domain in
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1165 which the instance is cached since this is the one that will be
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1166 common to the instances. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1167 lp->domain = governing_domain;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1168 /* The cache domain is not quite sufficient since the domain can get
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1169 deleted before the image instance does. We need to know the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1170 domain device in order to finalize the image instance
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1171 properly. We therefore record the device also. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1172 lp->device = DOMAIN_DEVICE (governing_domain);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 lp->type = IMAGE_NOTHING;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 lp->name = Qnil;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1175 lp->x_offset = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1176 lp->y_offset = 0;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1177 lp->width = IMAGE_UNSPECIFIED_GEOMETRY;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1178 lp->margin_width = 0;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1179 lp->height = IMAGE_UNSPECIFIED_GEOMETRY;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1180 lp->parent = glyph;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1181 /* So that layouts get done. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1182 lp->layout_changed = 1;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1183 lp->initialized = 0;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1184
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 XSETIMAGE_INSTANCE (val, lp);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1186 MARK_GLYPHS_CHANGED;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1187
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 static enum image_instance_type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 decode_image_instance_type (Lisp_Object type, Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 if (ERRB_EQ (errb, ERROR_ME))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 CHECK_SYMBOL (type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1197 if (EQ (type, Qnothing)) return IMAGE_NOTHING;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1198 if (EQ (type, Qtext)) return IMAGE_TEXT;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1199 if (EQ (type, Qmono_pixmap)) return IMAGE_MONO_PIXMAP;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1200 if (EQ (type, Qcolor_pixmap)) return IMAGE_COLOR_PIXMAP;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1201 if (EQ (type, Qpointer)) return IMAGE_POINTER;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1202 if (EQ (type, Qsubwindow)) return IMAGE_SUBWINDOW;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1203 if (EQ (type, Qwidget)) return IMAGE_WIDGET;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 maybe_signal_simple_error ("Invalid image-instance type", type,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 Qimage, errb);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1207
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1208 return IMAGE_UNKNOWN; /* not reached */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 encode_image_instance_type (enum image_instance_type type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 switch (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1216 case IMAGE_NOTHING: return Qnothing;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1217 case IMAGE_TEXT: return Qtext;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1218 case IMAGE_MONO_PIXMAP: return Qmono_pixmap;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1219 case IMAGE_COLOR_PIXMAP: return Qcolor_pixmap;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1220 case IMAGE_POINTER: return Qpointer;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1221 case IMAGE_SUBWINDOW: return Qsubwindow;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1222 case IMAGE_WIDGET: return Qwidget;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 return Qnil; /* not reached */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 decode_image_instance_type_list (Lisp_Object list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 Lisp_Object rest;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 int mask = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 if (NILP (list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 return ~0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 if (!CONSP (list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 enum image_instance_type type =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 decode_image_instance_type (list, ERROR_ME);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 return image_instance_type_to_mask (type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 EXTERNAL_LIST_LOOP (rest, list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 enum image_instance_type type =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 decode_image_instance_type (XCAR (rest), ERROR_ME);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 mask |= image_instance_type_to_mask (type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 return mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 encode_image_instance_type_list (int mask)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 int count = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 Lisp_Object result = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 while (mask)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 count++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 if (mask & 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 result = Fcons (encode_image_instance_type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 ((enum image_instance_type) count), result);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 mask >>= 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 return Fnreverse (result);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 DOESNT_RETURN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 incompatible_image_types (Lisp_Object instantiator, int given_dest_mask,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 int desired_dest_mask)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 signal_error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 (Qerror,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 list2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 (emacs_doprnt_string_lisp_2
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1282 ((const Bufbyte *)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 "No compatible image-instance types given: wanted one of %s, got %s",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 Qnil, -1, 2,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 encode_image_instance_type_list (desired_dest_mask),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 encode_image_instance_type_list (given_dest_mask)),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 instantiator));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 valid_image_instance_type_p (Lisp_Object type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1293 return !NILP (memq_no_quit (type, Vimage_instance_type_list));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1296 DEFUN ("valid-image-instance-type-p", Fvalid_image_instance_type_p, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 Given an IMAGE-INSTANCE-TYPE, return non-nil if it is valid.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 Valid types are some subset of 'nothing, 'text, 'mono-pixmap, 'color-pixmap,
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1299 'pointer, 'subwindow, and 'widget, depending on how XEmacs was compiled.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1300 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1301 (image_instance_type))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1303 return valid_image_instance_type_p (image_instance_type) ? Qt : Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1306 DEFUN ("image-instance-type-list", Fimage_instance_type_list, 0, 0, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 Return a list of valid image-instance types.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1308 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1309 ())
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 return Fcopy_sequence (Vimage_instance_type_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 Error_behavior
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 decode_error_behavior_flag (Lisp_Object no_error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1317 if (NILP (no_error)) return ERROR_ME;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1318 else if (EQ (no_error, Qt)) return ERROR_ME_NOT;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1319 else return ERROR_ME_WARN;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 encode_error_behavior_flag (Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 if (ERRB_EQ (errb, ERROR_ME))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 else if (ERRB_EQ (errb, ERROR_ME_NOT))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 return Qt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 assert (ERRB_EQ (errb, ERROR_ME_WARN));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 return Qwarning;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1336 /* Recurse up the hierarchy looking for the topmost glyph. This means
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1337 that instances in layouts will inherit face properties from their
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1338 parent. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1339 Lisp_Object image_instance_parent_glyph (Lisp_Image_Instance* ii)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1340 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1341 if (IMAGE_INSTANCEP (IMAGE_INSTANCE_PARENT (ii)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1342 {
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
1343 return image_instance_parent_glyph
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1344 (XIMAGE_INSTANCE (IMAGE_INSTANCE_PARENT (ii)));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1345 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1346 return IMAGE_INSTANCE_PARENT (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1347 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1348
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 static Lisp_Object
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1350 make_image_instance_1 (Lisp_Object data, Lisp_Object domain,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 Lisp_Object dest_types)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 Lisp_Object ii;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 struct gcpro gcpro1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 int dest_mask;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1356 Lisp_Object governing_domain;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1357
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 if (IMAGE_INSTANCEP (data))
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
1359 signal_simple_error ("Image instances not allowed here", data);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 image_validate (data);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1361 domain = decode_domain (domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1362 /* instantiate_image_instantiator() will abort if given an
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1363 image instance ... */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 dest_mask = decode_image_instance_type_list (dest_types);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1365 data = normalize_image_instantiator (data,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1366 DEVICE_TYPE (DOMAIN_XDEVICE (domain)),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 make_int (dest_mask));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 GCPRO1 (data);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1369 /* After normalizing the data, it's always either an image instance (which
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1370 we filtered out above) or a vector. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1371 if (EQ (XVECTOR_DATA (data)[0], Qinherit))
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
1372 signal_simple_error ("Inheritance not allowed here", data);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1373 governing_domain =
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1374 get_image_instantiator_governing_domain (data, domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1375 ii = instantiate_image_instantiator (governing_domain, domain, data,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1376 Qnil, Qnil, dest_mask, Qnil);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 RETURN_UNGCPRO (ii);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1380 DEFUN ("make-image-instance", Fmake_image_instance, 1, 4, 0, /*
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1381 Return a new `image-instance' object.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 Image-instance objects encapsulate the way a particular image (pixmap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 etc.) is displayed on a particular device. In most circumstances, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 do not need to directly create image instances; use a glyph instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 However, it may occasionally be useful to explicitly create image
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 instances, if you want more control over the instantiation process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 DATA is an image instantiator, which describes the image; see
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1390 `make-image-specifier' for a description of the allowed values.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 DEST-TYPES should be a list of allowed image instance types that can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 be generated. The recognized image instance types are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 'nothing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 Nothing is displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 'text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 Displayed as text. The foreground and background colors and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 font of the text are specified independent of the pixmap. Typically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 these attributes will come from the face of the surrounding text,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 unless a face is specified for the glyph in which the image appears.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 'mono-pixmap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 Displayed as a mono pixmap (a pixmap with only two colors where the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 foreground and background can be specified independent of the pixmap;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 typically the pixmap assumes the foreground and background colors of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 the text around it, unless a face is specified for the glyph in which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 the image appears).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 'color-pixmap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 Displayed as a color pixmap.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 'pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 Used as the mouse pointer for a window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 'subwindow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 A child window that is treated as an image. This allows (e.g.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 another program to be responsible for drawing into the window.
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1415 'widget
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1416 A child window that contains a window-system widget, e.g. a push
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1417 button, text field, or slider.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1418
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1419 The DEST-TYPES list is unordered. If multiple destination types are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1420 possible for a given instantiator, the "most natural" type for the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1421 instantiator's format is chosen. (For XBM, the most natural types are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1422 `mono-pixmap', followed by `color-pixmap', followed by `pointer'. For
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1423 the other normal image formats, the most natural types are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1424 `color-pixmap', followed by `mono-pixmap', followed by `pointer'. For
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1425 the string and formatted-string formats, the most natural types are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1426 `text', followed by `mono-pixmap' (not currently implemented),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1427 followed by `color-pixmap' (not currently implemented). For MS
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1428 Windows resources, the most natural type for pointer resources is
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1429 `pointer', and for the others it's `color-pixmap'. The other formats
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1430 can only be instantiated as one type. (If you want to control more
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1431 specifically the order of the types into which an image is
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1432 instantiated, just call `make-image-instance' repeatedly until it
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1433 succeeds, passing less and less preferred destination types each
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1434 time.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1435
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1436 See `make-image-specifier' for a description of the different image
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1437 instantiator formats.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 If DEST-TYPES is omitted, all possible types are allowed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1441 DOMAIN specifies the domain to which the image instance will be attached.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1442 This domain is termed the \"governing domain\". The type of the governing
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1443 domain depends on the image instantiator format. (Although, more correctly,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1444 it should probably depend on the image instance type.) For example, pixmap
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1445 image instances are specific to a device, but widget image instances are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1446 specific to a particular XEmacs window because in order to display such a
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1447 widget when two windows onto the same buffer want to display the widget,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1448 two separate underlying widgets must be created. (That's because a widget
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1449 is actually a child window-system window, and all window-system windows have
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1450 a unique existence on the screen.) This means that the governing domain for
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1451 a pixmap image instance will be some device (most likely, the only existing
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1452 device), whereas the governing domain for a widget image instance will be
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1453 some XEmacs window.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1454
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1455 If you specify an overly general DOMAIN (e.g. a frame when a window was
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1456 wanted), an error is signaled. If you specify an overly specific DOMAIN
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1457 \(e.g. a window when a device was wanted), the corresponding general domain
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1458 is fetched and used instead. For `make-image-instance', it makes no
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1459 difference whether you specify an overly specific domain or the properly
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1460 general domain derived from it. However, it does matter when creating an
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1461 image instance by instantiating a specifier or glyph (e.g. with
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1462 `glyph-image-instance'), because the more specific domain causes spec lookup
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1463 to start there and proceed to more general domains. (It would also matter
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1464 when creating an image instance with an instantiator format of `inherit',
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1465 but we currently disallow this. #### We should fix this.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1466
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1467 If omitted, DOMAIN defaults to the selected window.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1468
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 NO-ERROR controls what happens when the image cannot be generated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 If nil, an error message is generated. If t, no messages are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 generated and this function returns nil. If anything else, a warning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 message is generated and this function returns nil.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1473 */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1474 (data, domain, dest_types, no_error))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 Error_behavior errb = decode_error_behavior_flag (no_error);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1478 return call_with_suspended_errors ((lisp_fn_t) make_image_instance_1,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 Qnil, Qimage, errb,
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1480 3, data, domain, dest_types);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1483 DEFUN ("image-instance-p", Fimage_instance_p, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 Return non-nil if OBJECT is an image instance.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1485 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1486 (object))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 {
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
1488 return IMAGE_INSTANCEP (object) ? Qt : Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1491 DEFUN ("image-instance-type", Fimage_instance_type, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 Return the type of the given image instance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 The return value will be one of 'nothing, 'text, 'mono-pixmap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 'color-pixmap, 'pointer, or 'subwindow.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1495 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1496 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1499 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 return encode_image_instance_type (XIMAGE_INSTANCE_TYPE (image_instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1503 DEFUN ("image-instance-name", Fimage_instance_name, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 Return the name of the given image instance.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1505 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1506 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 CHECK_IMAGE_INSTANCE (image_instance);
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
1509 return XIMAGE_INSTANCE_NAME (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1512 DEFUN ("image-instance-domain", Fimage_instance_domain, 1, 1, 0, /*
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1513 Return the governing domain of the given image instance.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1514 The governing domain of an image instance is the domain that the image
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1515 instance is specific to. It is NOT necessarily the domain that was
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1516 given to the call to `specifier-instance' that resulted in the creation
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1517 of this image instance. See `make-image-instance' for more information
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1518 on governing domains.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1519 */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1520 (image_instance))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1521 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1522 CHECK_IMAGE_INSTANCE (image_instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1523 return XIMAGE_INSTANCE_DOMAIN (image_instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1524 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1525
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1526 DEFUN ("image-instance-string", Fimage_instance_string, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 Return the string of the given image instance.
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1528 This will only be non-nil for text image instances and widgets.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1529 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1530 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 CHECK_IMAGE_INSTANCE (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 if (XIMAGE_INSTANCE_TYPE (image_instance) == IMAGE_TEXT)
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
1534 return XIMAGE_INSTANCE_TEXT_STRING (image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1535 else if (XIMAGE_INSTANCE_TYPE (image_instance) == IMAGE_WIDGET)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1536 return XIMAGE_INSTANCE_WIDGET_TEXT (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1541 DEFUN ("image-instance-property", Fimage_instance_property, 2, 2, 0, /*
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1542 Return the given property of the given image instance.
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1543 Returns nil if the property or the property method do not exist for
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1544 the image instance in the domain.
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1545 */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1546 (image_instance, prop))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1547 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1548 Lisp_Image_Instance* ii;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1549 Lisp_Object type, ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1550 struct image_instantiator_methods* meths;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1551
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1552 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1553 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1554 CHECK_SYMBOL (prop);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1555 ii = XIMAGE_INSTANCE (image_instance);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1556
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1557 /* ... then try device specific methods ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1558 type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii));
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1559 meths = decode_device_ii_format (image_instance_device (image_instance),
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1560 type, ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1561 if (meths && HAS_IIFORMAT_METH_P (meths, property)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1562 &&
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1563 !UNBOUNDP (ret = IIFORMAT_METH (meths, property, (image_instance, prop))))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1564 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1565 return ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1566 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1567 /* ... then format specific methods ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1568 meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1569 if (meths && HAS_IIFORMAT_METH_P (meths, property)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1570 &&
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1571 !UNBOUNDP (ret = IIFORMAT_METH (meths, property, (image_instance, prop))))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1572 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1573 return ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1574 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1575 /* ... then fail */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1576 return Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1577 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1578
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1579 DEFUN ("set-image-instance-property", Fset_image_instance_property, 3, 3, 0, /*
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1580 Set the given property of the given image instance.
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1581 Does nothing if the property or the property method do not exist for
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1582 the image instance in the domain.
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1583
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1584 WARNING: If you are thinking about using this function, think again.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1585 You probably want to be using `set-glyph-image' to change the glyph's
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1586 specifier. Be especially wary if you are thinking of calling this
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1587 function after having called `glyph-image-instance'. Unless you are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1588 absolutely sure what you're doing, pretty much the only legitimate
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1589 uses for this function are setting user-specified info in a widget,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1590 such as text in a text field. */
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1591 (image_instance, prop, val))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1592 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1593 Lisp_Image_Instance* ii;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1594 Lisp_Object type, ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1595 struct image_instantiator_methods* meths;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1596
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1597 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1598 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1599 CHECK_SYMBOL (prop);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1600 ii = XIMAGE_INSTANCE (image_instance);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1601 type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1602 /* try device specific methods first ... */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1603 meths = decode_device_ii_format (image_instance_device (image_instance),
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1604 type, ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1605 if (meths && HAS_IIFORMAT_METH_P (meths, set_property)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1606 &&
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1607 !UNBOUNDP (ret =
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1608 IIFORMAT_METH (meths, set_property, (image_instance, prop, val))))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1609 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1610 val = ret;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1611 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1612 else
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1613 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1614 /* ... then format specific methods ... */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1615 meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1616 if (meths && HAS_IIFORMAT_METH_P (meths, set_property)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1617 &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1618 !UNBOUNDP (ret =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1619 IIFORMAT_METH (meths, set_property, (image_instance, prop, val))))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1620 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1621 val = ret;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1622 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1623 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1624 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1625 val = Qnil;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1626 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1627 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1628
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1629 /* Make sure the image instance gets redisplayed. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1630 set_image_instance_dirty_p (image_instance, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1631 /* Force the glyph to be laid out again. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1632 IMAGE_INSTANCE_LAYOUT_CHANGED (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1633
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1634 MARK_SUBWINDOWS_STATE_CHANGED;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1635 MARK_GLYPHS_CHANGED;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1636
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1637 return val;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1638 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1639
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1640 DEFUN ("image-instance-file-name", Fimage_instance_file_name, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 Return the file name from which IMAGE-INSTANCE was read, if known.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1642 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1643 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1646 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 return XIMAGE_INSTANCE_PIXMAP_FILENAME (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1660 DEFUN ("image-instance-mask-file-name", Fimage_instance_mask_file_name, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 Return the file name from which IMAGE-INSTANCE's mask was read, if known.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1662 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1663 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1666 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 return XIMAGE_INSTANCE_PIXMAP_MASK_FILENAME (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1680 DEFUN ("image-instance-depth", Fimage_instance_depth, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 Return the depth of the image instance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 This is 0 for a bitmap, or a positive integer for a pixmap.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1683 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1684 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1687 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 case IMAGE_POINTER:
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
1694 return make_int (XIMAGE_INSTANCE_PIXMAP_DEPTH (image_instance));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1701 DEFUN ("image-instance-height", Fimage_instance_height, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 Return the height of the image instance, in pixels.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1703 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1704 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1707 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 case IMAGE_POINTER:
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1714 case IMAGE_SUBWINDOW:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1715 case IMAGE_WIDGET:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1716 return make_int (XIMAGE_INSTANCE_HEIGHT (image_instance));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1717
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1723 DEFUN ("image-instance-width", Fimage_instance_width, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 Return the width of the image instance, in pixels.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1725 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1726 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1729 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 case IMAGE_POINTER:
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1736 case IMAGE_SUBWINDOW:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1737 case IMAGE_WIDGET:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1738 return make_int (XIMAGE_INSTANCE_WIDTH (image_instance));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1739
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1745 DEFUN ("image-instance-hotspot-x", Fimage_instance_hotspot_x, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 Return the X coordinate of the image instance's hotspot, if known.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 This is a point relative to the origin of the pixmap. When an image is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 used as a mouse pointer, the hotspot is the point on the image that sits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 over the location that the pointer points to. This is, for example, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 tip of the arrow or the center of the crosshairs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 This will always be nil for a non-pointer image instance.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1752 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1753 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1756 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 return XIMAGE_INSTANCE_PIXMAP_HOTSPOT_X (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1770 DEFUN ("image-instance-hotspot-y", Fimage_instance_hotspot_y, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 Return the Y coordinate of the image instance's hotspot, if known.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 This is a point relative to the origin of the pixmap. When an image is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 used as a mouse pointer, the hotspot is the point on the image that sits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 over the location that the pointer points to. This is, for example, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 tip of the arrow or the center of the crosshairs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 This will always be nil for a non-pointer image instance.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1777 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1778 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1781 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 return XIMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1795 DEFUN ("image-instance-foreground", Fimage_instance_foreground, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796 Return the foreground color of IMAGE-INSTANCE, if applicable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 This will be a color instance or nil. (It will only be non-nil for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 colorized mono pixmaps and for pointers.)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1799 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1800 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1803 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 return XIMAGE_INSTANCE_PIXMAP_FG (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1812 case IMAGE_WIDGET:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1813 return FACE_FOREGROUND (
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1814 XIMAGE_INSTANCE_WIDGET_FACE (image_instance),
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1815 XIMAGE_INSTANCE_FRAME
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1816 (image_instance));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1817
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1823 DEFUN ("image-instance-background", Fimage_instance_background, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 Return the background color of IMAGE-INSTANCE, if applicable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 This will be a color instance or nil. (It will only be non-nil for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 colorized mono pixmaps and for pointers.)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1827 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1828 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1831 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 return XIMAGE_INSTANCE_PIXMAP_BG (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1840 case IMAGE_WIDGET:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1841 return FACE_BACKGROUND (
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1842 XIMAGE_INSTANCE_WIDGET_FACE (image_instance),
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1843 XIMAGE_INSTANCE_FRAME
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1844 (image_instance));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1845
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1852 DEFUN ("colorize-image-instance", Fcolorize_image_instance, 3, 3, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853 Make the image instance be displayed in the given colors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 This function returns a new image instance that is exactly like the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 specified one except that (if possible) the foreground and background
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 colors and as specified. Currently, this only does anything if the image
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 instance is a mono pixmap; otherwise, the same image instance is returned.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1858 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1859 (image_instance, foreground, background))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 Lisp_Object new;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 Lisp_Object device;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1865 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 CHECK_COLOR_INSTANCE (foreground);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 CHECK_COLOR_INSTANCE (background);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1869 device = image_instance_device (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 if (!HAS_DEVMETH_P (XDEVICE (device), colorize_image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 return image_instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1873 /* #### There should be a copy_image_instance(), which calls a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1874 device-specific method to copy the window-system subobject. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1875 new = allocate_image_instance (XIMAGE_INSTANCE_DOMAIN (image_instance),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1876 Qnil);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 copy_lcrecord (XIMAGE_INSTANCE (new), XIMAGE_INSTANCE (image_instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 /* note that if this method returns non-zero, this method MUST
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 copy any window-system resources, so that when one image instance is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880 freed, the other one is not hosed. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 if (!DEVMETH (XDEVICE (device), colorize_image_instance, (new, foreground,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 background)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 return image_instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 return new;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1887
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1888 /************************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1889 /* Geometry calculations */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1890 /************************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1891
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1892 /* Find out desired geometry of the image instance. If there is no
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1893 special function then just return the width and / or height. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1894 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1895 image_instance_query_geometry (Lisp_Object image_instance,
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
1896 int* width, int* height,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1897 enum image_instance_geometry disp,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1898 Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1899 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1900 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1901 Lisp_Object type;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1902 struct image_instantiator_methods* meths;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1903 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1904
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1905 type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1906 meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1907
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1908 if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1909 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1910 IIFORMAT_METH (meths, query_geometry, (image_instance, width, height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1911 disp, domain));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1912 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1913 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1914 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1915 if (width)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1916 *width = IMAGE_INSTANCE_WIDTH (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1917 if (height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1918 *height = IMAGE_INSTANCE_HEIGHT (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1919 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1920 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1921
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1922 /* Layout the image instance using the provided dimensions. Layout
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1923 widgets are going to do different kinds of calculations to
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1924 determine what size to give things so we could make the layout
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1925 function relatively simple to take account of that. An alternative
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1926 approach is to consider separately the two cases, one where you
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1927 don't mind what size you have (normal widgets) and one where you
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1928 want to specifiy something (layout widgets). */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1929 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1930 image_instance_layout (Lisp_Object image_instance,
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
1931 int width, int height, Lisp_Object domain)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1932 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1933 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1934 Lisp_Object type;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1935 struct image_instantiator_methods* meths;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1936
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1937 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1938
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1939 /* Nothing is as nothing does. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1940 if (NOTHING_IMAGE_INSTANCEP (image_instance))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1941 return;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1942
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1943 type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1944 meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1945
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1946 /* If geometry is unspecified then get some reasonable values for it. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1947 if (width == IMAGE_UNSPECIFIED_GEOMETRY
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1948 ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1949 height == IMAGE_UNSPECIFIED_GEOMETRY)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1950 {
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
1951 int dwidth = IMAGE_UNSPECIFIED_GEOMETRY;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
1952 int dheight = IMAGE_UNSPECIFIED_GEOMETRY;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1953
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1954 /* Get the desired geometry. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1955 if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1956 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1957 IIFORMAT_METH (meths, query_geometry, (image_instance, &dwidth, &dheight,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1958 IMAGE_DESIRED_GEOMETRY,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1959 domain));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1960 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1961 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1962 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1963 dwidth = IMAGE_INSTANCE_WIDTH (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1964 dheight = IMAGE_INSTANCE_HEIGHT (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1965 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1966
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1967 /* Compare with allowed geometry. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1968 if (width == IMAGE_UNSPECIFIED_GEOMETRY)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1969 width = dwidth;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1970 if (height == IMAGE_UNSPECIFIED_GEOMETRY)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1971 height = dheight;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1972 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1973
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1974 /* If we don't have sane values then we cannot layout at this point and
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1975 must just return. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1976 if (width == IMAGE_UNSPECIFIED_GEOMETRY
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1977 ||
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1978 height == IMAGE_UNSPECIFIED_GEOMETRY)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1979 return;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1980
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1981 /* At this point width and height should contain sane values. Thus
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1982 we set the glyph geometry and lay it out. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1983 if (IMAGE_INSTANCE_WIDTH (ii) != width
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1984 ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1985 IMAGE_INSTANCE_HEIGHT (ii) != height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1986 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1987 IMAGE_INSTANCE_SIZE_CHANGED (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1988 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1989
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1990 IMAGE_INSTANCE_WIDTH (ii) = width;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1991 IMAGE_INSTANCE_HEIGHT (ii) = height;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1992
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1993 if (IIFORMAT_METH_OR_GIVEN (meths, layout,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1994 (image_instance, width, height, domain), 1))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1995 /* Do not clear the dirty flag here - redisplay will do this for
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1996 us at the end. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1997 IMAGE_INSTANCE_LAYOUT_CHANGED (ii) = 0;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1998 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1999
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2000 /*
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2001 * Mark image instance in W as dirty if (a) W's faces have changed and
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2002 * (b) GLYPH_OR_II instance in W is a string.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2003 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2004 * Return non-zero if instance has been marked dirty.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2005 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2006 int
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2007 invalidate_glyph_geometry_maybe (Lisp_Object glyph_or_ii, struct window* w)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2008 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2009 if (XFRAME(WINDOW_FRAME(w))->faces_changed)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2010 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2011 Lisp_Object image = glyph_or_ii;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2012
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2013 if (GLYPHP (glyph_or_ii))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2014 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2015 Lisp_Object window;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2016 XSETWINDOW (window, w);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2017 image = glyph_image_instance (glyph_or_ii, window, ERROR_ME_NOT, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2018 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2019
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2020 if (TEXT_IMAGE_INSTANCEP (image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2021 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2022 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2023 IMAGE_INSTANCE_DIRTYP (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2024 IMAGE_INSTANCE_LAYOUT_CHANGED (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2025 if (GLYPHP (glyph_or_ii))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2026 XGLYPH_DIRTYP (glyph_or_ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2027 return 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2028 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2029 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2030
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2031 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2032 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2033
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2035 /************************************************************************/
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2036 /* error helpers */
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2037 /************************************************************************/
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2038 DOESNT_RETURN
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2039 signal_image_error (const char *reason, Lisp_Object frob)
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2040 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2041 signal_error (Qimage_conversion_error,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2042 list2 (build_translated_string (reason), frob));
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2043 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2044
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2045 DOESNT_RETURN
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2046 signal_image_error_2 (const char *reason, Lisp_Object frob0, Lisp_Object frob1)
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2047 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2048 signal_error (Qimage_conversion_error,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2049 list3 (build_translated_string (reason), frob0, frob1));
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2050 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2051
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 * nothing *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056 static int
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
2057 nothing_possible_dest_types (void)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 return IMAGE_NOTHING_MASK;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063 nothing_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2065 int dest_mask, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2067 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 if (dest_mask & IMAGE_NOTHING_MASK)
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2070 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2071 IMAGE_INSTANCE_TYPE (ii) = IMAGE_NOTHING;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2072 IMAGE_INSTANCE_HEIGHT (ii) = 0;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2073 IMAGE_INSTANCE_WIDTH (ii) = 0;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2074 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076 incompatible_image_types (instantiator, dest_mask, IMAGE_NOTHING_MASK);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081 * inherit *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2083
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 inherit_validate (Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087 face_must_be_present (instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091 inherit_normalize (Lisp_Object inst, Lisp_Object console_type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 Lisp_Object face;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
2095 assert (XVECTOR_LENGTH (inst) == 3);
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
2096 face = XVECTOR_DATA (inst)[2];
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 if (!FACEP (face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098 inst = vector3 (Qinherit, Q_face, Fget_face (face));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2099 return inst;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102 static int
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
2103 inherit_possible_dest_types (void)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2104 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105 return IMAGE_MONO_PIXMAP_MASK;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2106 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2108 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2109 inherit_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2111 int dest_mask, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 /* handled specially in image_instantiate */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2114 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2115 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2118 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2119 * string *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2120 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2122 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2123 string_validate (Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2124 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2125 data_must_be_present (instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2126 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2128 static int
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
2129 string_possible_dest_types (void)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2130 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2131 return IMAGE_TEXT_MASK;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2132 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2133
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2134 /* Called from autodetect_instantiate() */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2135 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2136 string_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2137 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2138 int dest_mask, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2139 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2140 Lisp_Object string = find_keyword_in_vector (instantiator, Q_data);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2141 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2142
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2143 /* Should never get here with a domain other than a window. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2144 assert (!NILP (string) && WINDOWP (DOMAIN_WINDOW (domain)));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2145 if (dest_mask & IMAGE_TEXT_MASK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2146 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2147 IMAGE_INSTANCE_TYPE (ii) = IMAGE_TEXT;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2148 IMAGE_INSTANCE_TEXT_STRING (ii) = string;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2149 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2150 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2151 incompatible_image_types (instantiator, dest_mask, IMAGE_TEXT_MASK);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2152 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2153
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2154 /* Sort out the size of the text that is being displayed. Calculating
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2155 it dynamically allows us to change the text and still see
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2156 everything. Note that the following methods are for text not string
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2157 since that is what the instantiated type is. The first method is a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2158 helper that is used elsewhere for calculating text geometry. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2159 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2160 query_string_geometry (Lisp_Object string, Lisp_Object face,
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
2161 int* width, int* height, int* descent, Lisp_Object domain)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2162 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2163 struct font_metric_info fm;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2164 unsigned char charsets[NUM_LEADING_BYTES];
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2165 struct face_cachel frame_cachel;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2166 struct face_cachel *cachel;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2167 Lisp_Object frame = DOMAIN_FRAME (domain);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2168
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2169 /* Compute height */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2170 if (height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2171 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2172 /* Compute string metric info */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2173 find_charsets_in_bufbyte_string (charsets,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2174 XSTRING_DATA (string),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2175 XSTRING_LENGTH (string));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2176
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2177 /* Fallback to the default face if none was provided. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2178 if (!NILP (face))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2179 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2180 reset_face_cachel (&frame_cachel);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2181 update_face_cachel_data (&frame_cachel, frame, face);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2182 cachel = &frame_cachel;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2183 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2184 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2185 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2186 cachel = WINDOW_FACE_CACHEL (DOMAIN_XWINDOW (domain),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2187 DEFAULT_INDEX);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2188 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2189
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2190 ensure_face_cachel_complete (cachel, domain, charsets);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2191 face_cachel_charset_font_metric_info (cachel, charsets, &fm);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2192
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2193 *height = fm.ascent + fm.descent;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2194 /* #### descent only gets set if we query the height as well. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2195 if (descent)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2196 *descent = fm.descent;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2197 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2198
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2199 /* Compute width */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2200 if (width)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2201 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2202 if (!NILP (face))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2203 *width = redisplay_frame_text_width_string (XFRAME (frame),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2204 face,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2205 0, string, 0, -1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2206 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2207 *width = redisplay_frame_text_width_string (XFRAME (frame),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2208 Vdefault_face,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2209 0, string, 0, -1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2210 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2211 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2212
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2213 Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2214 query_string_font (Lisp_Object string, Lisp_Object face, Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2215 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2216 unsigned char charsets[NUM_LEADING_BYTES];
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2217 struct face_cachel frame_cachel;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2218 struct face_cachel *cachel;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2219 int i;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2220 Lisp_Object frame = DOMAIN_FRAME (domain);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2221
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2222 /* Compute string font info */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2223 find_charsets_in_bufbyte_string (charsets,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2224 XSTRING_DATA (string),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2225 XSTRING_LENGTH (string));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2226
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2227 reset_face_cachel (&frame_cachel);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2228 update_face_cachel_data (&frame_cachel, frame, face);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2229 cachel = &frame_cachel;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2230
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2231 ensure_face_cachel_complete (cachel, domain, charsets);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2232
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2233 for (i = 0; i < NUM_LEADING_BYTES; i++)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2234 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2235 if (charsets[i])
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2236 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2237 return FACE_CACHEL_FONT (cachel,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2238 CHARSET_BY_LEADING_BYTE (i +
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2239 MIN_LEADING_BYTE));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2240
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2241 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2242 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2243
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2244 return Qnil; /* NOT REACHED */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2245 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2246
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2247 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2248 text_query_geometry (Lisp_Object image_instance,
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
2249 int* width, int* height,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2250 enum image_instance_geometry disp, Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2251 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2252 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
2253 int descent = 0;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2254
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2255 query_string_geometry (IMAGE_INSTANCE_TEXT_STRING (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2256 IMAGE_INSTANCE_FACE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2257 width, height, &descent, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2258
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2259 /* The descent gets set as a side effect of querying the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2260 geometry. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2261 IMAGE_INSTANCE_TEXT_DESCENT (ii) = descent;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2262 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2263
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2264 /* set the properties of a string */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2265 static Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2266 text_set_property (Lisp_Object image_instance, Lisp_Object prop,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2267 Lisp_Object val)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2268 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2269 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2270
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2271 if (EQ (prop, Q_data))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2272 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2273 CHECK_STRING (val);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2274 IMAGE_INSTANCE_TEXT_STRING (ii) = val;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2275
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2276 return Qt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2277 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2278 return Qunbound;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2279 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2280
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2282 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2283 * formatted-string *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2284 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2286 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2287 formatted_string_validate (Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2288 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2289 data_must_be_present (instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2290 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292 static int
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
2293 formatted_string_possible_dest_types (void)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295 return IMAGE_TEXT_MASK;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299 formatted_string_instantiate (Lisp_Object image_instance,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300 Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2302 int dest_mask, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2303 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2304 /* #### implement this */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2305 warn_when_safe (Qunimplemented, Qnotice,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2306 "`formatted-string' not yet implemented; assuming `string'");
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2307
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2308 string_instantiate (image_instance, instantiator,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2309 pointer_fg, pointer_bg, dest_mask, domain);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2310 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2312
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2313 /************************************************************************/
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2314 /* pixmap file functions */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2315 /************************************************************************/
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2316
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2317 /* If INSTANTIATOR refers to inline data, return Qnil.
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2318 If INSTANTIATOR refers to data in a file, return the full filename
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2319 if it exists; otherwise, return a cons of (filename).
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2320
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2321 FILE_KEYWORD and DATA_KEYWORD are symbols specifying the
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2322 keywords used to look up the file and inline data,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2323 respectively, in the instantiator. Normally these would
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2324 be Q_file and Q_data, but might be different for mask data. */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2325
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2326 Lisp_Object
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2327 potential_pixmap_file_instantiator (Lisp_Object instantiator,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2328 Lisp_Object file_keyword,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2329 Lisp_Object data_keyword,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2330 Lisp_Object console_type)
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2331 {
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2332 Lisp_Object file;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2333 Lisp_Object data;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2334
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2335 assert (VECTORP (instantiator));
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2336
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2337 data = find_keyword_in_vector (instantiator, data_keyword);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2338 file = find_keyword_in_vector (instantiator, file_keyword);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2339
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2340 if (!NILP (file) && NILP (data))
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2341 {
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2342 Lisp_Object retval = MAYBE_LISP_CONTYPE_METH
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2343 (decode_console_type(console_type, ERROR_ME),
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2344 locate_pixmap_file, (file));
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2345
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2346 if (!NILP (retval))
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2347 return retval;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2348 else
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2349 return Fcons (file, Qnil); /* should have been file */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2350 }
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2351
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2352 return Qnil;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2353 }
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2354
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2355 Lisp_Object
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2356 simple_image_type_normalize (Lisp_Object inst, Lisp_Object console_type,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2357 Lisp_Object image_type_tag)
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2358 {
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2359 /* This function can call lisp */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2360 Lisp_Object file = Qnil;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2361 struct gcpro gcpro1, gcpro2;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2362 Lisp_Object alist = Qnil;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2363
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2364 GCPRO2 (file, alist);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2365
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2366 /* Now, convert any file data into inline data. At the end of this,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2367 `data' will contain the inline data (if any) or Qnil, and `file'
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2368 will contain the name this data was derived from (if known) or
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2369 Qnil.
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2370
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2371 Note that if we cannot generate any regular inline data, we
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2372 skip out. */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2373
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2374 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2375 console_type);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2376
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2377 if (CONSP (file)) /* failure locating filename */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2378 signal_double_file_error ("Opening pixmap file",
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2379 "no such file or directory",
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2380 Fcar (file));
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2381
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2382 if (NILP (file)) /* no conversion necessary */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2383 RETURN_UNGCPRO (inst);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2384
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2385 alist = tagged_vector_to_alist (inst);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2386
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2387 {
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2388 Lisp_Object data = make_string_from_file (file);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2389 alist = remassq_no_quit (Q_file, alist);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2390 /* there can't be a :data at this point. */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2391 alist = Fcons (Fcons (Q_file, file),
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2392 Fcons (Fcons (Q_data, data), alist));
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2393 }
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2394
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2395 {
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2396 Lisp_Object result = alist_to_tagged_vector (image_type_tag, alist);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2397 free_alist (alist);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2398 RETURN_UNGCPRO (result);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2399 }
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2400 }
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2401
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2402
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2403 #ifdef HAVE_WINDOW_SYSTEM
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2404 /**********************************************************************
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2405 * XBM *
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2406 **********************************************************************/
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2407
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2408 /* Check if DATA represents a valid inline XBM spec (i.e. a list
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2409 of (width height bits), with checking done on the dimensions).
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2410 If not, signal an error. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2411
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2412 static void
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2413 check_valid_xbm_inline (Lisp_Object data)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2414 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2415 Lisp_Object width, height, bits;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2416
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2417 if (!CONSP (data) ||
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2418 !CONSP (XCDR (data)) ||
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2419 !CONSP (XCDR (XCDR (data))) ||
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2420 !NILP (XCDR (XCDR (XCDR (data)))))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2421 signal_simple_error ("Must be list of 3 elements", data);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2422
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2423 width = XCAR (data);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2424 height = XCAR (XCDR (data));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2425 bits = XCAR (XCDR (XCDR (data)));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2426
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2427 CHECK_STRING (bits);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2428
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2429 if (!NATNUMP (width))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2430 signal_simple_error ("Width must be a natural number", width);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2431
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2432 if (!NATNUMP (height))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2433 signal_simple_error ("Height must be a natural number", height);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2434
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2435 if (((XINT (width) * XINT (height)) / 8) > XSTRING_CHAR_LENGTH (bits))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2436 signal_simple_error ("data is too short for width and height",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2437 vector3 (width, height, bits));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2438 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2439
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2440 /* Validate method for XBM's. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2441
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2442 static void
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2443 xbm_validate (Lisp_Object instantiator)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2444 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2445 file_or_data_must_be_present (instantiator);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2446 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2447
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2448 /* Given a filename that is supposed to contain XBM data, return
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2449 the inline representation of it as (width height bits). Return
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2450 the hotspot through XHOT and YHOT, if those pointers are not 0.
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2451 If there is no hotspot, XHOT and YHOT will contain -1.
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2452
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2453 If the function fails:
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2454
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2455 -- if OK_IF_DATA_INVALID is set and the data was invalid,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2456 return Qt.
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2457 -- maybe return an error, or return Qnil.
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2458 */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2459
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2460 #ifdef HAVE_X_WINDOWS
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2461 #include <X11/Xlib.h>
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2462 #else
290
c9fe270a4101 Import from CVS: tag r21-0b43
cvs
parents: 288
diff changeset
2463 #define XFree(data) free(data)
c9fe270a4101 Import from CVS: tag r21-0b43
cvs
parents: 288
diff changeset
2464 #endif
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2465
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2466 Lisp_Object
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2467 bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2468 int ok_if_data_invalid)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2469 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2470 unsigned int w, h;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2471 Extbyte *data;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2472 int result;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2473 const char *filename_ext;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2474
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2475 TO_EXTERNAL_FORMAT (LISP_STRING, name,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2476 C_STRING_ALLOCA, filename_ext,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2477 Qfile_name);
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2478 result = read_bitmap_data_from_file (filename_ext, &w, &h,
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2479 &data, xhot, yhot);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2480
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2481 if (result == BitmapSuccess)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2482 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2483 Lisp_Object retval;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2484 int len = (w + 7) / 8 * h;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2485
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2486 retval = list3 (make_int (w), make_int (h),
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2487 make_ext_string (data, len, Qbinary));
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2488 XFree ((char *) data);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2489 return retval;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2490 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2491
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2492 switch (result)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2493 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2494 case BitmapOpenFailed:
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2495 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2496 /* should never happen */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2497 signal_double_file_error ("Opening bitmap file",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2498 "no such file or directory",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2499 name);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2500 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2501 case BitmapFileInvalid:
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2502 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2503 if (ok_if_data_invalid)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2504 return Qt;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2505 signal_double_file_error ("Reading bitmap file",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2506 "invalid data in file",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2507 name);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2508 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2509 case BitmapNoMemory:
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2510 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2511 signal_double_file_error ("Reading bitmap file",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2512 "out of memory",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2513 name);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2514 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2515 default:
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2516 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2517 signal_double_file_error_2 ("Reading bitmap file",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2518 "unknown error code",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2519 make_int (result), name);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2520 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2521 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2522
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2523 return Qnil; /* not reached */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2524 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2525
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2526 Lisp_Object
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2527 xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2528 Lisp_Object mask_file, Lisp_Object console_type)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2529 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2530 /* This is unclean but it's fairly standard -- a number of the
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2531 bitmaps in /usr/include/X11/bitmaps use it -- so we support
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2532 it. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2533 if (NILP (mask_file)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2534 /* don't override explicitly specified mask data. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2535 && NILP (assq_no_quit (Q_mask_data, alist))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2536 && !NILP (file))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2537 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2538 mask_file = MAYBE_LISP_CONTYPE_METH
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2539 (decode_console_type(console_type, ERROR_ME),
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2540 locate_pixmap_file, (concat2 (file, build_string ("Mask"))));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2541 if (NILP (mask_file))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2542 mask_file = MAYBE_LISP_CONTYPE_METH
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2543 (decode_console_type(console_type, ERROR_ME),
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2544 locate_pixmap_file, (concat2 (file, build_string ("msk"))));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2545 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2546
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2547 if (!NILP (mask_file))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2548 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2549 Lisp_Object mask_data =
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2550 bitmap_to_lisp_data (mask_file, 0, 0, 0);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2551 alist = remassq_no_quit (Q_mask_file, alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2552 /* there can't be a :mask-data at this point. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2553 alist = Fcons (Fcons (Q_mask_file, mask_file),
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2554 Fcons (Fcons (Q_mask_data, mask_data), alist));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2555 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2556
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2557 return alist;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2558 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2559
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2560 /* Normalize method for XBM's. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2561
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2562 static Lisp_Object
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2563 xbm_normalize (Lisp_Object inst, Lisp_Object console_type)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2564 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2565 Lisp_Object file = Qnil, mask_file = Qnil;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2566 struct gcpro gcpro1, gcpro2, gcpro3;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2567 Lisp_Object alist = Qnil;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2568
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2569 GCPRO3 (file, mask_file, alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2570
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2571 /* Now, convert any file data into inline data for both the regular
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2572 data and the mask data. At the end of this, `data' will contain
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2573 the inline data (if any) or Qnil, and `file' will contain
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2574 the name this data was derived from (if known) or Qnil.
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2575 Likewise for `mask_file' and `mask_data'.
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2576
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2577 Note that if we cannot generate any regular inline data, we
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2578 skip out. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2579
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2580 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2581 console_type);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2582 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2583 Q_mask_data, console_type);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2584
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2585 if (CONSP (file)) /* failure locating filename */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2586 signal_double_file_error ("Opening bitmap file",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2587 "no such file or directory",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2588 Fcar (file));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2589
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2590 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2591 RETURN_UNGCPRO (inst);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2592
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2593 alist = tagged_vector_to_alist (inst);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2594
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2595 if (!NILP (file))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2596 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2597 int xhot, yhot;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2598 Lisp_Object data = bitmap_to_lisp_data (file, &xhot, &yhot, 0);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2599 alist = remassq_no_quit (Q_file, alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2600 /* there can't be a :data at this point. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2601 alist = Fcons (Fcons (Q_file, file),
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2602 Fcons (Fcons (Q_data, data), alist));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2603
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2604 if (xhot != -1 && NILP (assq_no_quit (Q_hotspot_x, alist)))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2605 alist = Fcons (Fcons (Q_hotspot_x, make_int (xhot)),
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2606 alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2607 if (yhot != -1 && NILP (assq_no_quit (Q_hotspot_y, alist)))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2608 alist = Fcons (Fcons (Q_hotspot_y, make_int (yhot)),
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2609 alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2610 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2611
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2612 alist = xbm_mask_file_munging (alist, file, mask_file, console_type);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2613
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2614 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2615 Lisp_Object result = alist_to_tagged_vector (Qxbm, alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2616 free_alist (alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2617 RETURN_UNGCPRO (result);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2618 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2619 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2620
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2621
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2622 static int
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2623 xbm_possible_dest_types (void)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2624 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2625 return
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2626 IMAGE_MONO_PIXMAP_MASK |
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2627 IMAGE_COLOR_PIXMAP_MASK |
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2628 IMAGE_POINTER_MASK;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2629 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2630
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2631 #endif
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2632
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2633
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2634 #ifdef HAVE_XFACE
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2635 /**********************************************************************
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2636 * X-Face *
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2637 **********************************************************************/
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2638
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2639 static void
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2640 xface_validate (Lisp_Object instantiator)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2641 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2642 file_or_data_must_be_present (instantiator);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2643 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2644
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2645 static Lisp_Object
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2646 xface_normalize (Lisp_Object inst, Lisp_Object console_type)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2647 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2648 /* This function can call lisp */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2649 Lisp_Object file = Qnil, mask_file = Qnil;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2650 struct gcpro gcpro1, gcpro2, gcpro3;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2651 Lisp_Object alist = Qnil;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2652
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2653 GCPRO3 (file, mask_file, alist);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2654
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2655 /* Now, convert any file data into inline data for both the regular
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2656 data and the mask data. At the end of this, `data' will contain
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2657 the inline data (if any) or Qnil, and `file' will contain
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2658 the name this data was derived from (if known) or Qnil.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2659 Likewise for `mask_file' and `mask_data'.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2660
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2661 Note that if we cannot generate any regular inline data, we
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2662 skip out. */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2663
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2664 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2665 console_type);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2666 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2667 Q_mask_data, console_type);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2668
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2669 if (CONSP (file)) /* failure locating filename */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2670 signal_double_file_error ("Opening bitmap file",
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2671 "no such file or directory",
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2672 Fcar (file));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2673
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2674 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2675 RETURN_UNGCPRO (inst);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2676
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2677 alist = tagged_vector_to_alist (inst);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2678
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2679 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2680 Lisp_Object data = make_string_from_file (file);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2681 alist = remassq_no_quit (Q_file, alist);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2682 /* there can't be a :data at this point. */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2683 alist = Fcons (Fcons (Q_file, file),
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2684 Fcons (Fcons (Q_data, data), alist));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2685 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2686
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2687 alist = xbm_mask_file_munging (alist, file, mask_file, console_type);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2688
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2689 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2690 Lisp_Object result = alist_to_tagged_vector (Qxface, alist);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2691 free_alist (alist);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2692 RETURN_UNGCPRO (result);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2693 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2694 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2695
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2696 static int
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2697 xface_possible_dest_types (void)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2698 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2699 return
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2700 IMAGE_MONO_PIXMAP_MASK |
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2701 IMAGE_COLOR_PIXMAP_MASK |
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2702 IMAGE_POINTER_MASK;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2703 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2704
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2705 #endif /* HAVE_XFACE */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2706
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2707
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2708 #ifdef HAVE_XPM
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2709
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2710 /**********************************************************************
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2711 * XPM *
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2712 **********************************************************************/
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2713
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2714 Lisp_Object
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2715 pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2716 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2717 char **data;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2718 int result;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
2719 char *fname = 0;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2720
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2721 TO_EXTERNAL_FORMAT (LISP_STRING, name,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2722 C_STRING_ALLOCA, fname,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2723 Qfile_name);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
2724 result = XpmReadFileToData (fname, &data);
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2725
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2726 if (result == XpmSuccess)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2727 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2728 Lisp_Object retval = Qnil;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2729 struct buffer *old_buffer = current_buffer;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2730 Lisp_Object temp_buffer =
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2731 Fget_buffer_create (build_string (" *pixmap conversion*"));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2732 int elt;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2733 int height, width, ncolors;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2734 struct gcpro gcpro1, gcpro2, gcpro3;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2735 int speccount = specpdl_depth ();
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2736
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2737 GCPRO3 (name, retval, temp_buffer);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2738
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2739 specbind (Qinhibit_quit, Qt);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2740 set_buffer_internal (XBUFFER (temp_buffer));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2741 Ferase_buffer (Qnil);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2742
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2743 buffer_insert_c_string (current_buffer, "/* XPM */\r");
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2744 buffer_insert_c_string (current_buffer, "static char *pixmap[] = {\r");
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2745
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2746 sscanf (data[0], "%d %d %d", &height, &width, &ncolors);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2747 for (elt = 0; elt <= width + ncolors; elt++)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2748 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2749 buffer_insert_c_string (current_buffer, "\"");
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2750 buffer_insert_c_string (current_buffer, data[elt]);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2751
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2752 if (elt < width + ncolors)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2753 buffer_insert_c_string (current_buffer, "\",\r");
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2754 else
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2755 buffer_insert_c_string (current_buffer, "\"};\r");
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2756 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2757
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2758 retval = Fbuffer_substring (Qnil, Qnil, Qnil);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2759 XpmFree (data);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2760
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2761 set_buffer_internal (old_buffer);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2762 unbind_to (speccount, Qnil);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2763
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2764 RETURN_UNGCPRO (retval);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2765 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2766
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2767 switch (result)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2768 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2769 case XpmFileInvalid:
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2770 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2771 if (ok_if_data_invalid)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2772 return Qt;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2773 signal_image_error ("invalid XPM data in file", name);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2774 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2775 case XpmNoMemory:
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2776 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2777 signal_double_file_error ("Reading pixmap file",
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2778 "out of memory", name);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2779 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2780 case XpmOpenFailed:
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2781 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2782 /* should never happen? */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2783 signal_double_file_error ("Opening pixmap file",
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2784 "no such file or directory", name);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2785 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2786 default:
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2787 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2788 signal_double_file_error_2 ("Parsing pixmap file",
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2789 "unknown error code",
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2790 make_int (result), name);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2791 break;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2792 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2793 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2794
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2795 return Qnil; /* not reached */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2796 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2797
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2798 static void
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2799 check_valid_xpm_color_symbols (Lisp_Object data)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2800 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2801 Lisp_Object rest;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2802
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2803 for (rest = data; !NILP (rest); rest = XCDR (rest))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2804 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2805 if (!CONSP (rest) ||
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2806 !CONSP (XCAR (rest)) ||
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2807 !STRINGP (XCAR (XCAR (rest))) ||
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2808 (!STRINGP (XCDR (XCAR (rest))) &&
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2809 !COLOR_SPECIFIERP (XCDR (XCAR (rest)))))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2810 signal_simple_error ("Invalid color symbol alist", data);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2811 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2812 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2813
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2814 static void
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2815 xpm_validate (Lisp_Object instantiator)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2816 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2817 file_or_data_must_be_present (instantiator);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2818 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2819
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2820 Lisp_Object Vxpm_color_symbols;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2821
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2822 Lisp_Object
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2823 evaluate_xpm_color_symbols (void)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2824 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2825 Lisp_Object rest, results = Qnil;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2826 struct gcpro gcpro1, gcpro2;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2827
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2828 GCPRO2 (rest, results);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2829 for (rest = Vxpm_color_symbols; !NILP (rest); rest = XCDR (rest))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2830 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2831 Lisp_Object name, value, cons;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2832
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2833 CHECK_CONS (rest);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2834 cons = XCAR (rest);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2835 CHECK_CONS (cons);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2836 name = XCAR (cons);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2837 CHECK_STRING (name);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2838 value = XCDR (cons);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2839 CHECK_CONS (value);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2840 value = XCAR (value);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2841 value = Feval (value);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2842 if (NILP (value))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2843 continue;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2844 if (!STRINGP (value) && !COLOR_SPECIFIERP (value))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2845 signal_simple_error
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2846 ("Result from xpm-color-symbols eval must be nil, string, or color",
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2847 value);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2848 results = Fcons (Fcons (name, value), results);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2849 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2850 UNGCPRO; /* no more evaluation */
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2851 return results;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2852 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2853
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2854 static Lisp_Object
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2855 xpm_normalize (Lisp_Object inst, Lisp_Object console_type)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2856 {
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2857 Lisp_Object file = Qnil;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2858 Lisp_Object color_symbols;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2859 struct gcpro gcpro1, gcpro2;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2860 Lisp_Object alist = Qnil;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2861
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2862 GCPRO2 (file, alist);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2863
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2864 /* Now, convert any file data into inline data. At the end of this,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2865 `data' will contain the inline data (if any) or Qnil, and
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2866 `file' will contain the name this data was derived from (if
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2867 known) or Qnil.
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2868
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2869 Note that if we cannot generate any regular inline data, we
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2870 skip out. */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2871
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2872 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2873 console_type);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2874
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2875 if (CONSP (file)) /* failure locating filename */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2876 signal_double_file_error ("Opening pixmap file",
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2877 "no such file or directory",
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2878 Fcar (file));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2879
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2880 color_symbols = find_keyword_in_vector_or_given (inst, Q_color_symbols,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2881 Qunbound);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2882
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2883 if (NILP (file) && !UNBOUNDP (color_symbols))
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2884 /* no conversion necessary */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2885 RETURN_UNGCPRO (inst);
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2886
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2887 alist = tagged_vector_to_alist (inst);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2888
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2889 if (!NILP (file))
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2890 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2891 Lisp_Object data = pixmap_to_lisp_data (file, 0);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2892 alist = remassq_no_quit (Q_file, alist);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2893 /* there can't be a :data at this point. */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2894 alist = Fcons (Fcons (Q_file, file),
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2895 Fcons (Fcons (Q_data, data), alist));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2896 }
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2897
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2898 if (UNBOUNDP (color_symbols))
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2899 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2900 color_symbols = evaluate_xpm_color_symbols ();
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2901 alist = Fcons (Fcons (Q_color_symbols, color_symbols),
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2902 alist);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2903 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2904
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2905 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2906 Lisp_Object result = alist_to_tagged_vector (Qxpm, alist);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2907 free_alist (alist);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2908 RETURN_UNGCPRO (result);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2909 }
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2910 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2911
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2912 static int
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2913 xpm_possible_dest_types (void)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2914 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2915 return
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2916 IMAGE_MONO_PIXMAP_MASK |
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2917 IMAGE_COLOR_PIXMAP_MASK |
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2918 IMAGE_POINTER_MASK;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2919 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2920
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2921 #endif /* HAVE_XPM */
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2922
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2923
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2924 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2925 * Image Specifier Object *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2926 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2927
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2928 DEFINE_SPECIFIER_TYPE (image);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2929
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2930 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2931 image_create (Lisp_Object obj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2932 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2933 Lisp_Specifier *image = XIMAGE_SPECIFIER (obj);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2934
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2935 IMAGE_SPECIFIER_ALLOWED (image) = ~0; /* all are allowed */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2936 IMAGE_SPECIFIER_ATTACHEE (image) = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2937 IMAGE_SPECIFIER_ATTACHEE_PROPERTY (image) = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2938 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2939
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2940 static void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2941 image_mark (Lisp_Object obj)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2942 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2943 Lisp_Specifier *image = XIMAGE_SPECIFIER (obj);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2944
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2945 mark_object (IMAGE_SPECIFIER_ATTACHEE (image));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2946 mark_object (IMAGE_SPECIFIER_ATTACHEE_PROPERTY (image));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2947 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2948
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2949 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2950 image_instantiate_cache_result (Lisp_Object locative)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2951 {
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2952 /* locative = (instance instantiator . subtable)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2953
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2954 So we are using the instantiator as the key and the instance as
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2955 the value. Since the hashtable is key-weak this means that the
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2956 image instance will stay around as long as the instantiator stays
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2957 around. The instantiator is stored in the `image' slot of the
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2958 glyph, so as long as the glyph is marked the instantiator will be
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2959 as well and hence the cached image instance also.*/
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
2960 Fputhash (XCAR (XCDR (locative)), XCAR (locative), XCDR (XCDR (locative)));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2961 free_cons (XCONS (XCDR (locative)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2962 free_cons (XCONS (locative));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2963 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2964 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2966 /* Given a specification for an image, return an instance of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2967 the image which matches the given instantiator and which can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2968 displayed in the given domain. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2969
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2970 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2971 image_instantiate (Lisp_Object specifier, Lisp_Object matchspec,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2972 Lisp_Object domain, Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2973 Lisp_Object depth)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2974 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2975 Lisp_Object glyph = IMAGE_SPECIFIER_ATTACHEE (XIMAGE_SPECIFIER (specifier));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2976 int dest_mask = XIMAGE_SPECIFIER_ALLOWED (specifier);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2977 int pointerp = dest_mask & image_instance_type_to_mask (IMAGE_POINTER);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2978
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2979 if (IMAGE_INSTANCEP (instantiator))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2980 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2981 /* make sure that the image instance's governing domain and type are
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2982 matching. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2983 Lisp_Object governing_domain = XIMAGE_INSTANCE_DOMAIN (instantiator);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2984
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2985 if ((DEVICEP (governing_domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2986 && EQ (governing_domain, DOMAIN_DEVICE (domain)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2987 || (FRAMEP (governing_domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2988 && EQ (governing_domain, DOMAIN_FRAME (domain)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2989 || (WINDOWP (governing_domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2990 && EQ (governing_domain, DOMAIN_WINDOW (domain))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2991 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2992 int mask =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2993 image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instantiator));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2994 if (mask & dest_mask)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2995 return instantiator;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2996 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2997 signal_simple_error ("Type of image instance not allowed here",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2998 instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2999 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3000 else
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3001 signal_simple_error_2 ("Wrong domain for image instance",
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3002 instantiator, domain);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3003 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3004 else if (VECTORP (instantiator)
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3005 && EQ (XVECTOR_DATA (instantiator)[0], Qinherit))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3006 {
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3007 assert (XVECTOR_LENGTH (instantiator) == 3);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3008 return (FACE_PROPERTY_INSTANCE
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3009 (Fget_face (XVECTOR_DATA (instantiator)[2]),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3010 Qbackground_pixmap, domain, 0, depth));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3011 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3012 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3013 {
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
3014 Lisp_Object instance = Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
3015 Lisp_Object subtable = Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3016 Lisp_Object ls3 = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3017 Lisp_Object pointer_fg = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3018 Lisp_Object pointer_bg = Qnil;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3019 Lisp_Object governing_domain =
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3020 get_image_instantiator_governing_domain (instantiator, domain);
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
3021 struct gcpro gcpro1;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
3022
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
3023 GCPRO1 (instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3024
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3025 /* We have to put subwindow, widget and text image instances in
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3026 a per-window cache so that we can see the same glyph in
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3027 different windows. We use governing_domain to determine the type
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3028 of image_instance that will be created. */
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
3029
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3030 if (pointerp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3031 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3032 pointer_fg = FACE_FOREGROUND (Vpointer_face, domain);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3033 pointer_bg = FACE_BACKGROUND (Vpointer_face, domain);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3034 ls3 = list3 (instantiator, pointer_fg, pointer_bg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3035 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3036
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3037 /* First look in the device cache. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3038 if (DEVICEP (governing_domain))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3039 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3040 subtable = Fgethash (make_int (dest_mask),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3041 XDEVICE (governing_domain)->
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3042 image_instance_cache,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3043 Qunbound);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3044 if (UNBOUNDP (subtable))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3045 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3046 /* For the image instance cache, we do comparisons with
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3047 EQ rather than with EQUAL, as we do for color and
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3048 font names. The reasons are:
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3049
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3050 1) pixmap data can be very long, and thus the hashing
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3051 and comparing will take awhile.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3052
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3053 2) It's not so likely that we'll run into things that
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3054 are EQUAL but not EQ (that can happen a lot with
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3055 faces, because their specifiers are copied around);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3056 but pixmaps tend not to be in faces.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3057
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3058 However, if the image-instance could be a pointer, we
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3059 have to use EQUAL because we massaged the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3060 instantiator into a cons3 also containing the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3061 foreground and background of the pointer face. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3062
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3063 subtable = make_lisp_hash_table
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3064 (20, pointerp ? HASH_TABLE_KEY_CAR_WEAK
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3065 : HASH_TABLE_KEY_WEAK,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3066 pointerp ? HASH_TABLE_EQUAL
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3067 : HASH_TABLE_EQ);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3068 Fputhash (make_int (dest_mask), subtable,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3069 XDEVICE (governing_domain)->image_instance_cache);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3070 instance = Qunbound;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3071 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3072 else
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3073 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3074 instance = Fgethash (pointerp ? ls3 : instantiator,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3075 subtable, Qunbound);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3076 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3077 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3078 else if (WINDOWP (governing_domain))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3079 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3080 /* Subwindows have a per-window cache and have to be treated
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3081 differently. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3082 instance =
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3083 Fgethash (instantiator,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3084 XWINDOW (governing_domain)->subwindow_instance_cache,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3085 Qunbound);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3086 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3087 else
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3088 abort (); /* We're not allowed anything else currently. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3089
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3090 /* If we don't have an instance at this point then create
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3091 one. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3092 if (UNBOUNDP (instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3093 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3094 Lisp_Object locative =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3095 noseeum_cons (Qnil,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3096 noseeum_cons (pointerp ? ls3 : instantiator,
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3097 DEVICEP (governing_domain) ? subtable
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3098 : XWINDOW (governing_domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3099 ->subwindow_instance_cache));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3100 int speccount = specpdl_depth ();
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3101
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3102 /* Make sure we cache the failures, too. Use an
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3103 unwind-protect to catch such errors. If we fail, the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3104 unwind-protect records nil in the hash table. If we
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3105 succeed, we change the car of the locative to the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3106 resulting instance, which gets recorded instead. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3107 record_unwind_protect (image_instantiate_cache_result,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3108 locative);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3109 instance =
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3110 instantiate_image_instantiator (governing_domain,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3111 domain, instantiator,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3112 pointer_fg, pointer_bg,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3113 dest_mask, glyph);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3114
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3115 /* We need a per-frame cache for redisplay. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3116 cache_subwindow_instance_in_frame_maybe (instance);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3117
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3118 Fsetcar (locative, instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3119 #ifdef ERROR_CHECK_GLYPHS
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
3120 if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance))
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3121 & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3122 assert (EQ (XIMAGE_INSTANCE_FRAME (instance),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3123 DOMAIN_FRAME (domain)));
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3124 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3125 unbind_to (speccount, Qnil);
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3126 #ifdef ERROR_CHECK_GLYPHS
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3127 if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance))
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3128 & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK))
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3129 assert (EQ (Fgethash ((pointerp ? ls3 : instantiator),
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3130 XWINDOW (governing_domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3131 ->subwindow_instance_cache,
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3132 Qunbound), instance));
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3133 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3134 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3135 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3136 free_list (ls3);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3138 if (NILP (instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3139 signal_simple_error ("Can't instantiate image (probably cached)",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3140 instantiator);
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3141 #ifdef ERROR_CHECK_GLYPHS
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3142 if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3143 & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK))
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3144 assert (EQ (XIMAGE_INSTANCE_FRAME (instance),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3145 DOMAIN_FRAME (domain)));
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3146 #endif
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3147 ERROR_CHECK_IMAGE_INSTANCE (instance);
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
3148 RETURN_UNGCPRO (instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3149 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3150
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3151 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3152 return Qnil; /* not reached */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3153 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3155 /* Validate an image instantiator. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3157 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3158 image_validate (Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3159 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3160 if (IMAGE_INSTANCEP (instantiator) || STRINGP (instantiator))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3161 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3162 else if (VECTORP (instantiator))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3163 {
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3164 Lisp_Object *elt = XVECTOR_DATA (instantiator);
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3165 int instantiator_len = XVECTOR_LENGTH (instantiator);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3166 struct image_instantiator_methods *meths;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3167 Lisp_Object already_seen = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3168 struct gcpro gcpro1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3169 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3171 if (instantiator_len < 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3172 signal_simple_error ("Vector length must be at least 1",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3173 instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3175 meths = decode_image_instantiator_format (elt[0], ERROR_ME);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3176 if (!(instantiator_len & 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3177 signal_simple_error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3178 ("Must have alternating keyword/value pairs", instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3180 GCPRO1 (already_seen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3182 for (i = 1; i < instantiator_len; i += 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3183 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3184 Lisp_Object keyword = elt[i];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3185 Lisp_Object value = elt[i+1];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3186 int j;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3188 CHECK_SYMBOL (keyword);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3189 if (!SYMBOL_IS_KEYWORD (keyword))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3190 signal_simple_error ("Symbol must begin with a colon", keyword);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3192 for (j = 0; j < Dynarr_length (meths->keywords); j++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3193 if (EQ (keyword, Dynarr_at (meths->keywords, j).keyword))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3194 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3196 if (j == Dynarr_length (meths->keywords))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3197 signal_simple_error ("Unrecognized keyword", keyword);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3199 if (!Dynarr_at (meths->keywords, j).multiple_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3200 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3201 if (!NILP (memq_no_quit (keyword, already_seen)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3202 signal_simple_error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3203 ("Keyword may not appear more than once", keyword);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3204 already_seen = Fcons (keyword, already_seen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3205 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3207 (Dynarr_at (meths->keywords, j).validate) (value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3208 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3210 UNGCPRO;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3212 MAYBE_IIFORMAT_METH (meths, validate, (instantiator));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3213 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3214 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3215 signal_simple_error ("Must be string or vector", instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3216 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3218 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3219 image_after_change (Lisp_Object specifier, Lisp_Object locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3220 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3221 Lisp_Object attachee =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3222 IMAGE_SPECIFIER_ATTACHEE (XIMAGE_SPECIFIER (specifier));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3223 Lisp_Object property =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3224 IMAGE_SPECIFIER_ATTACHEE_PROPERTY (XIMAGE_SPECIFIER (specifier));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3225 if (FACEP (attachee))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3226 face_property_was_changed (attachee, property, locale);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3227 else if (GLYPHP (attachee))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3228 glyph_property_was_changed (attachee, property, locale);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3229 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3231 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3232 set_image_attached_to (Lisp_Object obj, Lisp_Object face_or_glyph,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3233 Lisp_Object property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3234 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3235 Lisp_Specifier *image = XIMAGE_SPECIFIER (obj);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3237 IMAGE_SPECIFIER_ATTACHEE (image) = face_or_glyph;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3238 IMAGE_SPECIFIER_ATTACHEE_PROPERTY (image) = property;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3239 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3241 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3242 image_going_to_add (Lisp_Object specifier, Lisp_Object locale,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3243 Lisp_Object tag_set, Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3244 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3245 Lisp_Object possible_console_types = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3246 Lisp_Object rest;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3247 Lisp_Object retlist = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3248 struct gcpro gcpro1, gcpro2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3250 LIST_LOOP (rest, Vconsole_type_list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3251 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3252 Lisp_Object contype = XCAR (rest);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3253 if (!NILP (memq_no_quit (contype, tag_set)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3254 possible_console_types = Fcons (contype, possible_console_types);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3255 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3257 if (XINT (Flength (possible_console_types)) > 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3258 /* two conflicting console types specified */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3259 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3261 if (NILP (possible_console_types))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3262 possible_console_types = Vconsole_type_list;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3264 GCPRO2 (retlist, possible_console_types);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3266 LIST_LOOP (rest, possible_console_types)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3267 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3268 Lisp_Object contype = XCAR (rest);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3269 Lisp_Object newinst = call_with_suspended_errors
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
3270 ((lisp_fn_t) normalize_image_instantiator,
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
3271 Qnil, Qimage, ERROR_ME_NOT, 3, instantiator, contype,
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
3272 make_int (XIMAGE_SPECIFIER_ALLOWED (specifier)));
84
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 82
diff changeset
3273
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3274 if (!NILP (newinst))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3275 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3276 Lisp_Object newtag;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3277 if (NILP (memq_no_quit (contype, tag_set)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3278 newtag = Fcons (contype, tag_set);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3279 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3280 newtag = tag_set;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3281 retlist = Fcons (Fcons (newtag, newinst), retlist);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3282 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3283 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3285 UNGCPRO;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3287 return retlist;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3288 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3289
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3290 /* Copy an image instantiator. We can't use Fcopy_tree since widgets
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3291 may contain circular references which would send Fcopy_tree into
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3292 infloop death. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3293 static Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3294 image_copy_vector_instantiator (Lisp_Object instantiator)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3295 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3296 int i;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3297 struct image_instantiator_methods *meths;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3298 Lisp_Object *elt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3299 int instantiator_len;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3300
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3301 CHECK_VECTOR (instantiator);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3302
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3303 instantiator = Fcopy_sequence (instantiator);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3304 elt = XVECTOR_DATA (instantiator);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3305 instantiator_len = XVECTOR_LENGTH (instantiator);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3306
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3307 meths = decode_image_instantiator_format (elt[0], ERROR_ME);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3308
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3309 for (i = 1; i < instantiator_len; i += 2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3310 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3311 int j;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3312 Lisp_Object keyword = elt[i];
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3313 Lisp_Object value = elt[i+1];
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3314
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3315 /* Find the keyword entry. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3316 for (j = 0; j < Dynarr_length (meths->keywords); j++)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3317 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3318 if (EQ (keyword, Dynarr_at (meths->keywords, j).keyword))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3319 break;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3320 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3321
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3322 /* Only copy keyword values that should be copied. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3323 if (Dynarr_at (meths->keywords, j).copy_p
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3324 &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3325 (CONSP (value) || VECTORP (value)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3326 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3327 elt [i+1] = Fcopy_tree (value, Qt);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3328 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3329 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3330
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3331 return instantiator;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3332 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3333
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3334 static Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3335 image_copy_instantiator (Lisp_Object arg)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3336 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3337 if (CONSP (arg))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3338 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3339 Lisp_Object rest;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3340 rest = arg = Fcopy_sequence (arg);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3341 while (CONSP (rest))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3342 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3343 Lisp_Object elt = XCAR (rest);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3344 if (CONSP (elt))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3345 XCAR (rest) = Fcopy_tree (elt, Qt);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3346 else if (VECTORP (elt))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3347 XCAR (rest) = image_copy_vector_instantiator (elt);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3348 if (VECTORP (XCDR (rest))) /* hack for (a b . [c d]) */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3349 XCDR (rest) = Fcopy_tree (XCDR (rest), Qt);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3350 rest = XCDR (rest);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3351 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3352 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3353 else if (VECTORP (arg))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3354 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3355 arg = image_copy_vector_instantiator (arg);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3356 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3357 return arg;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3358 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3359
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3360 DEFUN ("image-specifier-p", Fimage_specifier_p, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3361 Return non-nil if OBJECT is an image specifier.
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3362 See `make-image-specifier' for a description of image instantiators.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3363 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3364 (object))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3365 {
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3366 return IMAGE_SPECIFIERP (object) ? Qt : Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3367 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3370 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3371 * Glyph Object *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3372 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3374 static Lisp_Object
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3375 mark_glyph (Lisp_Object obj)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3376 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3377 Lisp_Glyph *glyph = XGLYPH (obj);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3378
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3379 mark_object (glyph->image);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3380 mark_object (glyph->contrib_p);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3381 mark_object (glyph->baseline);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3382 mark_object (glyph->face);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3383
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3384 return glyph->plist;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3385 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3387 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3388 print_glyph (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3389 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3390 Lisp_Glyph *glyph = XGLYPH (obj);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3391 char buf[20];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3393 if (print_readably)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3394 error ("printing unreadable object #<glyph 0x%x>", glyph->header.uid);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3396 write_c_string ("#<glyph (", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3397 print_internal (Fglyph_type (obj), printcharfun, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3398 write_c_string (") ", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3399 print_internal (glyph->image, printcharfun, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3400 sprintf (buf, "0x%x>", glyph->header.uid);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3401 write_c_string (buf, printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3402 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3404 /* Glyphs are equal if all of their display attributes are equal. We
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3405 don't compare names or doc-strings, because that would make equal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3406 be eq.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3408 This isn't concerned with "unspecified" attributes, that's what
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3409 #'glyph-differs-from-default-p is for. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3410 static int
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
3411 glyph_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3412 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3413 Lisp_Glyph *g1 = XGLYPH (obj1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3414 Lisp_Glyph *g2 = XGLYPH (obj2);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3416 depth++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3417
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3418 return (internal_equal (g1->image, g2->image, depth) &&
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3419 internal_equal (g1->contrib_p, g2->contrib_p, depth) &&
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3420 internal_equal (g1->baseline, g2->baseline, depth) &&
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3421 internal_equal (g1->face, g2->face, depth) &&
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3422 !plists_differ (g1->plist, g2->plist, 0, 0, depth + 1));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3423 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3424
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3425 static unsigned long
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3426 glyph_hash (Lisp_Object obj, int depth)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3427 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3428 depth++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3430 /* No need to hash all of the elements; that would take too long.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3431 Just hash the most common ones. */
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3432 return HASH2 (internal_hash (XGLYPH (obj)->image, depth),
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3433 internal_hash (XGLYPH (obj)->face, depth));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3434 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3436 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3437 glyph_getprop (Lisp_Object obj, Lisp_Object prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3438 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3439 Lisp_Glyph *g = XGLYPH (obj);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3440
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3441 if (EQ (prop, Qimage)) return g->image;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3442 if (EQ (prop, Qcontrib_p)) return g->contrib_p;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3443 if (EQ (prop, Qbaseline)) return g->baseline;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3444 if (EQ (prop, Qface)) return g->face;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3446 return external_plist_get (&g->plist, prop, 0, ERROR_ME);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3447 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3448
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3449 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3450 glyph_putprop (Lisp_Object obj, Lisp_Object prop, Lisp_Object value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3451 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3452 if (EQ (prop, Qimage) ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3453 EQ (prop, Qcontrib_p) ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3454 EQ (prop, Qbaseline))
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3455 return 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3456
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3457 if (EQ (prop, Qface))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3458 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3459 XGLYPH (obj)->face = Fget_face (value);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3460 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3461 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3462
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3463 external_plist_put (&XGLYPH (obj)->plist, prop, value, 0, ERROR_ME);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3464 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3465 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3467 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3468 glyph_remprop (Lisp_Object obj, Lisp_Object prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3469 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3470 if (EQ (prop, Qimage) ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3471 EQ (prop, Qcontrib_p) ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3472 EQ (prop, Qbaseline))
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3473 return -1;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3475 if (EQ (prop, Qface))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3476 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3477 XGLYPH (obj)->face = Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3478 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3479 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3480
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3481 return external_remprop (&XGLYPH (obj)->plist, prop, 0, ERROR_ME);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3482 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3484 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3485 glyph_plist (Lisp_Object obj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3486 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3487 Lisp_Glyph *glyph = XGLYPH (obj);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3488 Lisp_Object result = glyph->plist;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3489
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3490 result = cons3 (Qface, glyph->face, result);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3491 result = cons3 (Qbaseline, glyph->baseline, result);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3492 result = cons3 (Qcontrib_p, glyph->contrib_p, result);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3493 result = cons3 (Qimage, glyph->image, result);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3494
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3495 return result;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3496 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3497
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3498 static const struct lrecord_description glyph_description[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3499 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, image) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3500 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, contrib_p) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3501 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, baseline) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3502 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, face) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3503 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, plist) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3504 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3505 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3506
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3507 DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS ("glyph", glyph,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3508 mark_glyph, print_glyph, 0,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3509 glyph_equal, glyph_hash, glyph_description,
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3510 glyph_getprop, glyph_putprop,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3511 glyph_remprop, glyph_plist,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3512 Lisp_Glyph);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3513
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3514 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3515 allocate_glyph (enum glyph_type type,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3516 void (*after_change) (Lisp_Object glyph, Lisp_Object property,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3517 Lisp_Object locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3518 {
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3519 /* This function can GC */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3520 Lisp_Object obj = Qnil;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3521 Lisp_Glyph *g = alloc_lcrecord_type (Lisp_Glyph, &lrecord_glyph);
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3522
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3523 g->type = type;
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3524 g->image = Fmake_specifier (Qimage); /* This function can GC */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3525 g->dirty = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3526 switch (g->type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3527 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3528 case GLYPH_BUFFER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3529 XIMAGE_SPECIFIER_ALLOWED (g->image) =
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3530 IMAGE_NOTHING_MASK | IMAGE_TEXT_MASK
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3531 | IMAGE_MONO_PIXMAP_MASK | IMAGE_COLOR_PIXMAP_MASK
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3532 | IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3533 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3534 case GLYPH_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3535 XIMAGE_SPECIFIER_ALLOWED (g->image) =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3536 IMAGE_NOTHING_MASK | IMAGE_POINTER_MASK;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3537 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3538 case GLYPH_ICON:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3539 XIMAGE_SPECIFIER_ALLOWED (g->image) =
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3540 IMAGE_NOTHING_MASK | IMAGE_MONO_PIXMAP_MASK
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3541 | IMAGE_COLOR_PIXMAP_MASK;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3542 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3543 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3544 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3545 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3546
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3547 /* I think Fmake_specifier can GC. I think set_specifier_fallback can GC. */
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3548 /* We're getting enough reports of odd behavior in this area it seems */
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3549 /* best to GCPRO everything. */
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3550 {
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3551 Lisp_Object tem1 = list1 (Fcons (Qnil, Vthe_nothing_vector));
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3552 Lisp_Object tem2 = list1 (Fcons (Qnil, Qt));
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3553 Lisp_Object tem3 = list1 (Fcons (Qnil, Qnil));
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3554 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3555
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3556 GCPRO4 (obj, tem1, tem2, tem3);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3557
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3558 set_specifier_fallback (g->image, tem1);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3559 g->contrib_p = Fmake_specifier (Qboolean);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3560 set_specifier_fallback (g->contrib_p, tem2);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3561 /* #### should have a specifier for the following */
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3562 g->baseline = Fmake_specifier (Qgeneric);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3563 set_specifier_fallback (g->baseline, tem3);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3564 g->face = Qnil;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3565 g->plist = Qnil;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3566 g->after_change = after_change;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3567 XSETGLYPH (obj, g);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3568
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3569 set_image_attached_to (g->image, obj, Qimage);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3570 UNGCPRO;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3571 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3573 return obj;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3574 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3576 static enum glyph_type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3577 decode_glyph_type (Lisp_Object type, Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3578 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3579 if (NILP (type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3580 return GLYPH_BUFFER;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3581
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3582 if (ERRB_EQ (errb, ERROR_ME))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3583 CHECK_SYMBOL (type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3584
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3585 if (EQ (type, Qbuffer)) return GLYPH_BUFFER;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3586 if (EQ (type, Qpointer)) return GLYPH_POINTER;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3587 if (EQ (type, Qicon)) return GLYPH_ICON;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3589 maybe_signal_simple_error ("Invalid glyph type", type, Qimage, errb);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3590
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3591 return GLYPH_UNKNOWN;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3592 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3593
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3594 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3595 valid_glyph_type_p (Lisp_Object type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3596 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3597 return !NILP (memq_no_quit (type, Vglyph_type_list));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3598 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3599
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3600 DEFUN ("valid-glyph-type-p", Fvalid_glyph_type_p, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3601 Given a GLYPH-TYPE, return non-nil if it is valid.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3602 Valid types are `buffer', `pointer', and `icon'.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3603 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3604 (glyph_type))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3605 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3606 return valid_glyph_type_p (glyph_type) ? Qt : Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3607 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3608
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3609 DEFUN ("glyph-type-list", Fglyph_type_list, 0, 0, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3610 Return a list of valid glyph types.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3611 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3612 ())
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3613 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3614 return Fcopy_sequence (Vglyph_type_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3615 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3616
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3617 DEFUN ("make-glyph-internal", Fmake_glyph_internal, 0, 1, 0, /*
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3618 Create and return a new uninitialized glyph or type TYPE.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3619
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3620 TYPE specifies the type of the glyph; this should be one of `buffer',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3621 `pointer', or `icon', and defaults to `buffer'. The type of the glyph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3622 specifies in which contexts the glyph can be used, and controls the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3623 allowable image types into which the glyph's image can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3624 instantiated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3625
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3626 `buffer' glyphs can be used as the begin-glyph or end-glyph of an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3627 extent, in the modeline, and in the toolbar. Their image can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3628 instantiated as `nothing', `mono-pixmap', `color-pixmap', `text',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3629 and `subwindow'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3630
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3631 `pointer' glyphs can be used to specify the mouse pointer. Their
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3632 image can be instantiated as `pointer'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3633
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3634 `icon' glyphs can be used to specify the icon used when a frame is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3635 iconified. Their image can be instantiated as `mono-pixmap' and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3636 `color-pixmap'.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3637 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3638 (type))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3639 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3640 enum glyph_type typeval = decode_glyph_type (type, ERROR_ME);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3641 return allocate_glyph (typeval, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3642 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3643
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3644 DEFUN ("glyphp", Fglyphp, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3645 Return non-nil if OBJECT is a glyph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3646
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3647 A glyph is an object used for pixmaps, widgets and the like. It is used
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3648 in begin-glyphs and end-glyphs attached to extents, in marginal and textual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3649 annotations, in overlay arrows (overlay-arrow-* variables), in toolbar
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3650 buttons, and the like. Much more detailed information can be found at
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3651 `make-glyph'. Its image is described using an image specifier --
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3652 see `make-image-specifier'. See also `make-image-instance' for further
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3653 information.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3654 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3655 (object))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3656 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3657 return GLYPHP (object) ? Qt : Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3658 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3659
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3660 DEFUN ("glyph-type", Fglyph_type, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3661 Return the type of the given glyph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3662 The return value will be one of 'buffer, 'pointer, or 'icon.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3663 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3664 (glyph))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3665 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3666 CHECK_GLYPH (glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3667 switch (XGLYPH_TYPE (glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3668 {
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
3669 default: abort ();
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3670 case GLYPH_BUFFER: return Qbuffer;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3671 case GLYPH_POINTER: return Qpointer;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3672 case GLYPH_ICON: return Qicon;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3673 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3674 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3675
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3676 Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3677 glyph_image_instance (Lisp_Object glyph, Lisp_Object domain,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3678 Error_behavior errb, int no_quit)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3679 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3680 Lisp_Object specifier = GLYPH_IMAGE (XGLYPH (glyph));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3681
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3682 /* This can never return Qunbound. All glyphs have 'nothing as
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3683 a fallback. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3684 Lisp_Object image_instance = specifier_instance (specifier, Qunbound,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3685 domain, errb, no_quit, 0,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3686 Qzero);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3687 assert (!UNBOUNDP (image_instance));
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3688 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3689
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3690 return image_instance;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3691 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3692
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3693 static Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3694 glyph_image_instance_maybe (Lisp_Object glyph_or_image, Lisp_Object window)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3695 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3696 Lisp_Object instance = glyph_or_image;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3697
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3698 if (GLYPHP (glyph_or_image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3699 instance = glyph_image_instance (glyph_or_image, window, ERROR_ME_NOT, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3700
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3701 return instance;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3702 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3703
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3704 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3705 glyph_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3706
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3707 Return the width of the given GLYPH on the given WINDOW.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3708 Calculations are done based on recursively querying the geometry of
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3709 the associated image instances.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3710 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3711 unsigned short
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3712 glyph_width (Lisp_Object glyph_or_image, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3713 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3714 Lisp_Object instance = glyph_image_instance_maybe (glyph_or_image,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3715 domain);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3716 if (!IMAGE_INSTANCEP (instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3717 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3718
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3719 if (XIMAGE_INSTANCE_NEEDS_LAYOUT (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3720 image_instance_layout (instance, IMAGE_UNSPECIFIED_GEOMETRY,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3721 IMAGE_UNSPECIFIED_GEOMETRY, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3722
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3723 return XIMAGE_INSTANCE_WIDTH (instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3724 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3725
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3726 DEFUN ("glyph-width", Fglyph_width, 1, 2, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3727 Return the width of GLYPH on WINDOW.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3728 This may not be exact as it does not take into account all of the context
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3729 that redisplay will.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3730 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3731 (glyph, window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3732 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3733 XSETWINDOW (window, decode_window (window));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3734 CHECK_GLYPH (glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3735
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3736 return make_int (glyph_width (glyph, window));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3737 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3738
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3739 unsigned short
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3740 glyph_ascent (Lisp_Object glyph_or_image, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3741 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3742 Lisp_Object instance = glyph_image_instance_maybe (glyph_or_image,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3743 domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3744 if (!IMAGE_INSTANCEP (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3745 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3746
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3747 if (XIMAGE_INSTANCE_NEEDS_LAYOUT (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3748 image_instance_layout (instance, IMAGE_UNSPECIFIED_GEOMETRY,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3749 IMAGE_UNSPECIFIED_GEOMETRY, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3750
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3751 if (XIMAGE_INSTANCE_TYPE (instance) == IMAGE_TEXT)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3752 return XIMAGE_INSTANCE_TEXT_ASCENT (instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3753 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3754 return XIMAGE_INSTANCE_HEIGHT (instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3755 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3757 unsigned short
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3758 glyph_descent (Lisp_Object glyph_or_image, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3759 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3760 Lisp_Object instance = glyph_image_instance_maybe (glyph_or_image,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3761 domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3762 if (!IMAGE_INSTANCEP (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3763 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3764
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3765 if (XIMAGE_INSTANCE_NEEDS_LAYOUT (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3766 image_instance_layout (instance, IMAGE_UNSPECIFIED_GEOMETRY,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3767 IMAGE_UNSPECIFIED_GEOMETRY, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3768
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3769 if (XIMAGE_INSTANCE_TYPE (instance) == IMAGE_TEXT)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3770 return XIMAGE_INSTANCE_TEXT_DESCENT (instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3771 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3772 return 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3773 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3774
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3775 /* strictly a convenience function. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3776 unsigned short
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3777 glyph_height (Lisp_Object glyph_or_image, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3778 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3779 Lisp_Object instance = glyph_image_instance_maybe (glyph_or_image,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3780 domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3781
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3782 if (!IMAGE_INSTANCEP (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3783 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3784
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3785 if (XIMAGE_INSTANCE_NEEDS_LAYOUT (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3786 image_instance_layout (instance, IMAGE_UNSPECIFIED_GEOMETRY,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3787 IMAGE_UNSPECIFIED_GEOMETRY, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3788
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3789 return XIMAGE_INSTANCE_HEIGHT (instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3790 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3791
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3792 DEFUN ("glyph-ascent", Fglyph_ascent, 1, 2, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3793 Return the ascent value of GLYPH on WINDOW.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3794 This may not be exact as it does not take into account all of the context
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3795 that redisplay will.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3796 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3797 (glyph, window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3798 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3799 XSETWINDOW (window, decode_window (window));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3800 CHECK_GLYPH (glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3801
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3802 return make_int (glyph_ascent (glyph, window));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3803 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3804
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3805 DEFUN ("glyph-descent", Fglyph_descent, 1, 2, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3806 Return the descent value of GLYPH on WINDOW.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3807 This may not be exact as it does not take into account all of the context
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3808 that redisplay will.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3809 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3810 (glyph, window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3811 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3812 XSETWINDOW (window, decode_window (window));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3813 CHECK_GLYPH (glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3814
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3815 return make_int (glyph_descent (glyph, window));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3816 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3817
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3818 /* This is redundant but I bet a lot of people expect it to exist. */
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3819 DEFUN ("glyph-height", Fglyph_height, 1, 2, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3820 Return the height of GLYPH on WINDOW.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3821 This may not be exact as it does not take into account all of the context
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3822 that redisplay will.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3823 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3824 (glyph, window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3825 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3826 XSETWINDOW (window, decode_window (window));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3827 CHECK_GLYPH (glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3828
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3829 return make_int (glyph_height (glyph, window));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3830 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3831
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3832 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3833 set_glyph_dirty_p (Lisp_Object glyph_or_image, Lisp_Object window, int dirty)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3834 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3835 Lisp_Object instance = glyph_or_image;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3836
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3837 if (!NILP (glyph_or_image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3838 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3839 if (GLYPHP (glyph_or_image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3840 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3841 instance = glyph_image_instance (glyph_or_image, window,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3842 ERROR_ME_NOT, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3843 XGLYPH_DIRTYP (glyph_or_image) = dirty;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3844 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3845
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3846 if (!IMAGE_INSTANCEP (instance))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3847 return;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3848
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3849 XIMAGE_INSTANCE_DIRTYP (instance) = dirty;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3850 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3851 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3852
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3853 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3854 set_image_instance_dirty_p (Lisp_Object instance, int dirty)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3855 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3856 if (IMAGE_INSTANCEP (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3857 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3858 XIMAGE_INSTANCE_DIRTYP (instance) = dirty;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3859 /* Now cascade up the hierarchy. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3860 set_image_instance_dirty_p (XIMAGE_INSTANCE_PARENT (instance),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3861 dirty);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3862 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3863 else if (GLYPHP (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3864 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3865 XGLYPH_DIRTYP (instance) = dirty;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3866 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3867 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3868
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3869 /* #### do we need to cache this info to speed things up? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3870
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3871 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3872 glyph_baseline (Lisp_Object glyph, Lisp_Object domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3873 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3874 if (!GLYPHP (glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3875 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3876 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3877 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3878 Lisp_Object retval =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3879 specifier_instance_no_quit (GLYPH_BASELINE (XGLYPH (glyph)),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3880 /* #### look into ERROR_ME_NOT */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3881 Qunbound, domain, ERROR_ME_NOT,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3882 0, Qzero);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3883 if (!NILP (retval) && !INTP (retval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3884 retval = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3885 else if (INTP (retval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3886 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3887 if (XINT (retval) < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3888 retval = Qzero;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3889 if (XINT (retval) > 100)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3890 retval = make_int (100);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3891 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3892 return retval;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3893 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3894 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3895
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3896 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3897 glyph_face (Lisp_Object glyph, Lisp_Object domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3898 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3899 /* #### Domain parameter not currently used but it will be */
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3900 return GLYPHP (glyph) ? GLYPH_FACE (XGLYPH (glyph)) : Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3901 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3902
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3903 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3904 glyph_contrib_p (Lisp_Object glyph, Lisp_Object domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3905 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3906 if (!GLYPHP (glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3907 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3908 else
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3909 return !NILP (specifier_instance_no_quit
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3910 (GLYPH_CONTRIB_P (XGLYPH (glyph)), Qunbound, domain,
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3911 /* #### look into ERROR_ME_NOT */
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3912 ERROR_ME_NOT, 0, Qzero));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3913 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3914
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3915 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3916 glyph_property_was_changed (Lisp_Object glyph, Lisp_Object property,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3917 Lisp_Object locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3918 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3919 if (XGLYPH (glyph)->after_change)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3920 (XGLYPH (glyph)->after_change) (glyph, property, locale);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3921 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3922
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3923 #if 0 /* Not used for now */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3924 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3925 glyph_query_geometry (Lisp_Object glyph_or_image, Lisp_Object window,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3926 unsigned int* width, unsigned int* height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3927 enum image_instance_geometry disp, Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3928 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3929 Lisp_Object instance = glyph_or_image;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3930
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3931 if (GLYPHP (glyph_or_image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3932 instance = glyph_image_instance (glyph_or_image, window, ERROR_ME_NOT, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3933
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3934 image_instance_query_geometry (instance, width, height, disp, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3935 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3936
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3937 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3938 glyph_layout (Lisp_Object glyph_or_image, Lisp_Object window,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3939 unsigned int width, unsigned int height, Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3940 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3941 Lisp_Object instance = glyph_or_image;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3942
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3943 if (GLYPHP (glyph_or_image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3944 instance = glyph_image_instance (glyph_or_image, window, ERROR_ME_NOT, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3945
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3946 image_instance_layout (instance, width, height, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3947 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3948 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3949
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3950
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3951 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3952 * glyph cachel functions *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3953 *****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3954
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3955 /* #### All of this is 95% copied from face cachels. Consider
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
3956 consolidating.
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
3957
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3958 Why do we need glyph_cachels? Simply because a glyph_cachel captures
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3959 per-window information about a particular glyph. A glyph itself is
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3960 not created in any particular context, so if we were to rely on a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3961 glyph to tell us about its dirtiness we would not be able to reset
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3962 the dirty flag after redisplaying it as it may exist in other
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3963 contexts. When we have redisplayed we need to know which glyphs to
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3964 reset the dirty flags on - the glyph_cachels give us a nice list we
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3965 can iterate through doing this. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3966 void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3967 mark_glyph_cachels (glyph_cachel_dynarr *elements)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3968 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3969 int elt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3970
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3971 if (!elements)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3972 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3974 for (elt = 0; elt < Dynarr_length (elements); elt++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3975 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3976 struct glyph_cachel *cachel = Dynarr_atp (elements, elt);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3977 mark_object (cachel->glyph);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3978 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3979 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3980
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3981 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3982 update_glyph_cachel_data (struct window *w, Lisp_Object glyph,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3983 struct glyph_cachel *cachel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3984 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3985 if (!cachel->updated || NILP (cachel->glyph) || !EQ (cachel->glyph, glyph)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3986 || XGLYPH_DIRTYP (cachel->glyph)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3987 || XFRAME(WINDOW_FRAME(w))->faces_changed)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3988 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3989 Lisp_Object window, instance;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3990
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3991 XSETWINDOW (window, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3992
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3993 cachel->glyph = glyph;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3994 /* Speed things up slightly by grabbing the glyph instantiation
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3995 and passing it to the size functions. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3996 instance = glyph_image_instance (glyph, window, ERROR_ME_NOT, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3997
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3998 if (!IMAGE_INSTANCEP (instance))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3999 return;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4000
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4001 /* Mark text instance of the glyph dirty if faces have changed,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4002 because its geometry might have changed. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4003 invalidate_glyph_geometry_maybe (instance, w);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4004
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4005 /* #### Do the following 2 lines buy us anything? --kkm */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4006 XGLYPH_DIRTYP (glyph) = XIMAGE_INSTANCE_DIRTYP (instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4007 cachel->dirty = XGLYPH_DIRTYP (glyph);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4008 cachel->width = glyph_width (instance, window);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4009 cachel->ascent = glyph_ascent (instance, window);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4010 cachel->descent = glyph_descent (instance, window);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4011 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4012
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4013 cachel->updated = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4014 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4015
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4016 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4017 add_glyph_cachel (struct window *w, Lisp_Object glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4018 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4019 struct glyph_cachel new_cachel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4020
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
4021 xzero (new_cachel);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4022 new_cachel.glyph = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4023
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4024 update_glyph_cachel_data (w, glyph, &new_cachel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4025 Dynarr_add (w->glyph_cachels, new_cachel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4026 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4027
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4028 glyph_index
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4029 get_glyph_cachel_index (struct window *w, Lisp_Object glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4030 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4031 int elt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4032
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4033 if (noninteractive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4034 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4035
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4036 for (elt = 0; elt < Dynarr_length (w->glyph_cachels); elt++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4037 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4038 struct glyph_cachel *cachel =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4039 Dynarr_atp (w->glyph_cachels, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4040
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4041 if (EQ (cachel->glyph, glyph) && !NILP (glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4042 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4043 update_glyph_cachel_data (w, glyph, cachel);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4044 return elt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4045 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4046 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4047
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4048 /* If we didn't find the glyph, add it and then return its index. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4049 add_glyph_cachel (w, glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4050 return elt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4051 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4052
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4053 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4054 reset_glyph_cachels (struct window *w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4055 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4056 Dynarr_reset (w->glyph_cachels);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4057 get_glyph_cachel_index (w, Vcontinuation_glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4058 get_glyph_cachel_index (w, Vtruncation_glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4059 get_glyph_cachel_index (w, Vhscroll_glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4060 get_glyph_cachel_index (w, Vcontrol_arrow_glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4061 get_glyph_cachel_index (w, Voctal_escape_glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4062 get_glyph_cachel_index (w, Vinvisible_text_glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4063 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4064
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4065 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4066 mark_glyph_cachels_as_not_updated (struct window *w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4067 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4068 int elt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4069
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4070 /* We need to have a dirty flag to tell if the glyph has changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4071 We can check to see if each glyph variable is actually a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4072 completely different glyph, though. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4073 #define FROB(glyph_obj, gindex) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4074 update_glyph_cachel_data (w, glyph_obj, \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4075 Dynarr_atp (w->glyph_cachels, gindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4076
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4077 FROB (Vcontinuation_glyph, CONT_GLYPH_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4078 FROB (Vtruncation_glyph, TRUN_GLYPH_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4079 FROB (Vhscroll_glyph, HSCROLL_GLYPH_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4080 FROB (Vcontrol_arrow_glyph, CONTROL_GLYPH_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4081 FROB (Voctal_escape_glyph, OCT_ESC_GLYPH_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4082 FROB (Vinvisible_text_glyph, INVIS_GLYPH_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4083 #undef FROB
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4084
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4085 for (elt = 0; elt < Dynarr_length (w->glyph_cachels); elt++)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4086 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4087 Dynarr_atp (w->glyph_cachels, elt)->updated = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4088 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4089 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4090
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4091 /* Unset the dirty bit on all the glyph cachels that have it. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4092 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4093 mark_glyph_cachels_as_clean (struct window* w)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4094 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4095 int elt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4096 Lisp_Object window;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4097 XSETWINDOW (window, w);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4098 for (elt = 0; elt < Dynarr_length (w->glyph_cachels); elt++)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4099 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4100 struct glyph_cachel *cachel = Dynarr_atp (w->glyph_cachels, elt);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4101 cachel->dirty = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4102 set_glyph_dirty_p (cachel->glyph, window, 0);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4103 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4104 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4106 #ifdef MEMORY_USAGE_STATS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4108 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4109 compute_glyph_cachel_usage (glyph_cachel_dynarr *glyph_cachels,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4110 struct overhead_stats *ovstats)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4111 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4112 int total = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4114 if (glyph_cachels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4115 total += Dynarr_memory_usage (glyph_cachels, ovstats);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4117 return total;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4118 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4120 #endif /* MEMORY_USAGE_STATS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4121
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4122
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4123
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4124 /*****************************************************************************
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4125 * subwindow cachel functions *
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4126 *****************************************************************************/
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4127 /* Subwindows are curious in that you have to physically unmap them to
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4128 not display them. It is problematic deciding what to do in
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4129 redisplay. We have two caches - a per-window instance cache that
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4130 keeps track of subwindows on a window, these are linked to their
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4131 instantiator in the hashtable and when the instantiator goes away
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4132 we want the instance to go away also. However we also have a
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4133 per-frame instance cache that we use to determine if a subwindow is
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4134 obscuring an area that we want to clear. We need to be able to flip
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4135 through this quickly so a hashtable is not suitable hence the
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4136 subwindow_cachels. This is a weak list so unreference instances
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4137 will get deleted properly. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4138
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4139 /* redisplay in general assumes that drawing something will erase
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4140 what was there before. unfortunately this does not apply to
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4141 subwindows that need to be specifically unmapped in order to
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4142 disappear. we take a brute force approach - on the basis that its
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4143 cheap - and unmap all subwindows in a display line */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4144
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4145 /* Put new instances in the frame subwindow cache. This is less costly than
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4146 doing it every time something gets mapped, and deleted instances will be
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4147 removed automatically. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4148 static void
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4149 cache_subwindow_instance_in_frame_maybe (Lisp_Object instance)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4150 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4151 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (instance);
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
4152 if (!NILP (DOMAIN_FRAME (IMAGE_INSTANCE_DOMAIN (ii))))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4153 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4154 struct frame* f = DOMAIN_XFRAME (IMAGE_INSTANCE_DOMAIN (ii));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4155 XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4156 = Fcons (instance, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)));
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4157 }
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4158 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4159
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4160 /* Unmap and finalize all subwindow instances in the frame cache. This
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4161 is necessary because GC will not guarantee the order things get
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4162 deleted in and moreover, frame finalization deletes the window
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4163 system windows before deleting XEmacs windows, and hence
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4164 subwindows. */
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4165 void
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4166 free_frame_subwindow_instance_cache (struct frame* f)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4167 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4168 Lisp_Object rest;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4169
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4170 LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4171 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4172 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (XCAR (rest));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4173 /* Make sure that the subwindow is unmapped so that window
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4174 deletion will not try and do it again. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4175 unmap_subwindow (XCAR (rest));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4176 finalize_image_instance (ii, 0);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4177 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4178 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4179
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4180 /* Unmap and remove all instances from the frame cache. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4181 void
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4182 reset_frame_subwindow_instance_cache (struct frame* f)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4183 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4184 Lisp_Object rest;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4185
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4186 LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4187 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4188 Lisp_Object value = XCAR (rest);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4189 /* Make sure that the subwindow is unmapped so that window
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4190 deletion will not try and do it again. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4191 unmap_subwindow (value);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4192 XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4193 = delq_no_quit (value, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4194 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4195 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4196
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4197 /*****************************************************************************
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4198 * subwindow exposure ignorance *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4199 *****************************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4200 /* when we unmap subwindows the associated window system will generate
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4201 expose events. This we do not want as redisplay already copes with
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4202 the repainting necessary. Worse, we can get in an endless cycle of
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4203 redisplay if we are not careful. Thus we keep a per-frame list of
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4204 expose events that are going to come and ignore them as
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4205 required. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4206
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4207 struct expose_ignore_blocktype
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4208 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4209 Blocktype_declare (struct expose_ignore);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4210 } *the_expose_ignore_blocktype;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4211
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4212 int
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4213 check_for_ignored_expose (struct frame* f, int x, int y, int width, int height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4214 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4215 struct expose_ignore *ei, *prev;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4216 /* the ignore list is FIFO so we should generally get a match with
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4217 the first element in the list */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4218 for (ei = f->subwindow_exposures, prev = 0; ei; ei = ei->next)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4219 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4220 /* Checking for exact matches just isn't good enough as we
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4221 mighte get exposures for partially obscure subwindows, thus
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4222 we have to check for overlaps. Being conservative we will
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4223 check for exposures wholly contained by the subwindow, this
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4224 might give us what we want.*/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4225 if (ei->x <= x && ei->y <= y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4226 && ei->x + ei->width >= x + width
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4227 && ei->y + ei->height >= y + height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4228 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4229 #ifdef DEBUG_WIDGETS
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4230 stderr_out ("ignored %d+%d, %dx%d for exposure %d+%d, %dx%d\n",
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4231 x, y, width, height, ei->x, ei->y, ei->width, ei->height);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4232 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4233 if (!prev)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4234 f->subwindow_exposures = ei->next;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4235 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4236 prev->next = ei->next;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4237
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4238 if (ei == f->subwindow_exposures_tail)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4239 f->subwindow_exposures_tail = prev;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4240
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4241 Blocktype_free (the_expose_ignore_blocktype, ei);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4242 return 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4243 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4244 prev = ei;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4245 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4246 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4247 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4248
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4249 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4250 register_ignored_expose (struct frame* f, int x, int y, int width, int height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4251 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4252 if (!hold_ignored_expose_registration)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4253 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4254 struct expose_ignore *ei;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4255
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4256 ei = Blocktype_alloc (the_expose_ignore_blocktype);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4257
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4258 ei->next = NULL;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4259 ei->x = x;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4260 ei->y = y;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4261 ei->width = width;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4262 ei->height = height;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4263
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4264 /* we have to add the exposure to the end of the list, since we
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4265 want to check the oldest events first. for speed we keep a record
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4266 of the end so that we can add right to it. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4267 if (f->subwindow_exposures_tail)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4268 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4269 f->subwindow_exposures_tail->next = ei;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4270 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4271 if (!f->subwindow_exposures)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4272 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4273 f->subwindow_exposures = ei;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4274 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4275 f->subwindow_exposures_tail = ei;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4276 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4277 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4278
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4279 /****************************************************************************
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4280 find_matching_subwindow
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4281
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4282 See if there is a subwindow that completely encloses the requested
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4283 area.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4284 ****************************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4285 int find_matching_subwindow (struct frame* f, int x, int y, int width, int height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4286 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4287 Lisp_Object rest;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4288
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4289 LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4290 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4291 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (XCAR (rest));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4292
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4293 if (IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4294 &&
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4295 IMAGE_INSTANCE_DISPLAY_X (ii) <= x
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4296 &&
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4297 IMAGE_INSTANCE_DISPLAY_Y (ii) <= y
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4298 &&
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4299 IMAGE_INSTANCE_DISPLAY_X (ii)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4300 + IMAGE_INSTANCE_DISPLAY_WIDTH (ii) >= x + width
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4301 &&
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4302 IMAGE_INSTANCE_DISPLAY_Y (ii)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4303 + IMAGE_INSTANCE_DISPLAY_HEIGHT (ii) >= y + height)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4304 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4305 return 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4306 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4307 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4308 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4309 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4310
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4311
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4312 /*****************************************************************************
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4313 * subwindow functions *
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4314 *****************************************************************************/
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4315
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4316 /* Update the displayed characteristics of a subwindow. This function
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4317 should generally only get called if the subwindow is actually
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4318 dirty. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4319 void
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4320 update_subwindow (Lisp_Object subwindow)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4321 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4322 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow);
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4323 int count = specpdl_depth ();
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4324
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4325 /* The update method is allowed to call eval. Since it is quite
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4326 common for this function to get called from somewhere in
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4327 redisplay we need to make sure that quits are ignored. Otherwise
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4328 Fsignal will abort. */
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4329 specbind (Qinhibit_quit, Qt);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4330
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4331 ERROR_CHECK_IMAGE_INSTANCE (subwindow);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4332
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4333 if (WIDGET_IMAGE_INSTANCEP (subwindow))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4334 {
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4335 if (image_instance_changed (subwindow))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4336 update_widget (subwindow);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4337 /* Reset the changed flags. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4338 IMAGE_INSTANCE_WIDGET_FACE_CHANGED (ii) = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4339 IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii) = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4340 IMAGE_INSTANCE_TEXT_CHANGED (ii) = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4341 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4342 else if (IMAGE_INSTANCE_TYPE (ii) == IMAGE_SUBWINDOW
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4343 &&
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4344 !NILP (IMAGE_INSTANCE_FRAME (ii)))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4345 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4346 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4347 update_subwindow, (ii));
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4348 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4349
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4350 IMAGE_INSTANCE_SIZE_CHANGED (ii) = 0;
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4351 /* This function is typically called by redisplay just before
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4352 outputting the information to the screen. Thus we record a hash
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4353 of the output to determine whether on-screen is the same as
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4354 recorded structure. This approach has limitations in there is a
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4355 good chance that hash values will be different for the same
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4356 visual appearance. However, we would rather that then the other
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4357 way round - it simply means that we will get more displays than
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4358 we might need. We can get better hashing by making the depth
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4359 negative - currently it will recurse down 7 levels.*/
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4360 IMAGE_INSTANCE_DISPLAY_HASH (ii) = internal_hash (subwindow,
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4361 IMAGE_INSTANCE_HASH_DEPTH);
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4362
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4363 unbind_to (count, Qnil);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4364 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4365
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4366 int
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4367 image_instance_changed (Lisp_Object subwindow)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4368 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4369 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4370
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4371 if (internal_hash (subwindow, IMAGE_INSTANCE_HASH_DEPTH) !=
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4372 IMAGE_INSTANCE_DISPLAY_HASH (ii))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4373 return 1;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4374 /* #### I think there is probably a bug here. This gets called for
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4375 layouts - and yet the pending items are always nil for
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4376 layouts. We are saved by layout optimization, but I'm undecided
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4377 as to what the correct fix is. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4378 else if (WIDGET_IMAGE_INSTANCEP (subwindow)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4379 && (!internal_equal (IMAGE_INSTANCE_WIDGET_ITEMS (ii),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4380 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii), 0)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4381 || !NILP (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii))))
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4382 return 1;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4383 else
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4384 return 0;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4385 }
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4386
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4387 /* Update all the subwindows on a frame. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4388 void
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4389 update_widget_instances (Lisp_Object frame)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4390 {
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4391 struct frame* f;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4392 Lisp_Object rest;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4393
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4394 /* Its possible for the preceeding callback to have deleted the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4395 frame, so cope with this. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4396 if (!FRAMEP (frame) || !FRAME_LIVE_P (XFRAME (frame)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4397 return;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4398
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4399 CHECK_FRAME (frame);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4400 f = XFRAME (frame);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4401
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4402 /* If we get called we know something has changed. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4403 LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4404 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4405 Lisp_Object widget = XCAR (rest);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4406
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4407 if (XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (widget)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4408 &&
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4409 image_instance_changed (widget))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4410 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4411 set_image_instance_dirty_p (widget, 1);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4412 MARK_FRAME_GLYPHS_CHANGED (f);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4413 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4414 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4415 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4416
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4417 /* remove a subwindow from its frame */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4418 void unmap_subwindow (Lisp_Object subwindow)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4419 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4420 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4421 struct frame* f;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4422
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4423 ERROR_CHECK_IMAGE_INSTANCE (subwindow);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4424
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4425 if (!image_instance_type_to_mask (IMAGE_INSTANCE_TYPE (ii))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4426 & (IMAGE_WIDGET_MASK | IMAGE_SUBWINDOW_MASK)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4427 ||
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4428 !IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4429 return;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4430
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4431 #ifdef DEBUG_WIDGETS
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4432 stderr_out ("unmapping subwindow %d\n", IMAGE_INSTANCE_SUBWINDOW_ID (ii));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4433 #endif
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4434 f = XFRAME (IMAGE_INSTANCE_FRAME (ii));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4435
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4436 /* make sure we don't get expose events */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4437 register_ignored_expose (f, IMAGE_INSTANCE_DISPLAY_X (ii),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4438 IMAGE_INSTANCE_DISPLAY_Y (ii),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4439 IMAGE_INSTANCE_DISPLAY_WIDTH (ii),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4440 IMAGE_INSTANCE_DISPLAY_HEIGHT (ii));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4441 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4442
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4443 MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (ii)),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4444 unmap_subwindow, (ii));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4445 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4446
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4447 /* show a subwindow in its frame */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4448 void map_subwindow (Lisp_Object subwindow, int x, int y,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4449 struct display_glyph_area *dga)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4450 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4451 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4452 struct frame* f;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4453
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4454 ERROR_CHECK_IMAGE_INSTANCE (subwindow);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4455
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4456 if (!image_instance_type_to_mask (IMAGE_INSTANCE_TYPE (ii))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4457 & (IMAGE_WIDGET_MASK | IMAGE_SUBWINDOW_MASK))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4458 return;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4459
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4460 #ifdef DEBUG_WIDGETS
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4461 stderr_out ("mapping subwindow %d, %dx%d@%d+%d\n",
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4462 IMAGE_INSTANCE_SUBWINDOW_ID (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4463 dga->width, dga->height, x, y);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4464 #endif
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4465 f = XFRAME (IMAGE_INSTANCE_FRAME (ii));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4466 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 1;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4467 IMAGE_INSTANCE_DISPLAY_X (ii) = x;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4468 IMAGE_INSTANCE_DISPLAY_Y (ii) = y;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4469 IMAGE_INSTANCE_DISPLAY_WIDTH (ii) = dga->width;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4470 IMAGE_INSTANCE_DISPLAY_HEIGHT (ii) = dga->height;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4471
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4472 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4473 map_subwindow, (ii, x, y, dga));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4474 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4475
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4476 static int
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4477 subwindow_possible_dest_types (void)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4478 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4479 return IMAGE_SUBWINDOW_MASK;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4480 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4481
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4482 int
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4483 subwindow_governing_domain (void)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4484 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4485 return GOVERNING_DOMAIN_WINDOW;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4486 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4487
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4488 /* Partially instantiate a subwindow. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4489 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4490 subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4491 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4492 int dest_mask, Lisp_Object domain)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4493 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4494 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4495 Lisp_Object device = image_instance_device (image_instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4496 Lisp_Object frame = DOMAIN_FRAME (domain);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4497 Lisp_Object width = find_keyword_in_vector (instantiator, Q_pixel_width);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4498 Lisp_Object height = find_keyword_in_vector (instantiator, Q_pixel_height);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4499
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4500 if (NILP (frame))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4501 signal_simple_error ("No selected frame", device);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4502
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4503 if (!(dest_mask & IMAGE_SUBWINDOW_MASK))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4504 incompatible_image_types (instantiator, dest_mask, IMAGE_SUBWINDOW_MASK);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4505
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4506 ii->data = 0;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4507 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = 0;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4508 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4509
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4510 if (INTP (width))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4511 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4512 int w = 1;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4513 if (XINT (width) > 1)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4514 w = XINT (width);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4515 IMAGE_INSTANCE_WIDTH (ii) = w;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4516 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4517 }
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4518
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4519 if (INTP (height))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4520 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4521 int h = 1;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4522 if (XINT (height) > 1)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4523 h = XINT (height);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4524 IMAGE_INSTANCE_HEIGHT (ii) = h;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4525 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4526 }
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4527 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4528
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4529 /* This is just a backup in case no-one has assigned a suitable geometry.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4530 #### It should really query the enclose window for geometry. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4531 static void
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
4532 subwindow_query_geometry (Lisp_Object image_instance, int* width,
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 408
diff changeset
4533 int* height, enum image_instance_geometry disp,
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4534 Lisp_Object domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4535 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4536 if (width) *width = 20;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4537 if (height) *height = 20;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4538 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4539
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4540 DEFUN ("subwindowp", Fsubwindowp, 1, 1, 0, /*
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4541 Return non-nil if OBJECT is a subwindow.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4542 */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4543 (object))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4544 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4545 CHECK_IMAGE_INSTANCE (object);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4546 return (XIMAGE_INSTANCE_TYPE (object) == IMAGE_SUBWINDOW) ? Qt : Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4547 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4548
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4549 DEFUN ("image-instance-subwindow-id", Fimage_instance_subwindow_id, 1, 1, 0, /*
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4550 Return the window id of SUBWINDOW as a number.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4551 */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4552 (subwindow))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4553 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4554 CHECK_SUBWINDOW_IMAGE_INSTANCE (subwindow);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4555 return make_int ((int) XIMAGE_INSTANCE_SUBWINDOW_ID (subwindow));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4556 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4557
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4558 DEFUN ("resize-subwindow", Fresize_subwindow, 1, 3, 0, /*
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4559 Resize SUBWINDOW to WIDTH x HEIGHT.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4560 If a value is nil that parameter is not changed.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4561 */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4562 (subwindow, width, height))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4563 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4564 int neww, newh;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4565 Lisp_Image_Instance* ii;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4566
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4567 CHECK_SUBWINDOW_IMAGE_INSTANCE (subwindow);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4568 ii = XIMAGE_INSTANCE (subwindow);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4569
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4570 if (NILP (width))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4571 neww = IMAGE_INSTANCE_WIDTH (ii);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4572 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4573 neww = XINT (width);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4574
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4575 if (NILP (height))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4576 newh = IMAGE_INSTANCE_HEIGHT (ii);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4577 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4578 newh = XINT (height);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4579
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4580 /* The actual resizing gets done asychronously by
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4581 update_subwindow. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4582 IMAGE_INSTANCE_HEIGHT (ii) = newh;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4583 IMAGE_INSTANCE_WIDTH (ii) = neww;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4584 IMAGE_INSTANCE_SIZE_CHANGED (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4585
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4586 return subwindow;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4587 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4588
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4589 DEFUN ("force-subwindow-map", Fforce_subwindow_map, 1, 1, 0, /*
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4590 Generate a Map event for SUBWINDOW.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4591 */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4592 (subwindow))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4593 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4594 CHECK_SUBWINDOW_IMAGE_INSTANCE (subwindow);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4595 #if 0
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4596 map_subwindow (subwindow, 0, 0);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4597 #endif
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4598 return subwindow;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4599 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4600
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4601
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4602 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4603 * display tables *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4604 *****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4605
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4606 /* Get the display tables for use currently on window W with face
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4607 FACE. #### This will have to be redone. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4608
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4609 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4610 get_display_tables (struct window *w, face_index findex,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4611 Lisp_Object *face_table, Lisp_Object *window_table)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4612 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
4613 Lisp_Object tem;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4614 tem = WINDOW_FACE_CACHEL_DISPLAY_TABLE (w, findex);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4615 if (UNBOUNDP (tem))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4616 tem = Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4617 if (!LISTP (tem))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4618 tem = noseeum_cons (tem, Qnil);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4619 *face_table = tem;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4620 tem = w->display_table;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4621 if (UNBOUNDP (tem))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4622 tem = Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4623 if (!LISTP (tem))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4624 tem = noseeum_cons (tem, Qnil);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4625 *window_table = tem;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4626 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4627
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4628 Lisp_Object
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4629 display_table_entry (Emchar ch, Lisp_Object face_table,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4630 Lisp_Object window_table)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4631 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4632 Lisp_Object tail;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4633
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4634 /* Loop over FACE_TABLE, and then over WINDOW_TABLE. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4635 for (tail = face_table; 1; tail = XCDR (tail))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4636 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4637 Lisp_Object table;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4638 if (NILP (tail))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4639 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4640 if (!NILP (window_table))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4641 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4642 tail = window_table;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4643 window_table = Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4644 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4645 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4646 return Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4647 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4648 table = XCAR (tail);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4649
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4650 if (VECTORP (table))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4651 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4652 if (ch < XVECTOR_LENGTH (table) && !NILP (XVECTOR_DATA (table)[ch]))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4653 return XVECTOR_DATA (table)[ch];
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4654 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4655 continue;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4656 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4657 else if (CHAR_TABLEP (table)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4658 && XCHAR_TABLE_TYPE (table) == CHAR_TABLE_TYPE_CHAR)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4659 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4660 return get_char_table (ch, XCHAR_TABLE (table));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4661 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4662 else if (CHAR_TABLEP (table)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4663 && XCHAR_TABLE_TYPE (table) == CHAR_TABLE_TYPE_GENERIC)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4664 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4665 Lisp_Object gotit = get_char_table (ch, XCHAR_TABLE (table));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4666 if (!NILP (gotit))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4667 return gotit;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4668 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4669 continue;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4670 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4671 else if (RANGE_TABLEP (table))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4672 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4673 Lisp_Object gotit = Fget_range_table (make_char (ch), table, Qnil);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4674 if (!NILP (gotit))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4675 return gotit;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4676 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4677 continue;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4678 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4679 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4680 abort ();
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4681 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4682 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4683
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4684 /*****************************************************************************
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4685 * timeouts for animated glyphs *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4686 *****************************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4687 static Lisp_Object Qglyph_animated_timeout_handler;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4688
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4689 DEFUN ("glyph-animated-timeout-handler", Fglyph_animated_timeout_handler, 1, 1, 0, /*
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4690 Callback function for updating animated images.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4691 Don't use this.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4692 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4693 (arg))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4694 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4695 CHECK_WEAK_LIST (arg);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4696
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4697 if (!NILP (XWEAK_LIST_LIST (arg)) && !NILP (XCAR (XWEAK_LIST_LIST (arg))))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4698 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4699 Lisp_Object value = XCAR (XWEAK_LIST_LIST (arg));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4700
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4701 if (IMAGE_INSTANCEP (value))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4702 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4703 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (value);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4704
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4705 if (COLOR_PIXMAP_IMAGE_INSTANCEP (value)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4706 &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4707 IMAGE_INSTANCE_PIXMAP_MAXSLICE (ii) > 1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4708 &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4709 !disable_animated_pixmaps)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4710 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4711 /* Increment the index of the image slice we are currently
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4712 viewing. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4713 IMAGE_INSTANCE_PIXMAP_SLICE (ii) =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4714 (IMAGE_INSTANCE_PIXMAP_SLICE (ii) + 1)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4715 % IMAGE_INSTANCE_PIXMAP_MAXSLICE (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4716 /* We might need to kick redisplay at this point - but we
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4717 also might not. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4718 MARK_DEVICE_FRAMES_GLYPHS_CHANGED
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4719 (XDEVICE (image_instance_device (value)));
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4720 /* Cascade dirtiness so that we can have an animated glyph in a layout
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4721 for instance. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4722 set_image_instance_dirty_p (value, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4723 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4724 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4725 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4726 return Qnil;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4727 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4728
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4729 Lisp_Object add_glyph_animated_timeout (EMACS_INT tickms, Lisp_Object image)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4730 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4731 Lisp_Object ret = Qnil;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4732
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4733 if (tickms > 0 && IMAGE_INSTANCEP (image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4734 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4735 double ms = ((double)tickms) / 1000.0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4736 struct gcpro gcpro1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4737 Lisp_Object holder = make_weak_list (WEAK_LIST_SIMPLE);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4738
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4739 GCPRO1 (holder);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4740 XWEAK_LIST_LIST (holder) = Fcons (image, Qnil);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4741
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4742 ret = Fadd_timeout (make_float (ms),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4743 Qglyph_animated_timeout_handler,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4744 holder, make_float (ms));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4745
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4746 UNGCPRO;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4747 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4748 return ret;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4749 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4750
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4751 void disable_glyph_animated_timeout (int i)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4752 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4753 Lisp_Object id;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4754 XSETINT (id, i);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4755
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4756 Fdisable_timeout (id);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4757 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4758
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4759
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4760 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4761 * initialization *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4762 *****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4763
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4764 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4765 syms_of_glyphs (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4766 {
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4767 INIT_LRECORD_IMPLEMENTATION (glyph);
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4768 INIT_LRECORD_IMPLEMENTATION (image_instance);
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4769
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4770 /* image instantiators */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4771
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4772 DEFSUBR (Fimage_instantiator_format_list);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4773 DEFSUBR (Fvalid_image_instantiator_format_p);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4774 DEFSUBR (Fset_console_type_image_conversion_list);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4775 DEFSUBR (Fconsole_type_image_conversion_list);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4777 defkeyword (&Q_file, ":file");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4778 defkeyword (&Q_data, ":data");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4779 defkeyword (&Q_face, ":face");
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4780 defkeyword (&Q_pixel_height, ":pixel-height");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4781 defkeyword (&Q_pixel_width, ":pixel-width");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4782
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
4783 #ifdef HAVE_XPM
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
4784 defkeyword (&Q_color_symbols, ":color-symbols");
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
4785 #endif
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4786 #ifdef HAVE_WINDOW_SYSTEM
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4787 defkeyword (&Q_mask_file, ":mask-file");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4788 defkeyword (&Q_mask_data, ":mask-data");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4789 defkeyword (&Q_hotspot_x, ":hotspot-x");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4790 defkeyword (&Q_hotspot_y, ":hotspot-y");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4791 defkeyword (&Q_foreground, ":foreground");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4792 defkeyword (&Q_background, ":background");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4793 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4794 /* image specifiers */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4795
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4796 DEFSUBR (Fimage_specifier_p);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4797 /* Qimage in general.c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4798
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4799 /* image instances */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4801 defsymbol (&Qimage_instancep, "image-instance-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4802
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4803 defsymbol (&Qnothing_image_instance_p, "nothing-image-instance-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4804 defsymbol (&Qtext_image_instance_p, "text-image-instance-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4805 defsymbol (&Qmono_pixmap_image_instance_p, "mono-pixmap-image-instance-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4806 defsymbol (&Qcolor_pixmap_image_instance_p, "color-pixmap-image-instance-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4807 defsymbol (&Qpointer_image_instance_p, "pointer-image-instance-p");
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4808 defsymbol (&Qwidget_image_instance_p, "widget-image-instance-p");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4809 defsymbol (&Qsubwindow_image_instance_p, "subwindow-image-instance-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4810
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4811 DEFSUBR (Fmake_image_instance);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4812 DEFSUBR (Fimage_instance_p);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4813 DEFSUBR (Fimage_instance_type);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4814 DEFSUBR (Fvalid_image_instance_type_p);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4815 DEFSUBR (Fimage_instance_type_list);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4816 DEFSUBR (Fimage_instance_name);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4817 DEFSUBR (Fimage_instance_domain);
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4818 DEFSUBR (Fimage_instance_string);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4819 DEFSUBR (Fimage_instance_file_name);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4820 DEFSUBR (Fimage_instance_mask_file_name);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4821 DEFSUBR (Fimage_instance_depth);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4822 DEFSUBR (Fimage_instance_height);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4823 DEFSUBR (Fimage_instance_width);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4824 DEFSUBR (Fimage_instance_hotspot_x);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4825 DEFSUBR (Fimage_instance_hotspot_y);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4826 DEFSUBR (Fimage_instance_foreground);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4827 DEFSUBR (Fimage_instance_background);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4828 DEFSUBR (Fimage_instance_property);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4829 DEFSUBR (Fset_image_instance_property);
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4830 DEFSUBR (Fcolorize_image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4831 /* subwindows */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4832 DEFSUBR (Fsubwindowp);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4833 DEFSUBR (Fimage_instance_subwindow_id);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4834 DEFSUBR (Fresize_subwindow);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4835 DEFSUBR (Fforce_subwindow_map);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4836
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4837 /* Qnothing defined as part of the "nothing" image-instantiator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4838 type. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4839 /* Qtext defined in general.c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4840 defsymbol (&Qmono_pixmap, "mono-pixmap");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4841 defsymbol (&Qcolor_pixmap, "color-pixmap");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4842 /* Qpointer defined in general.c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4843
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4844 /* glyphs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4845
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4846 defsymbol (&Qglyphp, "glyphp");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4847 defsymbol (&Qcontrib_p, "contrib-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4848 defsymbol (&Qbaseline, "baseline");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4849
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4850 defsymbol (&Qbuffer_glyph_p, "buffer-glyph-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4851 defsymbol (&Qpointer_glyph_p, "pointer-glyph-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4852 defsymbol (&Qicon_glyph_p, "icon-glyph-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4854 defsymbol (&Qconst_glyph_variable, "const-glyph-variable");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4855
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4856 DEFSUBR (Fglyph_type);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4857 DEFSUBR (Fvalid_glyph_type_p);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4858 DEFSUBR (Fglyph_type_list);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4859 DEFSUBR (Fglyphp);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4860 DEFSUBR (Fmake_glyph_internal);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4861 DEFSUBR (Fglyph_width);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4862 DEFSUBR (Fglyph_ascent);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4863 DEFSUBR (Fglyph_descent);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4864 DEFSUBR (Fglyph_height);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4865
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4866 /* Qbuffer defined in general.c. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4867 /* Qpointer defined above */
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
4868
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4869 /* Unfortunately, timeout handlers must be lisp functions. This is
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4870 for animated glyphs. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4871 defsymbol (&Qglyph_animated_timeout_handler,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4872 "glyph-animated-timeout-handler");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4873 DEFSUBR (Fglyph_animated_timeout_handler);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4874
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
4875 /* Errors */
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
4876 deferror (&Qimage_conversion_error,
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
4877 "image-conversion-error",
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
4878 "image-conversion error", Qio_error);
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
4879
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4880 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4881
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4882 static const struct lrecord_description image_specifier_description[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4883 { XD_LISP_OBJECT, specifier_data_offset + offsetof (struct image_specifier, attachee) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4884 { XD_LISP_OBJECT, specifier_data_offset + offsetof (struct image_specifier, attachee_property) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4885 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4886 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4887
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4888 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4889 specifier_type_create_image (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4890 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4891 /* image specifiers */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4892
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4893 INITIALIZE_SPECIFIER_TYPE_WITH_DATA (image, "image", "imagep");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4894
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4895 SPECIFIER_HAS_METHOD (image, create);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4896 SPECIFIER_HAS_METHOD (image, mark);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4897 SPECIFIER_HAS_METHOD (image, instantiate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4898 SPECIFIER_HAS_METHOD (image, validate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4899 SPECIFIER_HAS_METHOD (image, after_change);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4900 SPECIFIER_HAS_METHOD (image, going_to_add);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4901 SPECIFIER_HAS_METHOD (image, copy_instantiator);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4902 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4903
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4904 void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4905 reinit_specifier_type_create_image (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4906 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4907 REINITIALIZE_SPECIFIER_TYPE (image);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4908 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4909
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4910
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4911 static const struct lrecord_description iike_description_1[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4912 { XD_LISP_OBJECT, offsetof (ii_keyword_entry, keyword) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4913 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4914 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4915
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4916 static const struct struct_description iike_description = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4917 sizeof (ii_keyword_entry),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4918 iike_description_1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4919 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4920
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4921 static const struct lrecord_description iiked_description_1[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4922 XD_DYNARR_DESC (ii_keyword_entry_dynarr, &iike_description),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4923 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4924 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4925
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4926 static const struct struct_description iiked_description = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4927 sizeof (ii_keyword_entry_dynarr),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4928 iiked_description_1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4929 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4930
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4931 static const struct lrecord_description iife_description_1[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4932 { XD_LISP_OBJECT, offsetof (image_instantiator_format_entry, symbol) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4933 { XD_LISP_OBJECT, offsetof (image_instantiator_format_entry, device) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4934 { XD_STRUCT_PTR, offsetof (image_instantiator_format_entry, meths), 1, &iim_description },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4935 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4936 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4937
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4938 static const struct struct_description iife_description = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4939 sizeof (image_instantiator_format_entry),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4940 iife_description_1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4941 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4942
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4943 static const struct lrecord_description iifed_description_1[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4944 XD_DYNARR_DESC (image_instantiator_format_entry_dynarr, &iife_description),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4945 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4946 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4947
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4948 static const struct struct_description iifed_description = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4949 sizeof (image_instantiator_format_entry_dynarr),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4950 iifed_description_1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4951 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4952
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4953 static const struct lrecord_description iim_description_1[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4954 { XD_LISP_OBJECT, offsetof (struct image_instantiator_methods, symbol) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4955 { XD_LISP_OBJECT, offsetof (struct image_instantiator_methods, device) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4956 { XD_STRUCT_PTR, offsetof (struct image_instantiator_methods, keywords), 1, &iiked_description },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4957 { XD_STRUCT_PTR, offsetof (struct image_instantiator_methods, consoles), 1, &cted_description },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4958 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4959 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4960
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4961 const struct struct_description iim_description = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4962 sizeof(struct image_instantiator_methods),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4963 iim_description_1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4964 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4965
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4966 void
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4967 image_instantiator_format_create (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4968 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4969 /* image instantiators */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4970
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4971 the_image_instantiator_format_entry_dynarr =
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
4972 Dynarr_new (image_instantiator_format_entry);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4974 Vimage_instantiator_format_list = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4975 staticpro (&Vimage_instantiator_format_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4976
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4977 dumpstruct (&the_image_instantiator_format_entry_dynarr, &iifed_description);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4978
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4979 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (nothing, "nothing");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4980
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4981 IIFORMAT_HAS_METHOD (nothing, possible_dest_types);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4982 IIFORMAT_HAS_METHOD (nothing, instantiate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4983
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4984 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (inherit, "inherit");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4985
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4986 IIFORMAT_HAS_METHOD (inherit, validate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4987 IIFORMAT_HAS_METHOD (inherit, normalize);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4988 IIFORMAT_HAS_METHOD (inherit, possible_dest_types);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4989 IIFORMAT_HAS_METHOD (inherit, instantiate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4990
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4991 IIFORMAT_VALID_KEYWORD (inherit, Q_face, check_valid_face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4993 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (string, "string");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4994
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4995 IIFORMAT_HAS_METHOD (string, validate);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4996 IIFORMAT_HAS_SHARED_METHOD (string, governing_domain, subwindow);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4997 IIFORMAT_HAS_METHOD (string, possible_dest_types);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4998 IIFORMAT_HAS_METHOD (string, instantiate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4999
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5000 IIFORMAT_VALID_KEYWORD (string, Q_data, check_valid_string);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5001 /* Do this so we can set strings. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5002 /* #### Andy, what is this? This is a bogus format and should not be
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5003 visible to the user. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5004 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (text, "text");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5005 IIFORMAT_HAS_METHOD (text, set_property);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5006 IIFORMAT_HAS_METHOD (text, query_geometry);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5007
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5008 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (formatted_string, "formatted-string");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5009
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5010 IIFORMAT_HAS_METHOD (formatted_string, validate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5011 IIFORMAT_HAS_METHOD (formatted_string, possible_dest_types);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5012 IIFORMAT_HAS_METHOD (formatted_string, instantiate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5013 IIFORMAT_VALID_KEYWORD (formatted_string, Q_data, check_valid_string);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5014
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5015 /* Do this so pointers have geometry. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5016 /* #### Andy, what is this? This is a bogus format and should not be
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5017 visible to the user. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5018 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (pointer, "pointer");
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5019 IIFORMAT_HAS_SHARED_METHOD (pointer, query_geometry, subwindow);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5020
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5021 /* subwindows */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5022 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (subwindow, "subwindow");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5023 IIFORMAT_HAS_METHOD (subwindow, possible_dest_types);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5024 IIFORMAT_HAS_METHOD (subwindow, governing_domain);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5025 IIFORMAT_HAS_METHOD (subwindow, instantiate);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5026 IIFORMAT_HAS_METHOD (subwindow, query_geometry);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5027 IIFORMAT_VALID_KEYWORD (subwindow, Q_pixel_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5028 IIFORMAT_VALID_KEYWORD (subwindow, Q_pixel_height, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5029
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5030 #ifdef HAVE_WINDOW_SYSTEM
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5031 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xbm, "xbm");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5032
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5033 IIFORMAT_HAS_METHOD (xbm, validate);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5034 IIFORMAT_HAS_METHOD (xbm, normalize);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5035 IIFORMAT_HAS_METHOD (xbm, possible_dest_types);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5036
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5037 IIFORMAT_VALID_KEYWORD (xbm, Q_data, check_valid_xbm_inline);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5038 IIFORMAT_VALID_KEYWORD (xbm, Q_file, check_valid_string);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5039 IIFORMAT_VALID_KEYWORD (xbm, Q_mask_data, check_valid_xbm_inline);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5040 IIFORMAT_VALID_KEYWORD (xbm, Q_mask_file, check_valid_string);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5041 IIFORMAT_VALID_KEYWORD (xbm, Q_hotspot_x, check_valid_int);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5042 IIFORMAT_VALID_KEYWORD (xbm, Q_hotspot_y, check_valid_int);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5043 IIFORMAT_VALID_KEYWORD (xbm, Q_foreground, check_valid_string);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5044 IIFORMAT_VALID_KEYWORD (xbm, Q_background, check_valid_string);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5045 #endif /* HAVE_WINDOW_SYSTEM */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5046
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5047 #ifdef HAVE_XFACE
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5048 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xface, "xface");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5049
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5050 IIFORMAT_HAS_METHOD (xface, validate);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5051 IIFORMAT_HAS_METHOD (xface, normalize);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5052 IIFORMAT_HAS_METHOD (xface, possible_dest_types);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5053
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5054 IIFORMAT_VALID_KEYWORD (xface, Q_data, check_valid_string);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5055 IIFORMAT_VALID_KEYWORD (xface, Q_file, check_valid_string);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5056 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_x, check_valid_int);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5057 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_y, check_valid_int);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5058 IIFORMAT_VALID_KEYWORD (xface, Q_foreground, check_valid_string);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5059 IIFORMAT_VALID_KEYWORD (xface, Q_background, check_valid_string);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5060 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5061
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5062 #ifdef HAVE_XPM
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5063 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xpm, "xpm");
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5064
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5065 IIFORMAT_HAS_METHOD (xpm, validate);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5066 IIFORMAT_HAS_METHOD (xpm, normalize);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5067 IIFORMAT_HAS_METHOD (xpm, possible_dest_types);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5068
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5069 IIFORMAT_VALID_KEYWORD (xpm, Q_data, check_valid_string);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5070 IIFORMAT_VALID_KEYWORD (xpm, Q_file, check_valid_string);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5071 IIFORMAT_VALID_KEYWORD (xpm, Q_color_symbols, check_valid_xpm_color_symbols);
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 280
diff changeset
5072 #endif /* HAVE_XPM */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5073 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5074
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5075 void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5076 reinit_vars_of_glyphs (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5077 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5078 the_expose_ignore_blocktype =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5079 Blocktype_new (struct expose_ignore_blocktype);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5080
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5081 hold_ignored_expose_registration = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5082 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5083
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5084
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5085 void
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5086 vars_of_glyphs (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5087 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5088 reinit_vars_of_glyphs ();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5089
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5090 Vthe_nothing_vector = vector1 (Qnothing);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5091 staticpro (&Vthe_nothing_vector);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5092
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5093 /* image instances */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5094
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5095 Vimage_instance_type_list = Fcons (Qnothing,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5096 list6 (Qtext, Qmono_pixmap, Qcolor_pixmap,
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5097 Qpointer, Qsubwindow, Qwidget));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5098 staticpro (&Vimage_instance_type_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5099
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5100 /* glyphs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5102 Vglyph_type_list = list3 (Qbuffer, Qpointer, Qicon);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5103 staticpro (&Vglyph_type_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5105 /* The octal-escape glyph, control-arrow-glyph and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5106 invisible-text-glyph are completely initialized in glyphs.el */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5108 DEFVAR_LISP ("octal-escape-glyph", &Voctal_escape_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5109 What to prefix character codes displayed in octal with.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5110 */);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5111 Voctal_escape_glyph = allocate_glyph (GLYPH_BUFFER, redisplay_glyph_changed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5113 DEFVAR_LISP ("control-arrow-glyph", &Vcontrol_arrow_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5114 What to use as an arrow for control characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5115 */);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5116 Vcontrol_arrow_glyph = allocate_glyph (GLYPH_BUFFER,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5117 redisplay_glyph_changed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5119 DEFVAR_LISP ("invisible-text-glyph", &Vinvisible_text_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5120 What to use to indicate the presence of invisible text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5121 This is the glyph that is displayed when an ellipsis is called for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5122 \(see `selective-display-ellipses' and `buffer-invisibility-spec').
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
5123 Normally this is three dots ("...").
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5124 */);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5125 Vinvisible_text_glyph = allocate_glyph (GLYPH_BUFFER,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5126 redisplay_glyph_changed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5128 /* Partially initialized in glyphs.el */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5129 DEFVAR_LISP ("hscroll-glyph", &Vhscroll_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5130 What to display at the beginning of horizontally scrolled lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5131 */);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5132 Vhscroll_glyph = allocate_glyph (GLYPH_BUFFER, redisplay_glyph_changed);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5133 #ifdef HAVE_WINDOW_SYSTEM
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5134 Fprovide (Qxbm);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5135 #endif
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5136 #ifdef HAVE_XPM
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5137 Fprovide (Qxpm);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5138
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5139 DEFVAR_LISP ("xpm-color-symbols", &Vxpm_color_symbols /*
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5140 Definitions of logical color-names used when reading XPM files.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5141 Elements of this list should be of the form (COLOR-NAME FORM-TO-EVALUATE).
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5142 The COLOR-NAME should be a string, which is the name of the color to define;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5143 the FORM should evaluate to a `color' specifier object, or a string to be
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5144 passed to `make-color-instance'. If a loaded XPM file references a symbolic
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5145 color called COLOR-NAME, it will display as the computed color instead.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5146
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5147 The default value of this variable defines the logical color names
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5148 \"foreground\" and \"background\" to be the colors of the `default' face.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5149 */ );
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5150 Vxpm_color_symbols = Qnil; /* initialized in x-faces.el */
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 280
diff changeset
5151 #endif /* HAVE_XPM */
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5152 #ifdef HAVE_XFACE
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5153 Fprovide (Qxface);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5154 #endif
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5155
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5156 DEFVAR_BOOL ("disable-animated-pixmaps", &disable_animated_pixmaps /*
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5157 Whether animated pixmaps should be animated.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5158 Default is t.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5159 */);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5160 disable_animated_pixmaps = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5161 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5163 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5164 specifier_vars_of_glyphs (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5165 {
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
5166 /* #### Can we GC here? The set_specifier_* calls definitely need */
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
5167 /* protection. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5168 /* display tables */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5170 DEFVAR_SPECIFIER ("current-display-table", &Vcurrent_display_table /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5171 *The display table currently in use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5172 This is a specifier; use `set-specifier' to change it.
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5173
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5174 Display tables are used to control how characters are displayed. Each
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5175 time that redisplay processes a character, it is looked up in all the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5176 display tables that apply (obtained by calling `specifier-instance' on
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5177 `current-display-table' and any overriding display tables specified in
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5178 currently active faces). The first entry found that matches the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5179 character determines how the character is displayed. If there is no
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5180 matching entry, the default display method is used. (Non-control
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5181 characters are displayed as themselves and control characters are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5182 displayed according to the buffer-local variable `ctl-arrow'. Control
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5183 characters are further affected by `control-arrow-glyph' and
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5184 `octal-escape-glyph'.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5185
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5186 Each instantiator in this specifier and the display-table specifiers
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5187 in faces is a display table or a list of such tables. If a list, each
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5188 table will be searched in turn for an entry matching a particular
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5189 character. Each display table is one of
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5190
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5191 -- a vector, specifying values for characters starting at 0
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5192 -- a char table, either of type `char' or `generic'
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5193 -- a range table
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5194
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5195 Each entry in a display table should be one of
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5196
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5197 -- nil (this entry is ignored and the search continues)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5198 -- a character (use this character; if it happens to be the same as
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5199 the original character, default processing happens, otherwise
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5200 redisplay attempts to display this character directly;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5201 #### At some point recursive display-table lookup will be
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5202 implemented.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5203 -- a string (display each character in the string directly;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5204 #### At some point recursive display-table lookup will be
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5205 implemented.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5206 -- a glyph (display the glyph;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5207 #### At some point recursive display-table lookup will be
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5208 implemented when a string glyph is being processed.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5209 -- a cons of the form (format "STRING") where STRING is a printf-like
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5210 spec used to process the character. #### Unfortunately no
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5211 formatting directives other than %% are implemented.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5212 -- a vector (each element of the vector is processed recursively;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5213 in such a case, nil elements in the vector are simply ignored)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5214
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5215 #### At some point in the near future, display tables are likely to
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5216 be expanded to include other features, such as referencing characters
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5217 in particular fonts and allowing the character search to continue
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5218 all the way up the chain of specifier instantiators. These features
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5219 are necessary to properly display Unicode characters.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5220 */ );
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 84
diff changeset
5221 Vcurrent_display_table = Fmake_specifier (Qdisplay_table);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5222 set_specifier_fallback (Vcurrent_display_table,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5223 list1 (Fcons (Qnil, Qnil)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5224 set_specifier_caching (Vcurrent_display_table,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5225 offsetof (struct window, display_table),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5226 some_window_value_changed,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5227 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5228 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5230 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5231 complex_vars_of_glyphs (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5232 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5233 /* Partially initialized in glyphs-x.c, glyphs.el */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5234 DEFVAR_LISP ("truncation-glyph", &Vtruncation_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5235 What to display at the end of truncated lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5236 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5237 Vtruncation_glyph = allocate_glyph (GLYPH_BUFFER, redisplay_glyph_changed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5239 /* Partially initialized in glyphs-x.c, glyphs.el */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5240 DEFVAR_LISP ("continuation-glyph", &Vcontinuation_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5241 What to display at the end of wrapped lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5242 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5243 Vcontinuation_glyph = allocate_glyph (GLYPH_BUFFER, redisplay_glyph_changed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5245 /* Partially initialized in glyphs-x.c, glyphs.el */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5246 DEFVAR_LISP ("xemacs-logo", &Vxemacs_logo /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5247 The glyph used to display the XEmacs logo at startup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5248 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5249 Vxemacs_logo = allocate_glyph (GLYPH_BUFFER, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5250 }